pyspectools.astro package¶
Submodules¶
pyspectools.astro.analysis module¶
-
pyspectools.astro.analysis.
calculate_L
(W, frequency, S)[source]¶ Calculate L, which is subsequently used to perform rotational temperature analysis.
- Parameters
- float (S) – Integrated flux of a line
- float – Frequency of a transition in MHz
- float – Intrinsic linestrength of the transition
- Returns
- Return type
L - float
-
pyspectools.astro.analysis.
lineprofile_analysis
(fit, I, Q, T, E_lower)[source]¶ Low-level function to provide some analysis based on a fitted line profile and some theoretical parameters.
Basically a collection of various parameters that are of interest to astronomy.
fit - lmfit ModelResult object I - log10(theoretical intensity) Q - rotational partition function T - temperature in K E - lower state energy in K
data_dict - dict results of lineprofile analysis
-
pyspectools.astro.analysis.
rotational_temperature_analysis
(L, E_upper)[source]¶ Function that will perform a rotational temperature analysis. This will perform a least-squares fit of log(L), which is related to the theoretical line strength and integrated flux, and the upper state energy for the same transition.
- Parameters
- 1D array (E_upper) – Value L related to the line and theoretical line strength
- 1D array – The upper state energy in wavenumbers.
- Returns
Result of the least-squares fit
- Return type
ModelResult - object
-
pyspectools.astro.analysis.
simulate_catalog
(catalogpath, N, Q, T, doppler=10.0)[source]¶ Function for simulating what the expected flux would be for a given molecule and its catalog file from SPCAT. Returns a spectrum of Gaussian line shapes, predicted by either a supplied Doppler width or session-wide value (self.doppler), and the parameters required to calculate the flux in Jy.
- Parameters
catalogpath – path to the SPCAT catalog file
N – column density in cm^-2
Q – rotational partition function
T – temperature in Kelvin
doppler – Doppler width in km/s
- Returns
simulated_df; pandas dataframe with frequency/intensity
pyspectools.astro.conversions module¶
-
pyspectools.astro.conversions.
N2flux
(N, S, v, Q, E, T)[source]¶ Calculate the expected integrated flux based on column density. This can be used to simulate a spectrum purely from theoretical terms.
N - column density in cm^-2 S - intrinsic line strength; Su^2 v - transition frequency in MHz Q - rotational partition function E - state energy T - temperature
flux - the integrated flux in Jy
-
pyspectools.astro.conversions.
flux2N
(W, Q, E, T, S, v)[source]¶ Calculate the column density (1/cm^2) based on theoretical intensities for rotational transitions, and the observed flux per beam (Jy/beam)
W - integrated area of line profile; Jy Q - rotational partition function at given temperature E - upper state energy; Kelvin T - temperature; Kelvin S - formally Su^2; intrinsic linestrength v - transition frequency in MHz
N - column density in 1/cm^2
pyspectools.astro.radiative module¶
radiative.py
Routines for calculating quantities useful for radiative transfer, such as Einstein coefficients
-
pyspectools.astro.radiative.
I2S
(I, Q, frequency, E_lower, T=300.0)[source]¶ Function for converting intensity (in nm^2 MHz) to the more standard intrinsic linestrength, S_ij mu^2.
- Parameters
- float (T) – The log of the transition intensity, typically given in catalog files
- float – Partition function at specified temperature T
- float – Frequency of the transition in MHz
- float – Energy of the lower state in wavenumbers
- float – Temperature in Kelvin
- Returns
Value of the intrinsic linestrength
- Return type
siju - float
-
pyspectools.astro.radiative.
approx_Q_linear
(B, T)[source]¶ Approximate rotational partition function for a linear molecule.
- Parameters
- float (T) – Rotational constant in MHz.
- float – Temperature in Kelvin.
- Returns
Rotational partition function at temperature T.
- Return type
Q - float
-
pyspectools.astro.radiative.
approx_Q_top
(A, B, T, sigma=1, C=None)[source]¶ Approximate expression for the (a)symmetric top partition function. The expression is adapted from Gordy and Cook, p.g. 57 equation 3.68. By default, the prolate top is used if the C constant is not specified, where B = C. Oblate case can also be specified if A = C.
- Parameters
- float (T) – Rotational constant for the A principal axis, in MHz.
- float – Rotational constant for the B principal axis, in MHz.
- float – Temperature in Kelvin
- int (sigma) – Rotational level degeneracy; i.e. spin statistics
- float, optional (C) – Rotational constant for the C principal axis, in MHz. Defaults to None, which will reduce to the prolate top case.
- Returns
Partition function for the molecule at temperature T
- Return type
Q - float
-
pyspectools.astro.radiative.
boltzmann_factor
(E, T)[source]¶ Calculate the Boltzmann weighting for a given state and temperature.
- Parameters
- float (T) – State energy in wavenumbers
- float – Temperature in Kelvin
- Returns
Unitless Boltzmann factor for the state
- Return type
boltzmann_factor - float
-
pyspectools.astro.radiative.
calc_E_upper
(frequency, E_lower)[source]¶ Calculate the upper state energy, for a given lower state energy and the frequency of the transition.
- Parameters
- float (E_lower) – Frequency of the transition in MHz
- float – Lower state energy in wavenumbers
- Returns
Upper state energy in wavenumbers
- Return type
E_upper - float