lasy
is a Python library that facilitates the initialization of complex laser pulses, in simulations of laser-plasma interactions.
More specifically, lasy
offers many ways to define complex laser pulses (e.g. from commonly-known analytical formulas, from experimental measurements, etc.) and offers pre-processing functionalities (e.g. propagation, re-normalization, geometry conversion). The laser field is then exported in a standardized file, that can be read by external simulation codes.
LASY manipulates laser pulses, and operates on the laser envelope. In 3D (x,y,t) Cartesian coordinates, the definition used is:
where
In cylindrical coordinates, the envelope is decomposed in
For more information, please check our arXiv preprint.
All contributions are welcome! For a new contribution, we use pull requests from forks. Below is a very rough summary, please have a look at the appropriate documentation at https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks and around.
First, setup your fork workflow (only once):
- Fork the repo by clicking the Fork button on the top right, and follow the prompts. This will create your own (remote) copy of the main https://github.com/LASY-org/LASY repo, located at https://github.com/[yourusername]/LASY.
- Make your local copy aware of your fork: from your local repository, do
git remote add [some-name] https://github.com/[your username]/LASY
. For[some-name]
it can be convenient to use e.g. your username.
Then, for each contribution:
- Get the last version of branch
development
from the main repo (e.g.git checkout development && git pull
). - Create a new branch (e.g.
git checkout -b my_contribution
). - Do usual
git add
andgit commit
operations. - Push your branch to your own fork:
git push -u [some-name] my_contribution
- Whenever you're ready, open a PR from branch
my_contribution
on your fork to branchdevelopment
on the main repo. Github typically suggests this very well.
- Docstrings are written using the Numpy style.
- Functions in
utils/laser_utils.py
only depend on standard types (Python & Numpy) and on theGrid
class. That way, they are relatively stand-alone and can be used on different data structures. A simple Grid factory is provided for that purpose. - A PR should be open for any contribution: the description helps to explain the code and open dicussion.
python3 -m pip install lasy
For tests, you need to have a few extra packages, such as pytest
and openpmd-viewer
installed:
python3 -m pip install -r tests/requirements.txt
After successful installation, you can run the unit tests:
# Run all tests
python3 -m pytest tests/
# Run tests from a single file
python3 -m pytest tests/test_laser_profiles.py
# Run a single test (useful during debugging)
python3 -m pytest tests/test_laser_profiles.py::test_profile_gaussian_3d_cartesian
# Run all tests, do not capture "print" output and be verbose
python3 -m pytest -s -vvvv tests/
Install sphinx (https://www.sphinx-doc.org/en/master/usage/installation.html)
python -m pip install --upgrade -r docs/requirements.txt
cd docs
sphinx-build -b html source _build