Skip to main content

LAser pulse manipulation made eaSY

Project description

lasy

Warning: This library is currently in development, and it is, at this stage, only meant to be used/tested by developers. We plan on releasing the first version for general users (i.e. beta version) by summer 2023.

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.

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}

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 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 and git 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 branch development on the main repo. Github typically suggests this very well.

Style conventions

  • Docstrings are written using the Numpy style.
  • Functions in utils/laser_utils.py only depend on standard types (Python & Numpy) and on the Grid 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.

Install

python3 -m pip install -v .

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

Test

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)

cd docs
python -m pip install -r requirements.txt
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

lasy-0.3.0.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

lasy-0.3.0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file lasy-0.3.0.tar.gz.

File metadata

  • Download URL: lasy-0.3.0.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for lasy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 299ec2bf4be7fa5b79b99dbde8f5c50cc136e1d3559dd9d65993bef747d7d6c3
MD5 8e37bdd8a83a1ac43e253e9627531d4e
BLAKE2b-256 01992f9623abee401d599b62cfd031bbe92b41ef465e932ce754ab6c96b63d2a

See more details on using hashes here.

File details

Details for the file lasy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: lasy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for lasy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84a2ad06c08aa7ec848e331c4d2da03301f538faf55f3fad18bcaec7b314718b
MD5 9084a0f8acbd02eb20814deecefe82f3
BLAKE2b-256 f0399a8d23f07bd203733a692e59d2783a6a172f70974f318fc35846e3b24918

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page