LAser pulse manipulation made eaSY
Project description
lasy
Overview
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.
Installation
For the standard release of the code simply run:
python3 -m pip install lasy
If you would prefer the most recent version of the code with the latest functionalities, then run:
python3 -m pip install git+https://github.com/LASY-org/lasy.git
Tutorials
An interactive Google Colab tutorial showing some of the main functionalities of lasy can be found here.
This document is updated on a best-effort basis to keep track with developments in the lasy code base.
Additionally, a set of static (automatically tested) examples can be found here.
Documentation
LASY manipulates laser pulses, and operates on the laser envelope. In 3D (x,y,t) Cartesian coordinates, the definition used is:
\begin{aligned}
E_x(x,y,t) = \mathrm{Re}\left( \mathcal{E}(x,y,t) e^{-i\omega_0t}p_x\right)\\
E_y(x,y,t) = \mathrm{Re}\left( \mathcal{E}(x,y,t) e^{-i\omega_0t}p_y\right)\end{aligned}
where $\mathrm{Re}$ stands for real part, $E_x$ (resp. $E_y$) is the laser electric field in the x (resp. y) direction, $\mathcal{E}$ is the complex laser envelope stored and used in lasy, $\omega_0 = 2\pi c/\lambda_0$ is the angular frequency defined from the laser wavelength $\lambda_0$ and $(p_x,p_y)$ is the (complex and normalized) polarization vector.
In cylindrical coordinates, the envelope is decomposed in $N_m$ azimuthal modes ( see Ref. [A. Lifschitz et al., J. Comp. Phys. 228.5: 1803-1814 (2009)]). Each mode is stored on a 2D grid (r,t), using the following definition:
\begin{aligned}
E_x (r,\theta,t) = \mathrm{Re}\left( \sum_{-N_m+1}^{N_m-1}\mathcal{E}_m(r,t) e^{-im\theta}e^{-i\omega_0t}p_x\right)\\
E_y (r,\theta,t) = \mathrm{Re}\left( \sum_{-N_m+1}^{N_m-1}\mathcal{E}_m(r,t) e^{-im\theta}e^{-i\omega_0t}p_y\right).\end{aligned}
For more information, please check our arXiv preprint.
Workflow
How to contribute
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
developmentfrom the main repo (e.g.git checkout development && git pull). - Create a new branch (e.g.
git checkout -b my_contribution). - Do usual
git addandgit commitoperations. - Push your branch to your own fork:
git push -u [some-name] my_contribution - Whenever you're ready, open a PR from branch
my_contributionon your fork to branchdevelopmenton the main repo. Github typically suggests this very well.
Style conventions
- Docstrings are written using the Numpy style.
- Functions in
utils/laser_utils.pyonly depend on standard types (Python & Numpy) and on theGridclass. 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.
Testing
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/
Creating Documentation
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lasy-0.7.0.tar.gz.
File metadata
- Download URL: lasy-0.7.0.tar.gz
- Upload date:
- Size: 100.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f54639dabc892adcb59420e242499409ed591ff2777b712e6beee139215e61e4
|
|
| MD5 |
0541df9ea2c9edb427680bd7339c300c
|
|
| BLAKE2b-256 |
b6e6a81fcfd8a22d6e78c74c64492befe82ad4f8bb551a4068fd4923908c7c32
|
Provenance
The following attestation bundles were made for lasy-0.7.0.tar.gz:
Publisher:
publish-to-pypi.yml on LASY-org/lasy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lasy-0.7.0.tar.gz -
Subject digest:
f54639dabc892adcb59420e242499409ed591ff2777b712e6beee139215e61e4 - Sigstore transparency entry: 707589318
- Sigstore integration time:
-
Permalink:
LASY-org/lasy@c229ab1df084f16e15e022bbabde2f8006fa5a38 -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/LASY-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@c229ab1df084f16e15e022bbabde2f8006fa5a38 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lasy-0.7.0-py3-none-any.whl.
File metadata
- Download URL: lasy-0.7.0-py3-none-any.whl
- Upload date:
- Size: 111.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d63667567184b41d56a40bb2029d3a195f4a76265f3a0adfde32dae3de3b2fcd
|
|
| MD5 |
65d4740e62748d961361766f8525dd5e
|
|
| BLAKE2b-256 |
d4cc50ac1c4f7dc76ee0c3320d632d87916827e6bf3315dc38c97328e84877da
|
Provenance
The following attestation bundles were made for lasy-0.7.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on LASY-org/lasy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lasy-0.7.0-py3-none-any.whl -
Subject digest:
d63667567184b41d56a40bb2029d3a195f4a76265f3a0adfde32dae3de3b2fcd - Sigstore transparency entry: 707589320
- Sigstore integration time:
-
Permalink:
LASY-org/lasy@c229ab1df084f16e15e022bbabde2f8006fa5a38 -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/LASY-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@c229ab1df084f16e15e022bbabde2f8006fa5a38 -
Trigger Event:
release
-
Statement type: