Opacities (‘’taurex.opacity’’)

Base

Base class for computing opacities.

class Opacity(name: str)[source]

Bases: Loggable, Citable

This is the base class for computing opactities.

compute_opacity(temperature: float, pressure: float, wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None) ndarray[tuple[int, ...], dtype[float64]][source]

Must return in units of cm2.

classmethod discover() List[Tuple[str, Any]][source]

Class method, used to discover molecular opacities.

Should return opacities that are available in the current environment.

property moleculeName: str

Name of molecule.

opacity(temperature: float, pressure: float, wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None) ndarray[tuple[int, ...], dtype[float64]][source]

Compute the opacity for a given temperature and pressure.

Parameters:
  • temperature (float) – Temperature in K

  • pressure (float) – Pressure in Pa

  • wngrid (array, optional) – Wavenumber grid to restrict to.

Returns:

Opacity array

Return type:

array

opacityCitation() List[str][source]

Citation for the specific molecular opacity.

Returns:

List of string with reference information

Return type:

list of str

property pressureGrid: ndarray[tuple[int, ...], dtype[float64]]
classmethod priority() int[source]

Priority of the opacity during discovery.

property resolution: float

Resolution of opacity.

property temperatureGrid: ndarray[tuple[int, ...], dtype[float64]]
property wavenumberGrid: ndarray[tuple[int, ...], dtype[float64]]

Base Interpolator

class InterpolatingOpacity(name: str, interpolation_mode: Literal['linear', 'exp'] | None = 'linear')[source]

Bases: Opacity

Provides interpolation methods.

compute_opacity(temperature: float, pressure: float, wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None) ndarray[tuple[int, ...], dtype[float64]][source]

Compute opacity.

Interpolates the opacity grid to the given temperature and pressure.

Parameters:
  • temperature (float) – Temperature in K

  • pressure (float) – Pressure in Pa

  • wngrid (array, optional) – Wavenumber grid to restrict to.

Returns:

Interpolated opacity.

Return type:

array

find_closest_index(temperature: float, pressure: float) Tuple[int, int, int, int][source]

Find closest pair index to temperature and pressure.

Closest pair index is the index on either side of temperature and pressure.

interp_bilinear_grid(temperature: float, pressure: float, t_idx_min: int, t_idx_max: int, p_idx_min: int, p_idx_max: int, wngrid_filter: ndarray[tuple[int, ...], dtype[bool]] | None = None) ndarray[tuple[int, ...], dtype[float64]][source]

Interpolate both temperature and pressure.

interp_pressure_only(pressure: float, p_idx_min: int, p_idx_max: int, temperature_idx: int, filt: ndarray[tuple[int, ...], dtype[bool]]) ndarray[tuple[int, ...], dtype[float64]][source]

Interpolate pressure only.

interp_temp_only(temperature: float, temp_idx_min: int, temp_idx_max: int, pressure_idx: int, filt: ndarray[tuple[int, ...], dtype[bool]]) ndarray[tuple[int, ...], dtype[float64]][source]

Interpolate temperature only.

property logPressure: ndarray[tuple[int, ...], dtype[float64]]

Log pressure grid.

property pressureBounds: Tuple[float, float]

Pressure bounds.

property pressureMax: float

Maximum pressure in opacity grid.

property pressureMin: float

Minimum pressure in opacity grid.

set_interpolation_mode(interp_mode: Literal['linear', 'exp']) None[source]

Set interpolation mode.

property temperatureBounds: Tuple[float, float]

Temperature bounds.

property temperatureMax: float

Maximum temperature in opacity grid.

property temperatureMin: float

Minimum temperature in opacity grid.

property xsecGrid: ndarray[tuple[int, ...], dtype[float64]]

Opacity grid.

Pickle Format (.pickle)

Opacities loaded from pickle.

class PickleOpacity(filename: str | bytes | PathLike | Path, interpolation_mode: Literal['linear', 'exp'] | None = 'linear')[source]

Bases: InterpolatingOpacity

Class for loading opacities from pickle files.

This was the original format for TauREx 1/2 opacities. It is now deprecated in favour of HDF5 files.

clean_molecule_name() None[source]

Clean molecule name from underscores used.

classmethod discover() List[Tuple[str, Tuple[Path, str]]][source]

Discover opacities from pickle files in path.

property moleculeName: str

Molecule name.

property pressureGrid: ndarray[tuple[int, ...], dtype[float64]]
property resolution: float

Resolution of opacity.

property temperatureGrid: ndarray[tuple[int, ...], dtype[float64]]

Temperature grid.

property wavenumberGrid: ndarray[tuple[int, ...], dtype[float64]]

Wavenumber grid.

property xsecGrid: ndarray[tuple[int, ...], dtype[float64]]

Opacity grid.

HDF5 Format (.hdf5)

Opacity loaded from HDF5 file.

class HDF5Opacity(filename: str | bytes | PathLike | Path, interpolation_mode: Literal['linear', 'exp'] | None = 'exp', in_memory: bool | None = False)[source]

Bases: InterpolatingOpacity

Opacities from HDF5 files.

These usually come from ExoMol. Specifically the ExoMolOP database.

BIBTEX_ENTRIES = ['\n    @ARTICLE{2021A&A...646A..21C,\n        author = {{Chubb}, Katy L. and {Rocchetto}, Marco and {Yurchenko},\n        Sergei N. and {Min}, Michiel and {Waldmann}, Ingo and {Barstow}, Joanna K. and\n        {Molli{\\`e}re}, Paul and {Al-Refaie}, Ahmed F.\n        and {Phillips}, Mark W. and {Tennyson},\n        Jonathan},\n            title = "{The ExoMolOP database: Cross sections and k-tables for\n            molecules of interest in high-temperature exoplanet atmospheres}",\n        journal = {Astronomy and Astrophysics},\n        keywords = {molecular data, opacity, radiative\n        transfer, planets and satellites: atmospheres,\n        planets and satellites: gaseous planets,\n        infrared: planetary systems, Astrophysics - Earth and Planetary Astrophysics,\n        Astrophysics - Instrumentation and Methods for\n        Astrophysics, Astrophysics - Solar\n        and Stellar Astrophysics},\n            year = 2021,\n            month = feb,\n        volume = {646},\n            eid = {A21},\n            pages = {A21},\n            doi = {10.1051/0004-6361/202038350},\n    archivePrefix = {arXiv},\n        eprint = {2009.00687},\n    primaryClass = {astro-ph.EP},\n        adsurl = {https://ui.adsabs.harvard.edu/abs/2021A&A...646A..21C},\n        adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n    }\n\n        ']

List of bibtex entries.

citations() List[str][source]

Return citations for opacity + ExomolOP.

classmethod discover() List[Tuple[str, Tuple[Path, Literal['linear', 'exp'], bool]]][source]

Discover opacities from HDF5 files in path.

handle_pybtex() None[source]

Handle citations

property moleculeName: str

Name of molecule.

opacityCitation() List[str][source]

Get citations to opacity.

property pressureGrid: ndarray[tuple[int, ...], dtype[float64]]

Pressure grid.

classmethod priority() int[source]

Priority of the opacity during discovery.

property resolution: float

Resolution of opacity.

property temperatureGrid: ndarray[tuple[int, ...], dtype[float64]]

Temperature grid.

property wavenumberGrid: ndarray[tuple[int, ...], dtype[float64]]

Wavenumber grid.

property xsecGrid: ndarray[tuple[int, ...], dtype[float64]]

Opacity grid.

ExoTransmit Format (.dat)

Opacities from Exo_Transmit.

Exo_Transmit is a code for calculating transmission spectra for exoplanet atmospheres of varied composition. Its opacities are based on HITRAN and have the format opac{molecule}.dat.

class ExoTransmitOpacity(filename: str | bytes | PathLike | Path, interpolation_mode: Literal['linear', 'exp'] | None = 'linear')[source]

Bases: InterpolatingOpacity

Opacity from Exo_Transmit.

BIBTEX_ENTRIES = ['\n        @ARTICLE{2017PASP..129d4402K,\n            author = {{Kempton}, Eliza M. -R. and {Lupu},\n            Roxana and {Owusu-Asare}, Albert and {Slough}, Patrick and {Cale}, Bryson},\n                title = "{Exo-Transmit: An Open-Source Code\n                for Calculating Transmission Spectra for\n                Exoplanet Atmospheres of Varied Composition}",\n            journal = {Publications of the Astronomical Society of the Pacific},\n            keywords = {Astrophysics - Earth and Planetary Astrophysics},\n                year = 2017,\n                month = apr,\n            volume = {129},\n            number = {974},\n                pages = {044402},\n                doi = {10.1088/1538-3873/aa61ef},\n        archivePrefix = {arXiv},\n            eprint = {1611.03871},\n        primaryClass = {astro-ph.EP},\n            adsurl = {https://ui.adsabs.harvard.edu/abs/2017PASP..129d4402K},\n            adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n        }\n\n        ']

List of bibtex entries.

classmethod discover() List[Tuple[str, Tuple[Path, Literal['linear', 'exp']]]][source]

Discover opacities from Exo_Transmit.

They have the format opac{molecule}.dat. So we try to search for them in the xsec_path.

property moleculeName: str

Name of molecule.

property pressureGrid: ndarray[tuple[int, ...], dtype[float64]]

Pressure grid.

property resolution: float

Resolution of opacity.

property temperatureGrid: ndarray[tuple[int, ...], dtype[float64]]

Temperature grid.

property wavenumberGrid: ndarray[tuple[int, ...], dtype[float64]]

Wavenumber grid.

property xsecGrid: ndarray[tuple[int, ...], dtype[float64]]

Opacity grid.