Skip to main content

Modeling atomic physics of laser guide stars

Project description

pyLGS

pyLGS performs simulations of the atomic physics of cw, modulated, and pulsed laser guide stars. The effects of the full atomic structure, atomic velocity distribution, one or multiple pump fields, the geomagnetic field, velocity-changing and spin-randomizing collisions, and atomic recoil are all taken into account.

Installation

pyLGS uses the CVODE library from the SUNDIALS package, with scikits.odes as the Python interface. Before installing pyLGS you may need to install SUNDIALS and the scikits.odes dependencies. On Ubuntu/Debian-based distributions (or on Windows using WSL) this can be done with apt-get:

sudo apt-get install python3-dev gcc gfortran libsundials-dev

(Note that SUNDIALS version 6 or later is required – this is supplied by Ubuntu 24.04/Debian 12 and later.)

On macOS SUNDIALS can be installed using conda:

conda install conda-forge::sundials

(Note that homebrew also has a SUNDIALS package, but it doesn’t install the header files that scikits.odes requires.)

Once the above dependencies are installed, pyLGS can be installed with pip:

pip install pylgs

How to use

Import the package:

from pylgs.lgssystem import LGSSystem

List available atomic systems for an LGS model:

LGSSystem.builtins()
['Na330', 'NaD1', 'NaD1_Toy', 'NaD2', 'NaD2_Repump']

Show a level diagram for one of the atomic systems:

LGSSystem.diagram("NaD2_Repump", "ToScale")

Print some information about the system:

LGSSystem.info("NaD2_Repump")

Atomic levels

$\text{3S} _{1/2}$, $\text{3P} _{3/2}$

Pump transitions

  1. $\text{3S} _{1/2}\land F=1\to \text{3P} _{3/2}$
  2. $\text{3S} _{1/2}\land F=2\to \text{3P} _{3/2}$

Transition wavelengths

  • $\text{3P} _{3/2}\to \text{3S} _{1/2}$: 589.158 nm

Substructure

  • Hyperfine structure included
  • Zeeman structure included
  • 24 total sublevels

Density matrix elements

  • All populations included
  • All Zeeman coherences (between same level and same F) included
  • All hyperfine coherences (between same level and different F) neglected
  • Optical coherences (between different levels) included for pump transitions only
  • 374 total density matrix elements

Input parameters

  • BeamTransitRatePerS
  • BFieldG
  • MagneticAzimuthDegrees
  • MagneticZenithDegrees
  • RecoilParameter
  • SDampingCollisionRatePerS
  • TemperatureK
  • VccRatePerS
  • DetuningHz1
  • DetuningHz2
  • EllipticityDegrees1
  • EllipticityDegrees2
  • IntensitySI1
  • IntensitySI2
  • LaserWidthHz1
  • LaserWidthHz2
  • PolarizationAngleDegrees1
  • PolarizationAngleDegrees2

Load the atomic system and set values for parameters that will not be varied:

lgs = LGSSystem(
    'NaD2_Repump', 
    {
        'EllipticityDegrees1': 45.,
        'PolarizationAngleDegrees1': 0,
        'DetuningHz1': 1.0832e9,
        'LaserWidthHz1': 10.0e6,
        'EllipticityDegrees2': 45.,
        'PolarizationAngleDegrees2': 0,
        'DetuningHz2': -6.268e8 + 1.e8,
        'LaserWidthHz2': 10.0e6,
        'MagneticZenithDegrees': 45.,
        'MagneticAzimuthDegrees': 45.,
        'SDampingCollisionRatePerS': 4081.63,
        'BeamTransitRatePerS': 131.944,
        'VccRatePerS': 28571.,
        'TemperatureK': 185.,
        'RecoilParameter': 1
    }
)

Define sample values for the varying parameters:

params = {'IntensitySI1': 5., 'IntensitySI2': 46., 'BFieldG': 0.5}

Build a steady-state model with adaptively refined velocity groups based on the sample parameters:

model = lgs.adaptive_stationary_model(params)

Solve the model for the steady state using the sample parameters:

sol = model.solve(params)

Find the total return flux:

model.total_flux(sol).item()
7709.054844668253

Plot the return flux as a function of atomic velocity:

model.flux_distribution(sol).visualize()

Plot the ground and excited state populations as a function of atomic velocity:

model.level_population_distribution(sol).visualize()

Plot the real and imaginary parts of all density-matrix elements:

model.velocity_normalize(sol).visualize(line_width=1)

LGS systems

The LGS system models are based on systems of equations generated using the AtomicDensityMatrix package for Mathematica, together with an add-on package that has not yet been released, but will be available in the near future. If you are interested in modeling an LGS scheme that is not currently available as a built-in system, you can create an issue describing it and I will consider adding it as a built-in.

Development

pyLGS is developed with the nbdev system for “literate” programming[^1] using Jupyter notebooks. The source code, documentation source, and tests are co-mingled in Jupyter notebooks (.ipynb files) contained in the nbs directory. The source code is exported to create the module (.py) files in the pylgs directory. Documentation is generated from the Jupyter notebooks using the Quarto publishing system. Tests are run by batch evaluation of the notebooks.

Copyright

Copyright © 2023 onward Simon Rochester (Rochester Scientific, LLC). Licensed under the GNU General Public License - Version 3 (the “License”); you may not use this project’s files except in compliance with the License. A copy of the License is provided in the LICENSE file in this repository.

[^1]: or possibly “semi-literate” programming

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

pylgs-0.2.0.tar.gz (301.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylgs-0.2.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pylgs-0.2.0.tar.gz.

File metadata

  • Download URL: pylgs-0.2.0.tar.gz
  • Upload date:
  • Size: 301.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for pylgs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4c243ca661fc31c6d9598a3ff5772db1397c93b98603b28b805554beb8d28417
MD5 267b4efdc3e3da50e2dd596426674bd8
BLAKE2b-256 e5b1ea8fb7aa81aa5774e0f9b0183b44cea43f5325e55fc8b4b5bbd010b2d667

See more details on using hashes here.

File details

Details for the file pylgs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pylgs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for pylgs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dbcc3bbcd0c60ea6cf7e4f5bf0d677e6dcd200e5f0b0516546f6c8133c63f2c
MD5 7918491b6e05f977b7ed9dd6de5e1950
BLAKE2b-256 ca16c27a9129bc59393b95af1ccc62c2d9da6a55b0d33d14ac3ddfed557513cd

See more details on using hashes here.

Supported by

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