Molecule: Spectral line transition data for various molecules#

For fitting of excitation diagrams, transition data (energy levels, wavelengths, temperatures, etc.) are manage via subclasses of the BaseMolecule class. Currently, \(H_2, ^{12}CO, ^{13}CO, {\rm and}~ CH^{+}\) are supported.


class pdrtpy.molecule.BaseMolecule(name: str, path: Path | str, opr: float = 1, opr_can_vary: bool = False, **kwargs)[source]#

Bases: object

Attributes:
canonical_opr

The canonical ortho-to-para ratio of the molecule.

line_ids

The identifiers (names) of the spectral line transitions in the data.

line_wavelengths

The wavelengths of the spectral line transitions in the data.

name

The descriptive name of the molecule

opr_can_vary

Does the ortho-to-para ratio vary in this molecule under different physical conditions?

transition_data

The table fo transition data, containing columns such as transition energy, statistical weight, Einstein A coefficient, wavelength etc.

Methods

partition_function(temperature)

Calculate the partition function given an excitation temperature(s)

property canonical_opr: float#

The canonical ortho-to-para ratio of the molecule. Only used for molecules containing hydrogen (where canonical OPR=3).

Returns:
float

The ortho-to-para ratio

property line_ids: list#

The identifiers (names) of the spectral line transitions in the data. These should be used to identify your Measurement data for excitation fits.

Returns:
list

The spectral line IDs

property line_wavelengths: Quantity#

The wavelengths of the spectral line transitions in the data. These should be used to identify your Measurement data for excitation fits.

Returns:
Quantity

The spectral line wavelengths

property name#

The descriptive name of the molecule

Returns:
str

Descriptive name of the moelcule

property opr_can_vary#

Does the ortho-to-para ratio vary in this molecule under different physical conditions?

Returns:
bool

True if OPR can vary, False otherwise.

partition_function(temperature: Quantity) ndarray[source]#

Calculate the partition function given an excitation temperature(s)

The default calculation is

\(Q(T) = \sum g_j~e^{-E_j/kT}\)

where \(g_j\) is the statistical weight, \(E_j\) is the transition energy, \(T\) is the excitation temperature, and \(k\) is Boltzmann’s constant.

Sub-classes should override this method for custom (and likely more accurate) partition function calculation.

Parameters:
temperatureastropy.units.quantity.Quantity

The excitation temperature(s)

Returns:
ndarray

The partition function evaluated at the given excitation temperatures

property transition_data: Table#

The table fo transition data, containing columns such as transition energy, statistical weight, Einstein A coefficient, wavelength etc.

Returns:
Table

The table of transition data,

class pdrtpy.molecule.C13O(name='^{13}CO', path='13co_transition.tab', opr=1.0, opr_can_vary=False)[source]#

Bases: BaseMolecule

Attributes:
canonical_opr

The canonical ortho-to-para ratio of the molecule.

line_ids

The identifiers (names) of the spectral line transitions in the data.

line_wavelengths

The wavelengths of the spectral line transitions in the data.

name

The descriptive name of the molecule

opr_can_vary

Does the ortho-to-para ratio vary in this molecule under different physical conditions?

transition_data

The table fo transition data, containing columns such as transition energy, statistical weight, Einstein A coefficient, wavelength etc.

Methods

partition_function(temperature)

Calculate the partition function for 13CO at the given temperature usin the HITRAN partition function.

partition_function(temperature: Quantity) ndarray[source]#

Calculate the partition function for 13CO at the given temperature usin the HITRAN partition function. https://hitran.org/data/Q/q27.txt The HITRAN function is evaluated at 1K intervals; this function performas a linear interpolation on those data.

Parameters:
temperature :class:`astropy.units.quantity.Quantity`

The excitation temperature(s) at which to evaluate the partition function

Returns:
Q: ndarray

The partition function evaluated at the given excitation temperature(s)

class pdrtpy.molecule.CO(name='^{12}CO', path='12co_transition.tab.gz', opr=1.0, opr_can_vary=False)[source]#

Bases: BaseMolecule

Attributes:
canonical_opr

The canonical ortho-to-para ratio of the molecule.

line_ids

The identifiers (names) of the spectral line transitions in the data.

line_wavelengths

The wavelengths of the spectral line transitions in the data.

name

The descriptive name of the molecule

opr_can_vary

Does the ortho-to-para ratio vary in this molecule under different physical conditions?

transition_data

The table fo transition data, containing columns such as transition energy, statistical weight, Einstein A coefficient, wavelength etc.

Methods

partition_function(temperature)

Calculate the partition function for CO at the given temperature usin the HITRAN partition function.

partition_function(temperature: Quantity) ndarray[source]#

Calculate the partition function for CO at the given temperature usin the HITRAN partition function. https://hitran.org/data/Q/q26.txt The HITRAN function is evaluated at 1K intervals; this function performas a linear interpolation on those data.

Parameters:
temperature :class:`astropy.units.quantity.Quantity`

The excitation temperature(s) at which to evaluate the partition function

Returns:
Q: ndarray

The partition function evaluated at the given excitation temperature(s)

class pdrtpy.molecule.H2(name='H_2', path='RoueffEtAl.tab', opr=3.0, opr_can_vary=True)[source]#

Bases: BaseMolecule

Attributes:
canonical_opr

The canonical ortho-to-para ratio of the molecule.

line_ids

The identifiers (names) of the spectral line transitions in the data.

line_wavelengths

The wavelengths of the spectral line transitions in the data.

name

The descriptive name of the molecule

opr_can_vary

Does the ortho-to-para ratio vary in this molecule under different physical conditions?

transition_data

The table fo transition data, containing columns such as transition energy, statistical weight, Einstein A coefficient, wavelength etc.

Methods

partition_function(temperature)

Calculate the \(H_2\) partition function given an excitation temperature(s).

partition_function(temperature: Quantity) ndarray[source]#

Calculate the \(H_2\) partition function given an excitation temperature(s). This function uses the expression from Herbst et al 1996 http://articles.adsabs.harvard.edu/pdf/1996AJ….111.2403H

\(Q(T) = 0.247 ~T / [1 - exp(6000 / T)]\)

where \(T\) is the excitation temperature.

Parameters:
temperature :class:`astropy.units.quantity.Quantity`

The excitation temperature(s) at which to evaluate the partition function

Returns:
Q: ndarray

The partition function evaluated at the given excitation temperature(s)