petitRADTRANS._input_data_loader#

Functions#

__build_cia_aliases_dict()

__default_file_selection(files, full_path, sub_path)

__get_from_tuple(string, _tuple, _tuple_description)

Base for the naming convention functions.

__get_condensed_matter_state(string[, regex_mode])

Naming convention for condensed matter state. Access names here, change this to change the convention.

__get_natural_abundance_string([separator])

Naming convention for natural abundance. Access names here, change this to change the convention.

__get_spectral_sampling_type(string)

Naming convention for spectral sampling type. Access names here, change this to change the convention.

__get_solid_structure(string)

Naming convention for solid structure. Access names here, change this to change the convention.

__recursive_merge_contiguous_isotopes(isotope_groups, i)

_get_base_cia_names()

_get_base_cloud_names()

_get_base_correlated_k_names()

Only used for file conversion from pRT2 to pRT3.

_get_base_line_by_line_names()

Only used for file conversion from pRT2 to pRT3.

_get_input_file(→ str | list[str])

_get_input_file_from_keeper(full_path[, ...])

_get_spectral_information(filename)

_has_isotope(string)

_join_spectral_information(resolution_filename, ...)

_merge_contiguous_isotopes(species, isotope_separator)

_rebuild_isotope_numbers(species[, mode])

Add or remove isotope numbers from a species.

_split_cloud_info(cloud_info)

_split_species_cloud_info(species)

_split_species_charge(species[, final_charge_format])

_split_species_source(species)

_split_species_spectral_info(species)

check_opacity_name(opacity_name)

Check opacity name, based on the ExoMol format.

get_cia_aliases(→ str)

get_cia_opacity_file_extension()

Return petitRADTRANS CIA opacity files extension.

get_cloud_aliases(→ str)

get_cloud_opacity_file_extension()

Return petitRADTRANS cloud opacity files extension.

get_correlated_k_opacity_file_extension()

Return petitRADTRANS correlated-k opacity files extension.

get_default_cloud_resolution(→ str)

get_default_correlated_k_resolution(→ str)

get_default_line_by_line_resolution(→ str)

get_input_data_file_not_found_error_message(→ str)

get_input_file(file, path_input_data[, sub_path, ...])

get_line_by_line_opacity_file_extension()

Return petitRADTRANS line-by-line opacity files extension.

get_opacity_directory(species, category[, ...])

get_opacity_input_file(→ str)

Return the absolute filename of a species opacity.

get_resolving_power_from_string(→ int)

get_resolving_power_string(→ str | None)

get_species_basename(→ str)

get_species_isotopologue_name(→ str)

get_species_scientific_name(→ str)

join_species_all_info(name[, natural_abundance, ...])

split_input_data_path(path, path_input_data)

split_species_all_info(species[, final_charge_format])

Module Contents#

petitRADTRANS._input_data_loader.__build_cia_aliases_dict()#
petitRADTRANS._input_data_loader.__default_file_selection(files, full_path, sub_path)#
petitRADTRANS._input_data_loader.__get_from_tuple(string, _tuple, _tuple_description)#

Base for the naming convention functions.

petitRADTRANS._input_data_loader.__get_condensed_matter_state(string, regex_mode=False)#

Naming convention for condensed matter state. Access names here, change this to change the convention.

petitRADTRANS._input_data_loader.__get_natural_abundance_string(separator='')#

Naming convention for natural abundance. Access names here, change this to change the convention.

petitRADTRANS._input_data_loader.__get_spectral_sampling_type(string)#

Naming convention for spectral sampling type. Access names here, change this to change the convention.

petitRADTRANS._input_data_loader.__get_solid_structure(string)#

Naming convention for solid structure. Access names here, change this to change the convention.

petitRADTRANS._input_data_loader.__recursive_merge_contiguous_isotopes(isotope_groups, i, index_merge=None)#
petitRADTRANS._input_data_loader._get_base_cia_names()#
petitRADTRANS._input_data_loader._get_base_cloud_names()#
petitRADTRANS._input_data_loader._get_base_correlated_k_names()#

Only used for file conversion from pRT2 to pRT3.

petitRADTRANS._input_data_loader._get_base_line_by_line_names()#

Only used for file conversion from pRT2 to pRT3.

petitRADTRANS._input_data_loader._get_input_file(path_input_data: str, sub_path: str, files: list[str] | None = None, filename: str | None = None, expect_spectral_information: bool = False, expect_default_file_exists: bool = True, find_all: bool = False, display_other_files: bool = False) str | list[str]#
petitRADTRANS._input_data_loader._get_input_file_from_keeper(full_path, path_input_data=None, sub_path=None, filename=None, expect_spectral_information=False, find_all=False, ext='h5', timeout=3, url_input_data=None)#
petitRADTRANS._input_data_loader._get_spectral_information(filename)#
petitRADTRANS._input_data_loader._has_isotope(string)#
petitRADTRANS._input_data_loader._join_spectral_information(resolution_filename, range_filename)#
petitRADTRANS._input_data_loader._merge_contiguous_isotopes(species, isotope_separator)#
petitRADTRANS._input_data_loader._rebuild_isotope_numbers(species, mode='add')#

Add or remove isotope numbers from a species. Note that using improper isotope separation can lead to incorrect results (e.g. H218O -> 1H218-16O).

Args:
species:

Species name. Can also be a species collision (e.g. H2–He).

mode:

Can be ‘add’ or ‘remove’. In ‘add’ mode, add the isotope number of each of the species will be added to the species name, and each isotope is separated with a ‘-’. By default, the main isotope number is used. If partial isotope information is provided (e.g. 13C2H2, H2-18O, …), the information is used (e.g. 13C2-1H2, 1H2-18O, …) In ‘remove’ mode, remove all isotope numbers (e.g. 13C2-1H2 -> C2H2).

Returns:

The species name with added or removed isotope information.

petitRADTRANS._input_data_loader._split_cloud_info(cloud_info)#
petitRADTRANS._input_data_loader._split_species_cloud_info(species)#
petitRADTRANS._input_data_loader._split_species_charge(species, final_charge_format='+-')#
petitRADTRANS._input_data_loader._split_species_source(species)#
petitRADTRANS._input_data_loader._split_species_spectral_info(species)#
petitRADTRANS._input_data_loader.check_opacity_name(opacity_name: str)#

Check opacity name, based on the ExoMol format.

The name, in this order:
  • must begin with a number (up to 3 digits) or an uppercase letter

  • must contains a “valid” chemical formula (N1237He15 is considered valid)

  • can have isotopes, that should be separated with ‘-’ (H218O is a working ex., but corresponds to 1H218-16O)

  • can contains ‘-NatAbund’ to signal a mix of isotopes (incompatible with providing isotopic information)

  • can contains ‘+’, ‘-’, ‘p’ or ‘m’, (optionally starting with ‘_’ and a up to 3 digits number) to

    signal a ion

  • can contains ‘(l)’ for clouds of liquid particles

  • can contains ‘(s)’ for clouds of solid particles
    • must contains ‘crystalline’ or ‘amorphous’ for clouds with solid particles
      • ‘crystalline’ can be followed by a 3 digit number referring to the crystal space group number

      • ‘amorphous’ can be followed by up to 5 characters referring to the amorphous state name

  • can contains a source or method, starting with ‘__’

  • can contains spectral information, starting with ‘.’
    • spectral information must start with ‘R’, ‘DeltaWavenumber’ or ‘DeltaWavelength’, indicating

      respectively opacities evenly spectrally spaced in resolving power, wavenumber or wavelength

    • spectral spacing must end with a number (integers with or without an exponent format)

    • can contains the spectral range in micron in the format ‘_<float>-<float>mu’, following spectral

      spacing

Valid examples:
  • ‘H’ (simplest)

  • ‘H2O’

  • ‘2H2O’ (D2O)

  • ‘1H2-16O’

  • ‘1H-18O-2H+’

  • ‘H2O_m’

  • ‘H2O__HITEMP’

  • ‘H2O.R120’

  • ‘H2O(l)__Mie’

  • ‘H2O(s)_amorphous__Mie’

  • ‘H2O-NatAbund(s)_crystalline_194__DHS.R39_0.1-250mu’

  • ‘24Mg2-28Si-16O4(s)_crystalline_068__DHS.R39_0.1-250mu’ (most complex)

Args:

opacity_name:

Returns:

petitRADTRANS._input_data_loader.get_cia_aliases(name: str) str#
petitRADTRANS._input_data_loader.get_cia_opacity_file_extension()#

Return petitRADTRANS CIA opacity files extension.

petitRADTRANS._input_data_loader.get_cloud_aliases(name: str) str#
petitRADTRANS._input_data_loader.get_cloud_opacity_file_extension()#

Return petitRADTRANS cloud opacity files extension.

petitRADTRANS._input_data_loader.get_correlated_k_opacity_file_extension()#

Return petitRADTRANS correlated-k opacity files extension.

petitRADTRANS._input_data_loader.get_default_cloud_resolution() str#
petitRADTRANS._input_data_loader.get_default_correlated_k_resolution() str#
petitRADTRANS._input_data_loader.get_default_line_by_line_resolution() str#
petitRADTRANS._input_data_loader.get_input_data_file_not_found_error_message(file: str) str#
petitRADTRANS._input_data_loader.get_input_file(file: str, path_input_data: str, sub_path: str = None, expect_spectral_information: bool = False, find_all: bool = False, search_online: bool = True)#
petitRADTRANS._input_data_loader.get_line_by_line_opacity_file_extension()#

Return petitRADTRANS line-by-line opacity files extension.

petitRADTRANS._input_data_loader.get_opacity_directory(species: str, category: str, path_input_data: str = None, full: bool = False)#
petitRADTRANS._input_data_loader.get_opacity_input_file(path_input_data: str, category: str, species: str, 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 correlated-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

petitRADTRANS._input_data_loader.get_resolving_power_from_string(string: str) int#
petitRADTRANS._input_data_loader.get_resolving_power_string(resolving_power: int | float) str | None#
petitRADTRANS._input_data_loader.get_species_basename(species: str, join: bool = False) str#
petitRADTRANS._input_data_loader.get_species_isotopologue_name(species: str, join: bool = False) str#
petitRADTRANS._input_data_loader.get_species_scientific_name(species: str) str#
petitRADTRANS._input_data_loader.join_species_all_info(name, natural_abundance='', charge='', cloud_info='', source='', spectral_info='', resolution_filename=None, range_filename=None)#
petitRADTRANS._input_data_loader.split_input_data_path(path: str, path_input_data: str)#
petitRADTRANS._input_data_loader.split_species_all_info(species, final_charge_format='+-')#