petitRADTRANS.opacities#

Submodules#

Classes#

CIAOpacity

Class for collision-induced opacity files.

CloudOpacity

Class for cloud opacity files.

CorrelatedKOpacity

Class for correlated-k opacity files.

LineByLineOpacity

Class for line-by-line opacity files.

Package Contents#

class petitRADTRANS.opacities.CIAOpacity(species_list, natural_abundance: bool = True, charge: int = 0, source: str = 'unknown', spectral_sampling_type: str = 'R', spectral_sampling: int | float = 830, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, species_full_name: str = None, species_base_name: str = None, species_isotopologue_name: str = None, full_extension: str = None, file_name: str = None, sub_path: str = None, absolute_path: str = None)#

Bases: Opacity

Class for collision-induced opacity files.

Args:
species_list: list of str

The list of species contributing to the opacity.

natural_abundance: bool, optional

If True, the species is considered following the Earth’s isotopic ratios. Default is True.

charge: int, optional

The charge of the species (for single-species opacities only). A value of 0 is used for neutral species. Default is 0.

source: str, optional

The source (i.e., where or how the opacity were obtained) of the opacity. Default is “unknown”.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 830. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

Example:

To indicate a spectral sampling with a constant resolving power of 1000. >>> spectral_sampling_type=’R’ >>> spectral_sampling=1000

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.1.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 250.

path_input_data: str, optional

Absolute path to petitRadtrans “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans config file.

species_full_name: str, optional

Override the species full name. The species full name is composed of the species isotopic information, the natural abundance flag (if relevant), and the charge.

species_cloud_info: str, optional

Override the species cloud information. The species cloud information is composed of the species matter state, and of its solid structure and structure id (if relevant).

species_base_name: str, optional

Override the species base name. The species base name is the species chemical formula without isotopic information. It may contain cloud information and charge. Examples: “H2O”, “H2O(l)”, “H2O_+(s)_crystalline_000”.

species_isotopologue_name: str, optional

Override the species isotopologue name. The species isotopologue name is the species name with isotopic information. It may contain cloud information and charge. Examples: “1H2-16O”, “H2O-NatAbund(l)”, “1H2-18O_+(s)_crystalline_000”.

extension: str, optional

The opacity file type extension. Default is “unknown”. Use “petitRADTRANS” for files generated with petitRADTRANS.

full_extension: str, optional

Override the opacity file full extension. The opacity file full extension is composed of the opacity file type extension, the opacity file generator software extension, and of the file format extension.

file_name: str, optional

Override the opacity file name. By default, it is generated from the instanciation arguments.

sub_path: str, optional

Override the opacity sub path. By default, it depends on the selected category.

directory: str, optional

Override the opacity directory. By default, it is generated from the species full name and from the other path information.

absolute_path: str, optional

Override the absolute path of the opacity file. By default, it is genrated from the other path information.

_default_category: str = 'cia_opacities'#
_default_extension: str = 'ciatable'#
_default_wavelength_range: tuple[float, float] = (0.1, 250.0)#
_default_resolving_power: float = 831.0#
classmethod find(species: str, category: str = None, path_input_data: str = None, find_all: bool = False, search_online: bool = True) str#

Return the absolute filename of a species opacity. The validity of the given species name is checked.

Automatically infer the species base and isotopologue directories from the species name. Then, try to match the species name with the files in the folder. If only one file is matched, it is returned. If multiple files match, the configured default file is used if it exists. If not, ask the user to configure a default file.

Information given in the species name are decomposed for the match. For example:
  • “H2O.R120” will match e.g. the file “1H2-16O__HITEMP.R120_0.1-250mu.ktable.petitRADTRANS.h5”

  • “H2O__POKAZATEL” will match e.g. the file “1H2-16O__POKAZATEL.R1000_0.1-250mu.ktable.petitRADTRANS.h5”

If no information on the resolution is given, the default resolution for corr.-k or line-by-line is assumed. If no or partial isotopic information is given:

  • for line opacities: the main isotope is assumed

  • for continuum opacities: “NatAbund” (a standard mix of all isotopes) is assumed

Args:
path_input_data:

Path to the input data directory

category:

Input data category

species:

Species to get the opacity filename. The species name must be valid.

find_all:

If True, return all the matched files. If False, raise an error if no file is found, and only one file is returned.

search_online:

If True, search online for the opacity file

Returns:

The absolute opacity filename of the species

classmethod from_species(species: str, spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_line_by_line_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species name and from spectral sampling information.

Args:
species: str

The species name, containing the species isotopic information, the natural abundance flag (if relevant), and the charge.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 0. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 0.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod from_species_fullname(species_fullname: str, path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species full name and from spectral sampling information.

Args:
species_fullname: str

The species full name, containing the species isotopic information. May contain the natural abundance flag if relevant and the charge. Absolute path to petitRadtrans’ “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans’ config file.

category: {‘cia_opacities’, ‘clouds_opacities’, ‘correlated_k_opacities’, ‘line_by_line_opacities’},

optional

The opacity category. Indicates the input_data subpath. Default is ‘unknown’.
  • ‘cia_opacities’: for collision-induced absorptions.

  • ‘clouds_opacities’: for cloud opacities.

  • ‘correlated_k_opacities’: for correlated-k opacities.

  • ‘line_by_line_opacities’: for line-by-line opacities.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod write(file: str, colliding_species: tuple[str, Ellipsis], alphas: numpy.typing.NDArray[numpy.floating], wavenumbers: numpy.typing.NDArray[numpy.floating], pressures: numpy.typing.NDArray[numpy.floating], temperatures: numpy.typing.NDArray[numpy.floating], molar_mass: float = None, doi: str = '', contributor: str = '', description: str = '', date_id: str = None, n_g: int = None, wavelength_range: tuple[float] = None)#
class petitRADTRANS.opacities.CloudOpacity(species_list, natural_abundance: bool = True, charge: int = 0, source: str = 'unknown', spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_cloud_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], matter_state: str = Opacity._solid_matter_state, solid_structure: str = 'crystalline', solid_structure_id: str = '000', path_input_data: str = None, species_full_name: str = None, species_cloud_info: str = None, species_base_name: str = None, species_isotopologue_name: str = None, full_extension: str = None, file_name: str = None, sub_path: str = None, absolute_path: str = None)#

Bases: Opacity

Class for cloud opacity files.

Args:
species_list: list of str

The list of species contributing to the opacity. For single-species opacities, use [species_name]. Examples: [1H2-17O], [N2, CO2]

natural_abundance: bool, optional

If True, the species is considered following the Earth’s isotopic ratios. Default is True.

charge: int, optional

The charge of the species (for single-species opacities only). A value of 0 is used for neutral species. Default is 0.

source: str, optional

The source (i.e., where or how the opacity were obtained) of the opacity. Default is “unknown”.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 39. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

Example:

To indicate a spectral sampling with a constant resolving power of 1000. >>> spectral_sampling_type=’R’ >>> spectral_sampling=1000

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 0.

matter_state: {‘(g)’, ‘(l)’, ‘(s)’}, optional
The species matter state. Default is ‘(g)’.
  • ‘(g)’: gas phase.

  • ‘(l)’: liquid phase.

  • ‘(s)’: solid phase.

solid_structure: {‘amorphous’, ‘crystalline’, ‘structureUnclear’}, optional
If the species is in solid phase, indicate the solid structure of the species. Default is None.
  • ‘amorphous’: the solid has an amorphous internal structure.

  • ‘crystalline’: the solid is in a crystal form.

  • ‘structureUnclear’: internal structure was not provided by the source.

solid_structure_id: str, optional

Solid structure identifier. For crystals, this corresponds to the 3-digits space group. See https://en.wikipedia.org/wiki/List_of_space_groups An unknown space group is indicated as ‘000’.

path_input_data: str, optional

Absolute path to petitRadtrans’ “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans config file.

species_full_name: str, optional

Override the species full name. The species full name is composed of the species isotopic information, the natural abundance flag (if relevant), and the charge.

species_cloud_info: str, optional

Override the species cloud information. The species cloud information is composed of the species matter state, and of its solid structure and structure id (if relevant).

species_base_name: str, optional

Override the species base name. The species base name is the species chemical formula without isotopic information. It may contain cloud information and charge. Examples: “H2O”, “H2O(l)”, “H2O_+(s)_crystalline_000”.

species_isotopologue_name: str, optional

Override the species isotopologue name. The species isotopologue name is the species name with isotopic information. It may contain cloud information and charge. Examples: “1H2-16O”, “H2O-NatAbund(l)”, “1H2-18O_+(s)_crystalline_000”.

extension: str, optional

The opacity file type extension. Default is “unknown”. Use “petitRADTRANS” for files generated with petitRADTRANS.

full_extension: str, optional

Override the opacity file full extension. The opacity file full extension is composed of the opacity file type extension, the opacity file generator software extension, and of the file format extension.

file_name: str, optional

Override the opacity file name. By default, it is generated from the instanciation arguments.

sub_path: str, optional

Override the opacity sub path. By default, it depends on the selected category.

directory: str, optional

Override the opacity directory. By default, it is generated from the species full name and from the other path information.

absolute_path: str, optional

Override the absolute path of the opacity file. By default, it is genrated from the other path information.

_default_category: str = 'clouds_opacities'#
_default_extension: str = 'cotable'#
_default_resolving_power: float = 39.0#
_default_wavelength_range: tuple[float, float] = (0.1, 250.0)#
_default_file_names: petitRADTRANS.utils.LockedDict#
classmethod find(species: str, category: str = None, path_input_data: str = None, find_all: bool = False, search_online: bool = True) str#

Return the absolute filename of a species opacity. The validity of the given species name is checked.

Automatically infer the species base and isotopologue directories from the species name. Then, try to match the species name with the files in the folder. If only one file is matched, it is returned. If multiple files match, the configured default file is used if it exists. If not, ask the user to configure a default file.

Information given in the species name are decomposed for the match. For example:
  • “H2O.R120” will match e.g. the file “1H2-16O__HITEMP.R120_0.1-250mu.ktable.petitRADTRANS.h5”

  • “H2O__POKAZATEL” will match e.g. the file “1H2-16O__POKAZATEL.R1000_0.1-250mu.ktable.petitRADTRANS.h5”

If no information on the resolution is given, the default resolution for corr.-k or line-by-line is assumed. If no or partial isotopic information is given:

  • for line opacities: the main isotope is assumed

  • for continuum opacities: “NatAbund” (a standard mix of all isotopes) is assumed

Args:
path_input_data:

Path to the input data directory

category:

Input data category

species:

Species to get the opacity filename. The species name must be valid.

find_all:

If True, return all the matched files. If False, raise an error if no file is found, and only one file is returned.

search_online:

If True, search online for the opacity file

Returns:

The absolute opacity filename of the species

classmethod from_species(species: str, spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_cloud_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species name and from spectral sampling information.

Args:
species: str

The species name, containing the species isotopic information, the natural abundance flag (if relevant), and the charge.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 0. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 0.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod from_species_fullname(species_fullname: str, path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species full name and from spectral sampling information.

Args:
species_fullname: str

The species full name, containing the species isotopic information. May contain the natural abundance flag if relevant and the charge. Absolute path to petitRadtrans’ “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans’ config file.

category: {‘cia_opacities’, ‘clouds_opacities’, ‘correlated_k_opacities’, ‘line_by_line_opacities’},

optional

The opacity category. Indicates the input_data subpath. Default is ‘unknown’.
  • ‘cia_opacities’: for collision-induced absorptions.

  • ‘clouds_opacities’: for cloud opacities.

  • ‘correlated_k_opacities’: for correlated-k opacities.

  • ‘line_by_line_opacities’: for line-by-line opacities.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod get_aliases(name: str) str#
classmethod write(file: str, species_name: str, absorption_opacities: numpy.typing.NDArray[numpy.floating], scattering_opacities: numpy.typing.NDArray[numpy.floating], asymmetry_parameters: numpy.typing.NDArray[numpy.floating], particle_densities: numpy.typing.NDArray[numpy.floating], particle_radius_bin_centers: numpy.typing.NDArray[numpy.floating], particle_radius_bin_edges: numpy.typing.NDArray[numpy.floating], wavenumbers: numpy.typing.NDArray[numpy.floating], doi: str = '', contributor: str = '', description: str = '', date_id: str = None, wavelength_range: tuple[float] = None)#
class petitRADTRANS.opacities.CorrelatedKOpacity(species_list, natural_abundance: bool = False, charge: int = 0, source: str = 'unknown', spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_correlated_k_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, species_full_name: str = None, species_base_name: str = None, species_isotopologue_name: str = None, full_extension: str = None, file_name: str = None, sub_path: str = None, absolute_path: str = None)#

Bases: Opacity

Class for correlated-k opacity files.

Args:
species_list: list of str

The list of species contributing to the opacity. For single-species opacities, use [species_name]. Examples: [1H2-17O], [N2, CO2]

natural_abundance: bool, optional

If True, the species is considered following the Earth’s isotopic ratios. Default is False.

charge: int, optional

The charge of the species (for single-species opacities only). A value of 0 is used for neutral species. Default is 0.

source: str, optional

The source (i.e., where or how the opacity were obtained) of the opacity. Default is “unknown”.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 1000. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

Example:

To indicate a spectral sampling with a constant resolving power of 1000. >>> spectral_sampling_type=’R’ >>> spectral_sampling=1000

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.1.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 250.

species_full_name: str, optional

Override the species full name. The species full name is composed of the species isotopic information, the natural abundance flag (if relevant), and the charge.

species_cloud_info: str, optional

Override the species cloud information. The species cloud information is composed of the species matter state, and of its solid structure and structure id (if relevant).

species_base_name: str, optional

Override the species base name. The species base name is the species chemical formula without isotopic information. It may contain cloud information and charge. Examples: “H2O”, “H2O(l)”, “H2O_+(s)_crystalline_000”.

species_isotopologue_name: str, optional

Override the species isotopologue name. The species isotopologue name is the species name with isotopic information. It may contain cloud information and charge. Examples: “1H2-16O”, “H2O-NatAbund(l)”, “1H2-18O_+(s)_crystalline_000”.

extension: str, optional

The opacity file type extension. Default is “unknown”. Use “petitRADTRANS” for files generated with petitRADTRANS.

full_extension: str, optional

Override the opacity file full extension. The opacity file full extension is composed of the opacity file type extension, the opacity file generator software extension, and of the file format extension.

file_name: str, optional

Override the opacity file name. By default, it is generated from the instanciation arguments.

sub_path: str, optional

Override the opacity sub path. By default, it depends on the selected category.

directory: str, optional

Override the opacity directory. By default, it is generated from the species full name and from the other path information.

absolute_path: str, optional

Override the absolute path of the opacity file. By default, it is genrated from the other path information.

_default_category: str = 'correlated_k_opacities'#
_default_extension: str = 'ktable'#
_default_rebinning_wavelength_range: tuple[float, float] = (0.1, 251.0)#
_default_resolving_power: int = 1000#
_default_wavelength_range: tuple[float, float] = (0.1, 250.0)#
classmethod _get_default_rebinning_wavenumber_grid(resolving_power: float) numpy.typing.NDArray[numpy.floating]#

Return the default rebinning wavenumber grid, an equally log-spaced grid from 0.1 to 250 microns.

Args:
resolving_power: float

The resolving power of the grid.

Returns:
grid: numpy.NDArray

The default grid at the given resolving power.

classmethod exo_k_multiple_rebin_from_species(species: list[str], resolving_power: float, rewrite: bool = False)#

This function uses exo-k to bin the c-k table of a multiple species to a desired (lower) spectral resolution.

Args:
speciesstring

The name of the species

resolving_powerint

The desired spectral resolving power.

rewritebool

If True, rewrite the rebinned files even if they already exist.

classmethod exo_k_multiple_rebin(input_files: list[str], resolving_power: float, rewrite=False)#
classmethod exo_k_rebin(input_file: str, resolving_power: float, wavenumber_grid: numpy.typing.NDArray[numpy.floating] = None, rewrite: bool = False) int#
classmethod from_species(species: str, spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_correlated_k_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species name and from spectral sampling information.

Args:
species: str

The species name, containing the species isotopic information, the natural abundance flag (if relevant), and the charge.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 0. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 0.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod from_species_fullname(species_fullname: str, path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species full name and from spectral sampling information.

Args:
species_fullname: str

The species full name, containing the species isotopic information. May contain the natural abundance flag if relevant and the charge. Absolute path to petitRadtrans’ “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans’ config file.

category: {‘cia_opacities’, ‘clouds_opacities’, ‘correlated_k_opacities’, ‘line_by_line_opacities’},

optional

The opacity category. Indicates the input_data subpath. Default is ‘unknown’.
  • ‘cia_opacities’: for collision-induced absorptions.

  • ‘clouds_opacities’: for cloud opacities.

  • ‘correlated_k_opacities’: for correlated-k opacities.

  • ‘line_by_line_opacities’: for line-by-line opacities.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod get_default_resolving_power() int#

Return the Opacity object species default resolving power.

classmethod write(file: str, species_name: str, k_coefficients: numpy.typing.NDArray[numpy.floating], wavenumber_bin_centers: numpy.typing.NDArray[numpy.floating], wavenumber_bin_edges: numpy.typing.NDArray[numpy.floating], pressures: numpy.typing.NDArray[numpy.floating], temperatures: numpy.typing.NDArray[numpy.floating], temperature_grid_type: str, g_weights: numpy.typing.NDArray[numpy.floating], g_samples: numpy.typing.NDArray[numpy.floating], molar_mass: float = None, doi: str = '', contributor: str = '', description: str = '', date_id: str = None, wavelength_range: tuple[float] = None)#
class petitRADTRANS.opacities.LineByLineOpacity(species_list, natural_abundance: bool = False, charge: int = 0, source: str = 'unknown', spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_line_by_line_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, species_full_name: str = None, species_base_name: str = None, species_isotopologue_name: str = None, full_extension: str = None, file_name: str = None, sub_path: str = None, absolute_path: str = None)#

Bases: Opacity

Class for line-by-line opacity files.

Args:
species_list: list of str

The list of species contributing to the opacity. For single-species opacities, use [species_name]. Examples: [1H2-17O], [N2, CO2]

natural_abundance: bool, optional

If True, the species is considered following the Earth’s isotopic ratios. Default is False.

charge: int, optional

The charge of the species (for single-species opacities only). A value of 0 is used for neutral species. Default is 0.

source: str, optional

The source (i.e., where or how the opacity were obtained) of the opacity. Default is “unknown”.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 1e6. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

Example:

To indicate a spectral sampling with a constant resolving power of 1000. >>> spectral_sampling_type=’R’ >>> spectral_sampling=1000

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.1.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 250.

species_full_name: str, optional

Override the species full name. The species full name is composed of the species isotopic information, the natural abundance flag (if relevant), and the charge.

species_cloud_info: str, optional

Override the species cloud information. The species cloud information is composed of the species matter state, and of its solid structure and structure id (if relevant).

species_base_name: str, optional

Override the species base name. The species base name is the species chemical formula without isotopic information. It may contain cloud information and charge. Examples: “H2O”, “H2O(l)”, “H2O_+(s)_crystalline_000”.

species_isotopologue_name: str, optional

Override the species isotopologue name. The species isotopologue name is the species name with isotopic information. It may contain cloud information and charge. Examples: “1H2-16O”, “H2O-NatAbund(l)”, “1H2-18O_+(s)_crystalline_000”.

extension: str, optional

The opacity file type extension. Default is “unknown”. Use “petitRADTRANS” for files generated with petitRADTRANS.

full_extension: str, optional

Override the opacity file full extension. The opacity file full extension is composed of the opacity file type extension, the opacity file generator software extension, and of the file format extension.

file_name: str, optional

Override the opacity file name. By default, it is generated from the instanciation arguments.

sub_path: str, optional

Override the opacity sub path. By default, it depends on the selected category.

directory: str, optional

Override the opacity directory. By default, it is generated from the species full name and from the other path information.

absolute_path: str, optional

Override the absolute path of the opacity file. By default, it is genrated from the other path information.

_default_category: str = 'line_by_line_opacities'#
_default_extension: str = 'xsec'#
_default_resolving_power: float = 1000000.0#
_default_wavelength_range: tuple[float, float] = (0.3, 28)#
classmethod from_species(species: str, spectral_sampling_type: str = 'R', spectral_sampling: int | float = Opacity._default_line_by_line_resolving_power, wavelength_min: float = _default_wavelength_range[0], wavelength_max: float = _default_wavelength_range[1], path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species name and from spectral sampling information.

Args:
species: str

The species name, containing the species isotopic information, the natural abundance flag (if relevant), and the charge.

spectral_sampling_type: {‘DeltaWavelength’, ‘DeltaWavenumber’, ‘R’}, optional
The opacity spectral sampling type. Default is ‘R’.
  • ‘DeltaWavelength’: sampling with a constant wavelength step.

  • ‘DeltaWavenumber’: sampling with a constant wavenumber step.

  • ‘R’: sampling with a constant resolving power (wavelength / wavelength step).

spectral_sampling: int or float, optional
The opacity spectral sampling value. Default is 0. Units depends on spectral_sampling_type:
  • ‘DeltaWavelength’: um

  • ‘DeltaWavenumber’: cm-1

  • ‘R’: no units

wavelength_min: float, optional

(um) Lower wavelength bounds of the opacity data. Default is 0.

wavelength_max: float, optional

(um) Upper wavelength bounds of the opacity data. Default is 0.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod from_species_fullname(species_fullname: str, path_input_data: str = None, category: str = _default_category)#

Instantiate an Opacity object from a species full name and from spectral sampling information.

Args:
species_fullname: str

The species full name, containing the species isotopic information. May contain the natural abundance flag if relevant and the charge. Absolute path to petitRadtrans’ “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRadtrans’ config file.

category: {‘cia_opacities’, ‘clouds_opacities’, ‘correlated_k_opacities’, ‘line_by_line_opacities’},

optional

The opacity category. Indicates the input_data subpath. Default is ‘unknown’.
  • ‘cia_opacities’: for collision-induced absorptions.

  • ‘clouds_opacities’: for cloud opacities.

  • ‘correlated_k_opacities’: for correlated-k opacities.

  • ‘line_by_line_opacities’: for line-by-line opacities.

path_input_data: str, optional

Absolute path to petitRADTRANS “input_data” directory, where the opacity files are stored. By default, use the path provided in petitRADTRANS config file.

Returns:
new_opacity: Opacity

A new instance of an Opacity object.

classmethod write(file: str, species_name: str, cross_sections: numpy.typing.NDArray[numpy.floating], wavenumber_bin_edges: numpy.typing.NDArray[numpy.floating], pressures: numpy.typing.NDArray[numpy.floating], temperatures: numpy.typing.NDArray[numpy.floating], temperature_grid_type: str, molar_mass: float = None, doi: str = '', contributor: str = '', description: str = '', date_id: str = None, n_g: int = None, wavelength_range: tuple[float] = None)#