Skip to main content

HyLight

HyLight (HYdrogen recombination LIne emission from ionized Gas in varying tHermal condiTions) calculates the level population of the excited states in atomic hydrogen and hence the typical recombination line emissivity. The results are accurate under typical photoionised nebular conditions.

Installation

The package can be installed via

pip install hylightpy

Examples

Example usage can be found on Google Colab,

or see the examples/ folder.

Example usage

To import the package, type

import hylightpy

Initialisation

Then initialise the class using

HI = hylightpy.HIAtom(nmax = 50, verbose=True, caseB=True, 
                      recom=True, coll=True, 
                      cache_path='./')

where the user specify the number of levels in the hydrogen atom, the Case, and whether to include radiative processes and collisional processes. The user also have the freedom to specify the cache folder path, which will be storing cascade matrix elements. By default, the code will use the currect working directory as to store the cache.

Line emissivity calculation

We utilise unyt package to specify the gas density and temperature.

import unyt

In the following code block, we specify typical nebular conditions:

ne=unyt.array.unyt_array([1e2], 'cm**(-3)')
nHI=unyt.array.unyt_array([1e-5], 'cm**(-3)')
nHII=unyt.array.unyt_array([1e2], 'cm**(-3)')
temp=unyt.array.unyt_array([1e4], 'K')

Then we use the function get_emissivity to calculate the line emissivity at a given density and temperature.

eps = HI.get_line_emissivity(ne=ne, 
                             nHI=nHI, 
                             nHII=nHII, 
                             temp=temp, 
                             nupper=3, nlower=2)

The above line calculates the H $\alpha$ line emissivity at a given gas density (electron density of 100 $\rm{cm}^{-3}$, proton density of 100 $\rm{cm}^{-3}$ and neutral hydrogen density of 1e-5 $\rm{cm}^{-3}$) and temperature (1e4 K).

Level population

The function compute_level_pop computes the level popualtion density. The following line calculates the 3 $p$ state population density at the same condition:

HI.compute_level_pop(nHII=nHII, 
                     ne=ne, 
                     nHI=nHI, 
                     temp=temp, 
                     n=3, l=1)

More examples can be found in the examples/ folder.

Documentation

The documentation is available here.

Method

The method is described in Liu et al. 2025.

License

This package is released under the permissive MIT license.

How to cite?

If you use this code in your work, we kindly ask you to cite Liu et al. 2025.

Metadata

Release files for hylightpy 0.0.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hylightpy 0.0.23
File Size Uploaded Provenance
hylightpy-0.0.23.tar.gz 11.5 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hylightpy 0.0.23
File Interpreter ABI Platform
hylightpy-0.0.23-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 MB

Release files / hylightpy-0.0.23.tar.gz

Download URL hylightpy-0.0.23.tar.gz
Size 11.5 MB
Tags Source
SHA-256 checksum
How to use checksums
ecf95ead64e2772aa638d35fe25b6388d376f704879c2a020296ad949bce9c20
BLAKE2b-256 checksum
How to use checksums
25b3b9435dd84412e20ed811065ed9da93cfbea1eb6b2c798268a0638d38f45e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / hylightpy-0.0.23-py3-none-any.whl

Download URL hylightpy-0.0.23-py3-none-any.whl
Size 11.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
906cf23826ce9226bd3e072710fdd2fa43b9859e71a4a99c56f4d988430b0ae7
BLAKE2b-256 checksum
How to use checksums
4bbb880133a359bf5f358fc1cef7e517af2e98aa64210a82821f040ca8c3d234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for hylightpy 0.0.23

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page