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)

image info

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")

image info

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.1.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.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asdtools-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 cf1e29d7570dca414fe33ccf45ff3cfb03bfe3692457456307f1ba3f30552ab7
MD5 144e709f43176bc4f90af3a58af37155
BLAKE2b-256 889fca28635d80b876a5940929b6d526e4ff441703db640f8beeae4ee96df93f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ASDtools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aecabe9b3e9e55e47c81a866fa602a7e168049b2d5f2251b82b013f20a7a4855
MD5 3e42e59bb17d8613eec7e8dd569b7aaf
BLAKE2b-256 4530bfa1297271332ce69d4d25564288896e158257979de8cb95df57a7482785

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