pyROX#
Submodules#
Classes#
Base class for line-by-line cross-sections. |
|
Class for handling line-by-line cross-sections from ExoMol data. |
|
Class for handling line-by-line cross-sections from HITRAN data. |
|
Class for handling line-by-line cross-sections from Kurucz data. |
|
Base class for Collision-Induced Absorption (CIA) data handling. |
|
Class for handling CIA data from HITRAN. |
|
Class for handling Collision-Induced Absorption (CIA) data from Borysow. |
Package Contents#
- class pyROX.LineByLine(config, **kwargs)#
Bases:
pyROX.CrossSections,LineProfileHelperBase class for line-by-line cross-sections.
- _read_configuration_parameters(config)#
Reads parameters specific to line-by-line calculations from the configuration.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_equation_of_state()#
Reads the equation of state for the gas mixture.
- _read_mass()#
Reads the mass of the species from the configuration or database.
- _read_pressure_broadening_info()#
Reads the pressure broadening parameters from the configuration.
- _read_partition_function()#
Reads the partition function from the configuration file.
- iterate_over_PT_grid(function, progress_bar=True, **kwargs)#
Iterates over the pressure-temperature grid and apply a function.
- Parameters:
function (callable) – Function to apply at each grid point.
progress_bar (bool) – Whether to show a progress bar.
**kwargs – Additional arguments for the function.
- calculate_cross_sections(P, T, nu_0, S_0, E_low, A, delta=None, **kwargs)#
Computes the cross-sections for given parameters.
- Parameters:
P (float) – Pressure in Pa.
T (float) – Temperature in Kelvin.
nu_0 (array) – Transition frequencies in s^-1.
S_0 (array) – Line strengths at reference temperature.
E_low (array) – Lower state energies in Joules.
A (array) – Einstein A-coefficients in s^-1.
delta (array, optional) – Pressure shift coefficients.
**kwargs – Additional arguments.
- calculate_temporary_outputs(overwrite=False, save_in_one_file=False, files_range=None, **kwargs)#
Calculates temporary outputs for cross-sections.
- Parameters:
overwrite (bool) – Whether to overwrite existing files.
save_in_one_file (bool) – Whether to save all outputs in one file.
files_range (tuple, optional) – Range of files to process.
**kwargs – Additional arguments.
- save_combined_outputs(**kwargs)#
Saves the merged outputs to a file.
- Parameters:
**kwargs – Additional arguments for saving.
- plot_combined_outputs(fig=None, ax=None, return_fig_ax=False, cmaps=['coolwarm', 'viridis'], xscale='log', yscale='log', xlim=None, ylim=None, ls='-', lw=0.7, **kwargs)#
Plots the merged outputs.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object for plotting.
ax (matplotlib.axes.Axes) – Axes object for plotting.
return_fig_ax (bool) – Whether to return the figure and axes.
cmaps (list) – List of colormaps for plotting.
xscale (str) – Scale for the x-axis.
yscale (str) – Scale for the y-axis.
xlim (tuple, optional) – Limits for the x-axis.
ylim (tuple, optional) – Limits for the y-axis.
ls (str) – Line style for plotting.
**kwargs – Additional arguments for plotting.
- convert_to_pRT3(contributor=None, **kwargs)#
Converts the cross-sections to petitRADTRANS v3.0 format.
- Parameters:
contributor (str) – Name of the contributor for these data.
**kwargs – Additional arguments for conversion.
- Raises:
ValueError – If required metadata is missing in the configuration.
KeyError – If required keys are missing in the metadata.
- class pyROX.LBL_ExoMol(config, **kwargs)#
Bases:
pyROX.line_by_line.lbl.LineByLineClass for handling line-by-line cross-sections from ExoMol data.
- download_data(config)#
Downloads data from ExoMol.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_configuration_parameters(config)#
Reads parameters specific to ExoMol calculations from the configuration.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_broadening_per_transition(J_l, J_u, chunk_size=100000)#
Reads broadening parameters for each transition.
- Parameters:
J_l (array) – Lower state rotational quantum numbers.
J_u (array) – Upper state rotational quantum numbers.
chunk_size (int) – Size of chunks to process at a time.
- _read_states()#
Reads the states from the states file.
- process_transitions(input_file, **kwargs)#
Reads transitions from the input file and compute cross-sections.
- Parameters:
input_file (str) – Path to the input file.
**kwargs – Additional arguments.
- class pyROX.LBL_HITRAN(config, **kwargs)#
Bases:
pyROX.line_by_line.lbl.LineByLineClass for handling line-by-line cross-sections from HITRAN data.
- download_data(config)#
Downloads data from HITRAN.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_configuration_parameters(config)#
Reads parameters specific to HITRAN calculations from the configuration.
- Parameters:
config (object) – Configuration object containing parameters.
- process_transitions(input_file, **kwargs)#
Reads transitions from the input file and computes cross-sections.
- Parameters:
input_file (str) – Path to the input file.
**kwargs – Additional arguments.
- class pyROX.LBL_Kurucz(config, **kwargs)#
Bases:
pyROX.line_by_line.lbl.LineByLineClass for handling line-by-line cross-sections from Kurucz data.
- parent_dir#
- atoms_info#
- download_data(config)#
Download data from Kurucz.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_configuration_parameters(config)#
Read parameters specific to Kurucz calculations from the configuration.
- Parameters:
config (object) – Configuration object containing parameters.
- _read_impact_info(impact_info={})#
Read impact width/shift information from the configuration.
- Parameters:
impact_info (dict) – Dictionary containing impact information.
- Returns:
Updated impact information.
- Return type:
dict
- _read_partition_function(T_grid=np.arange(1, 7001 + 1e-06, 1))#
Read the partition function from the configuration file.
- Parameters:
T_grid (array) – Temperature grid for partition function calculation.
- _read_kurucz_transitions(input_file)#
Read transitions from a Kurucz input file.
- Parameters:
input_file (str) – Path to the input file.
- Returns:
Arrays of transition parameters (nu_0, E_low, A, g_up, gamma_vdW, gamma_N).
- Return type:
tuple
- abstractmethod _read_vald_transitions(input_file)#
Read transitions from a VALD input file.
- Parameters:
input_file (str) – Path to the input file.
- Raises:
NotImplementedError – If the method is not implemented.
- compute_vdw_broadening(P, T, E_low, nu_0)#
Calculate Van der Waals broadening.
- Parameters:
P (float) – Pressure in Pa.
T (float) – Temperature in Kelvin.
E_low (array) – Lower state energies in Joules.
nu_0 (array) – Transition frequencies in s^-1.
- Returns:
Van der Waals broadening in s^-1.
- Return type:
array
- compute_natural_broadening(A)#
Calculate natural broadening.
- Parameters:
A (float) – Einstein A-coefficient in s^-1.
- Returns:
Natural broadening in s^-1.
- Return type:
float
- pressure_shift(P, T, nu_0, delta=None)#
Apply pressure shift to the transition frequency.
- Parameters:
P (float) – Pressure in Pa.
T (float) – Temperature in Kelvin.
nu_0 (array) – Transition frequencies in s^-1.
delta (float, optional) – Pressure shift coefficient.
- Returns:
Pressure-shifted frequencies.
- Return type:
array
- _apply_impact_Allard_ea_2023(P, T, nu_0, gamma=None)#
Apply impact width/shift (Allard et al. 2023).
- Parameters:
P (float) – Pressure in Pa.
T (float) – Temperature in Kelvin.
nu_0 (array) – Transition frequencies in s^-1.
gamma (array, optional) – Line widths.
- Returns:
Modified transition frequencies or line widths.
- Return type:
array
- process_transitions(input_file, **kwargs)#
Read transitions from the input file and compute cross-sections.
- Parameters:
input_file (str) – Path to the input file.
**kwargs – Additional arguments.
- class pyROX.CIA(config, **kwargs)#
Bases:
pyROX.CrossSectionsBase class for Collision-Induced Absorption (CIA) data handling.
- download_data(config)#
Download CIA data from HITRAN or Borysow.
- Parameters:
config (object) – Configuration object containing URLs and input data directory.
- Raises:
ValueError – If any file fails to download.
- calculate_temporary_outputs(overwrite=False, **kwargs)#
Calculate the CIA coefficients and save temporary outputs.
- Parameters:
overwrite (bool) – Whether to overwrite existing temporary files.
**kwargs – Additional arguments for calculation.
- save_combined_outputs(**kwargs)#
Save the merged CIA outputs to a file.
- Parameters:
**kwargs – Additional arguments for saving.
- plot_combined_outputs(return_fig_ax=False, cmap='coolwarm', xscale='log', yscale='log', xlim=None, ylim=None, **kwargs)#
Plot the merged CIA coefficients.
- Parameters:
return_fig_ax (bool) – Whether to return the figure and axes objects.
cmap (str) – Colormap for the plot.
xscale (str) – Scale for the x-axis (‘linear’ or ‘log’).
yscale (str) – Scale for the y-axis (‘linear’ or ‘log’).
xlim (tuple, optional) – Limits for the x-axis.
ylim (tuple, optional) – Limits for the y-axis.
**kwargs – Additional arguments for plotting.
- convert_to_pRT3(contributor=None, **kwargs)#
Convert the CIA data to petitRADTRANS v3.0 format.
- Parameters:
contributor (str) – Name of the contributor for these data.
**kwargs – Additional arguments for conversion.
- Raises:
ValueError – If required metadata is missing in the configuration.
KeyError – If required keys are missing in the metadata.
- class pyROX.CIA_HITRAN(config, **kwargs)#
Bases:
pyROX.collision_induced_absorption.cia.CIAClass for handling CIA data from HITRAN.
- _read_absorption_coefficients(file)#
Reads absorption coefficients from a HITRAN CIA file.
- Parameters:
file (str) – Path to the HITRAN CIA file.
- Returns:
Temperature grid, absorption coefficients (k), and absorption coefficients (alpha).
- Return type:
tuple
- Raises:
FileNotFoundError – If the specified file does not exist.
- class pyROX.CIA_Borysow(config, **kwargs)#
Bases:
pyROX.collision_induced_absorption.cia.CIAClass for handling Collision-Induced Absorption (CIA) data from Borysow.
- _read_absorption_coefficients(file)#
Reads absorption coefficients from a Borysow CIA file.
- Parameters:
file (str) – Path to the Borysow CIA file.
- Returns:
Temperature grid, absorption coefficients (k), and absorption coefficients (alpha).
- Return type:
tuple
- Raises:
FileNotFoundError – If the specified file does not exist.