pylgs


Namepylgs JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/simonkeys/pylgs
SummaryModeling atomic physics of laser guide stars
upload_time2024-12-06 10:10:54
maintainerNone
docs_urlNone
authorSimon Rochester
requires_python>=3.10
licenseGPLv3
keywords nbdev jupyter notebook python lgs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyLGS


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

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](https://computing.llnl.gov/projects/sundials), with
[scikits.odes](https://scikits-odes.readthedocs.io/en/latest/installation.html)
as the Python interface. Before installing pyLGS you may need to install
SUNDIALS and the scikits.odes dependencies. On Ubuntu/Debian-based
distributions this can be done with `apt-get`:

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

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

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

``` sh
pip install pylgs
```

## How to use

Import the package:

``` python
from pylgs.lgssystem import LGSSystem
```

List available atomic systems for an LGS model:

``` python
LGSSystem.builtins()
```

    ['NaD1', 'Na330', 'NaD2', 'NaD2_Repump', 'NaD1_Toy']

Show a level diagram for one of the atomic systems:

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

![](index_files/figure-commonmark/cell-4-output-1.svg)

Print some information about the system:

``` python
LGSSystem.info("NaD2_Repump")
```

#### Atomic levels

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

#### Pump transitions

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

#### Transition wavelengths

- $\text{3P}_{\frac{3}{2}}\to \text{3S}_{\frac{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:

``` python
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:

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

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

``` python
model = lgs.adaptive_stationary_model(params)
```

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

``` python
sol = model.solve(params)
```

Find the total return flux:

``` python
model.total_flux(sol).item()
```

    7709.054844667825

Plot the return flux as a function of atomic velocity:

``` python
model.flux_distribution(sol).visualize()
```

![](index_files/figure-commonmark/cell-11-output-1.svg)

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

``` python
model.level_population_distribution(sol).visualize()
```

![](index_files/figure-commonmark/cell-12-output-1.svg)

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

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

![](index_files/figure-commonmark/cell-13-output-1.svg)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/simonkeys/pylgs",
    "name": "pylgs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python LGS",
    "author": "Simon Rochester",
    "author_email": "simon.rochester@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/61/b1/f48e06ab95761841c6dedb7095cfbc5edb45d65719591f8f413262235c59/pylgs-0.1.0.tar.gz",
    "platform": null,
    "description": "# pyLGS\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\npyLGS performs simulations of the atomic physics of cw, modulated, and\npulsed laser guide stars. The effects of the full atomic structure,\natomic velocity distribution, one or multiple pump fields, the\ngeomagnetic field, velocity-changing and spin-randomizing collisions,\nand atomic recoil are all taken into account.\n\n## Installation\n\npyLGS uses the CVODE library from the [SUNDIALS\npackage](https://computing.llnl.gov/projects/sundials), with\n[scikits.odes](https://scikits-odes.readthedocs.io/en/latest/installation.html)\nas the Python interface. Before installing pyLGS you may need to install\nSUNDIALS and the scikits.odes dependencies. On Ubuntu/Debian-based\ndistributions this can be done with `apt-get`:\n\n``` sh\nsudo apt-get install python3-dev gcc gfortran libsundials-dev\n```\n\n(Note that at least SUNDIALS version 6 is required \u2013 this is supplied by\nUbuntu 24.04/Debian 12 and later.)\n\nOnce the above dependencies are installed, pyLGS can be installed with\n`pip`:\n\n``` sh\npip install pylgs\n```\n\n## How to use\n\nImport the package:\n\n``` python\nfrom pylgs.lgssystem import LGSSystem\n```\n\nList available atomic systems for an LGS model:\n\n``` python\nLGSSystem.builtins()\n```\n\n    ['NaD1', 'Na330', 'NaD2', 'NaD2_Repump', 'NaD1_Toy']\n\nShow a level diagram for one of the atomic systems:\n\n``` python\nLGSSystem.diagram(\"NaD2_Repump\", \"ToScale\")\n```\n\n![](index_files/figure-commonmark/cell-4-output-1.svg)\n\nPrint some information about the system:\n\n``` python\nLGSSystem.info(\"NaD2_Repump\")\n```\n\n#### Atomic levels\n\n$\\text{3S}_{\\frac{1}{2}}$, $\\text{3P}_{\\frac{3}{2}}$\n\n#### Pump transitions\n\n1.  $\\text{3S}_{\\frac{1}{2}}\\land F=1\\to \\text{3P}_{\\frac{3}{2}}$\n2.  $\\text{3S}_{\\frac{1}{2}}\\land F=2\\to \\text{3P}_{\\frac{3}{2}}$\n\n#### Transition wavelengths\n\n- $\\text{3P}_{\\frac{3}{2}}\\to \\text{3S}_{\\frac{1}{2}}$: 589.158 nm\n\n#### Substructure\n\n- Hyperfine structure included\n- Zeeman structure included\n- 24 total sublevels\n\n#### Density matrix elements\n\n- All populations included\n- All Zeeman coherences (between same level and same F) included\n- All hyperfine coherences (between same level and different F)\n  neglected\n- Optical coherences (between different levels) included for pump\n  transitions only\n- 374 total density matrix elements\n\n#### Input parameters\n\n- BeamTransitRatePerS\n- BFieldG\n- MagneticAzimuthDegrees\n- MagneticZenithDegrees\n- RecoilParameter\n- SDampingCollisionRatePerS\n- TemperatureK\n- VccRatePerS\n- DetuningHz1\n- DetuningHz2\n- EllipticityDegrees1\n- EllipticityDegrees2\n- IntensitySI1\n- IntensitySI2\n- LaserWidthHz1\n- LaserWidthHz2\n- PolarizationAngleDegrees1\n- PolarizationAngleDegrees2\n\nLoad the atomic system and set values for parameters that will not be\nvaried:\n\n``` python\nlgs = LGSSystem(\n    'NaD2_Repump', \n    {\n        'EllipticityDegrees1': 45.,\n        'PolarizationAngleDegrees1': 0,\n        'DetuningHz1': 1.0832e9,\n        'LaserWidthHz1': 10.0e6,\n        'EllipticityDegrees2': 45.,\n        'PolarizationAngleDegrees2': 0,\n        'DetuningHz2': -6.268e8 + 1.e8,\n        'LaserWidthHz2': 10.0e6,\n        'MagneticZenithDegrees': 45.,\n        'MagneticAzimuthDegrees': 45.,\n        'SDampingCollisionRatePerS': 4081.63,\n        'BeamTransitRatePerS': 131.944,\n        'VccRatePerS': 28571.,\n        'TemperatureK': 185.,\n        'RecoilParameter': 1\n    }\n)\n```\n\nDefine sample values for the varying parameters:\n\n``` python\nparams = {'IntensitySI1': 5., 'IntensitySI2': 46., 'BFieldG': 0.5}\n```\n\nBuild a steady-state model with adaptively refined velocity groups based\non the sample parameters:\n\n``` python\nmodel = lgs.adaptive_stationary_model(params)\n```\n\nSolve the model for the steady state using the sample parameters:\n\n``` python\nsol = model.solve(params)\n```\n\nFind the total return flux:\n\n``` python\nmodel.total_flux(sol).item()\n```\n\n    7709.054844667825\n\nPlot the return flux as a function of atomic velocity:\n\n``` python\nmodel.flux_distribution(sol).visualize()\n```\n\n![](index_files/figure-commonmark/cell-11-output-1.svg)\n\nPlot the ground and excited state populations as a function of atomic\nvelocity:\n\n``` python\nmodel.level_population_distribution(sol).visualize()\n```\n\n![](index_files/figure-commonmark/cell-12-output-1.svg)\n\nPlot the real and imaginary parts of all density-matrix elements:\n\n``` python\nmodel.velocity_normalize(sol).visualize(line_width=1)\n```\n\n![](index_files/figure-commonmark/cell-13-output-1.svg)\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Modeling atomic physics of laser guide stars",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/simonkeys/pylgs"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python",
        "lgs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e328e976577e3a53c8b5fcfe2f2833500937a47657aae24f866fe82e6cd7fa2",
                "md5": "16223c4cec50e241d1255b20fa80ea60",
                "sha256": "65316617f5ecec76029b10e6155f169fb502894472591e7a3b32268bb4ebb01d"
            },
            "downloads": -1,
            "filename": "pylgs-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "16223c4cec50e241d1255b20fa80ea60",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 318391,
            "upload_time": "2024-12-06T10:10:52",
            "upload_time_iso_8601": "2024-12-06T10:10:52.821310Z",
            "url": "https://files.pythonhosted.org/packages/1e/32/8e976577e3a53c8b5fcfe2f2833500937a47657aae24f866fe82e6cd7fa2/pylgs-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "61b1f48e06ab95761841c6dedb7095cfbc5edb45d65719591f8f413262235c59",
                "md5": "09a5326c5b53f6210ec45b47a341dbe4",
                "sha256": "6a601c7b4298cf68df1a2d1eaf0e868298cc04c1ee8e6be2672267d97cd42933"
            },
            "downloads": -1,
            "filename": "pylgs-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "09a5326c5b53f6210ec45b47a341dbe4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 297353,
            "upload_time": "2024-12-06T10:10:54",
            "upload_time_iso_8601": "2024-12-06T10:10:54.679877Z",
            "url": "https://files.pythonhosted.org/packages/61/b1/f48e06ab95761841c6dedb7095cfbc5edb45d65719591f8f413262235c59/pylgs-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-06 10:10:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonkeys",
    "github_project": "pylgs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pylgs"
}
        
Elapsed time: 0.40886s