Skip to main content

A set of tools for loading and visualizing the NIST ASD.

Project description

About ASDtools

This package relies heavily on astroquery.nist's querying capabilities for loading spectral data for a given element over a range of wavelengths. The main advantage of ASDtools is its ability to format astroquery's default output into a formatted DataFrame. Additionally, I have made a handful of helpful tools for visualizing several pieces of the NIST ASD. This ASDtools's primary goal is to help users understand and visualize standard conventions in atomic spectroscopy.

NOTE: As of writing (March 31, 2025), reports have surfaced that the NIST ASD is expected to go offline. If the database is unavailable for querying, compressed files containing the entire database have been saved and uploaded to this GitHub repository. I will modify the behavior of ASDtools to use this data as a backup.

Installation

ASDtools's dependencies are...

'astropy',
'astroquery',
'Fraction',
'ipython!=8.17.1,<9.0.0,>=8.13.0',
'matplotlib',
'numpy<2',
'pandas',
'periodictable',
'roman',
'sympy',
'tqdm'

To install ASDtools, just run a pip installation...

$ python pip install ASDtools

Basic Usage (How to Query)

Since ASDtools uses astroquery.nist to pull its data, it takes the same arguments. However, ASDtools uses a class-based data structure to store and modify NIST ASD data. You must create a new "NIST_lines" instance to initialize a query. This initialization takes the same arguments as astroquery.nist...

>>> import ASDtools as asdt
>>> lines = asdt.NIST_lines(["He I", "He II"], lower_wavelength=3000*u.AA, upper_wavelength=9000*u.AA)
>>> lines.df

In contrast to the raw table produced by astroquery.nist, the output from the above call...

  • Has column names w/ explicitly stated units (for ease of use)
  • Numeric columns (i.e., "Observed (nm)," "Aki," etc.) now have NaN values instead of empty strings
  • Some columns w/ multiple pieces of data have been split up (i.e., "Ei (eV)" and "Ek (eV)")
  • Empty entries in the "Transition Type" column now have an explicit type
  • Numeric columns no longer contain non-numeric characters (see description of "flags")

These changes reflect some of the struggles I faced when working with data from NIST's ASD. I hope to improve the readability and usefulness of ASDtools in future iterations.

What Else Can ASDtools do?

1. Flag Identification & Explanation

One advantage of ASDtools is its ability to identify, filter out, and explain non-numeric "flags" found throughout the NIST ASD. These allow the user to filter out lines based on certain undesired characteristics (i.e., forbidden, blended, etc.). You can also use an in-built class function to explain the number of flags found along with their meaning...

>>> lines = asdt.NIST_lines("O I", keep_flag_columns=True)
>>> lines.explain_column_flags("Rel.")

   Flag: *
 Counts: 28
Meaning: Intensity is shared by several lines (typically, for multiply classified lines).

   Flag: bl
 Counts: 3
Meaning: Blended with another line that may affect the wavelength and intensity.

2. Produce Ground-State Electronic Configurations

To help understand the way NIST's ASD formats electronic configurations, I made a handful of functions that explain what electronic configurations are. One tool automatically draws an Aufbau diagram to visually-demonstrate the filling order of subshells...

>>> asdt.draw_aufbau_diagram(N_max=5)

A separate tool generates the filling order according to Aufbau's principle...

>>> asdt.find_filling_order(max_level=5, joined=True)

'1s.2s.2p.3s.3p.4s.3d.4p.5s'

And another tool automatically calculates the ground-state electronic configuration for any element/ionization pair. This function can return an abbreviated electronic configuration, and can use two separate ordering schemas...

>>> asdt.find_electronic_config("O I", abbreviate=True, sortby="fill order")

'[He]2s2.2p4'

NOTE: The current version of ASDtools does not take into account a handful of notable exceptions to the filling order outlined above. I plan on fixing this in a future iteration.

3. Calculate All Possible Term Symbols

The NIST ASD provides a handful of term symbols, each with a slightly different meaning. For many elements, a single term symbol is given to represent the entire electronic configuration. In other cases (particularly for heavier elements), term symbols are provided for smaller chunks of an electronic configuration. The following function calculated all possible term symbols for a given element/ionization pair...

>>> config = asdt.find_electronic_config("Ni I")
>>> asdt.generate_term_symbols(config)

These term symbols are displayed using LaTeX formatting. These match NIST's ASD for lines that assume an LS-coupling scheme. A term symbol function for other schemes is not available yet. The methodology used to calculate term symbols follows this Wikipedia article pretty closely.

4. Draw Grotrian Diagrams

Finally, ASDtools can draw a Grotrian diagram (a.k.a., energy level diagram) for a given element. If multiple multiplicities are found, they are separated from one another on the same plot. The current format reflects the style of Grotrian diagrams I have seen in classes up until this point, but I hope to include more options in future iterations.

>>> asdt.draw_grotrian_diagram("H I")

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

asdtools-0.2.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

ASDtools-0.2.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asdtools-0.2.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for asdtools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b0659167b1e8d949ec5eba972a4853f8dbc9039be40c0fd065b480a106fa621b
MD5 38a735d0aa5693b59ad7a5c347b5ebf3
BLAKE2b-256 486baf8f8b998b8d505ceb86bdb38ddbf4d6d0981befe61b8cd5352019700679

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ASDtools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ASDtools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b7fd6756619e2f8a501d99876e7fdbd7b226c65776b4677fea4348ba4a5786b
MD5 c96589be5a3a8e8071047b9d11214be0
BLAKE2b-256 319a62e6240f5ceef8ff3aa0b01b64015e0b5ba9285ec25a0937fd1dc2df3a80

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