Observations (taurex.spectrum)

Base

Contains the basic definition of an observed spectrum for TauRex 3.

class BaseSpectrum(name: str)[source]

Bases: Loggable, Fittable, Writeable

A base class that represents spectrums.

Abstract class

A base class where spectrums are loaded (or later created). This is used to either plot against the forward model or passed into the optimizer to be used to fit the forward model.

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

Bin edges of the wavenumber grid. Requires Implementation

Should return the bin edges of the wavenumber grid

Raises:

NotImplementedError

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

Widths of each bin in the wavenumber grid Requires Implementation

Should return the widths of each bin in the wavenumber grid

Raises:

NotImplementedError

create_binner() Binner[source]

Creates the appropriate binning object.

property derivedParameters: Dict[str, Tuple[str, str, Callable[[], float], bool]]

Return derived parameters.

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

Return error or uncertainty of the spectrum. Requires Implementation

Should return the error. Must be the same shape as spectrum()

Raises:

NotImplementedError

property fittingParameters: Dict[str, Tuple[str, str, Callable[[], float], Callable[[float], None], Literal['linear', 'log'], bool, Tuple[float, float]]]

Return fitting parameters.

classmethod input_keywords() Tuple[str, ...][source]
property rawData: Any

Raw data of the observation. Requires Implementation

Should return the raw data set.

Raises:

NotImplementedError

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

Spectrum of the observation.

Requires Implementation

Should return the observed spectrum.

Raises:

NotImplementedError

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

Wavelength grid of the spectrum in microns.

Requires Implementation

Should return the wavelength grid of the spectrum in microns. This does not need to necessarily match the shape of spectrum()

Raises:

NotImplementedError

property wavenumberGrid

Wavenumber grid in \(cm^{-1}\)

Returns:

wngrid

Return type:

array

write(output: OutputGroup) OutputGroup[source]

Write spectrum to output group.

Array

Spectra loaded from an array.

class ArraySpectrum(spectrum: ndarray[tuple[int, ...], dtype[float64]] | None = None)[source]

Bases: BaseSpectrum

Loads an observed spectrum from an array

Loads spectrum and computes bin edges and bin widths. Spectrum shape(nbins, 3-4) with 3-4 columns with ordering:

  1. wavelength (um)

  2. spectral data

  3. error

  4. (optional) bin width

If no bin width is present then they are computed.

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

Bin edges.

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

bin widths.

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

Error bars for the spectrum.

classmethod input_keywords() Tuple[str, ...][source]

Input keywords for this class.

manual_binning() None[source]

Performs the calculation of bin edges when none are present.

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

Data read from file.

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

The spectrum itself.

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

Wavelength grid in microns.

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

Wavenumber grid in cm-1

Observed

class ObservedSpectrum(filename=None)[source]

Bases: ArraySpectrum

Loads an observed spectrum from a text file and computes bin edges and bin widths. Spectrum must be 3-4 columns with ordering:

  1. wavelength

  2. spectral data

  3. error

  4. (optional) bin width

If no bin width is present then they are computed.

Parameters:

filename (string) – Path to observed spectrum file.

classmethod input_keywords()[source]

Input keywords for this class.

Iraclis

Spectra from Iraclis pickle data.

class IraclisSpectrum(filename: str | bytes | PathLike | Path | None = None)[source]

Bases: ArraySpectrum

Loads an observation from Iraclis pickle data.

classmethod input_keywords() Tuple[str, ...][source]

Input keywords for this class.

Taurex

class TaurexSpectrum(filename: str | bytes | PathLike | Path | None = None)[source]

Bases: ArraySpectrum

Observation is a taurex spectrum from a HDF5 file.

An instrument function must have been used for this to work

Lightcurves

Module dealing with observed lightcurves.

class ObservedLightCurve(filename: str | bytes | PathLike | Path | None = None)[source]

Bases: BaseSpectrum

Loads an observed lightcurve from a pickle file.

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

Returns bin edges for wavelength grid.

Returns:

out

Return type:

array

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

Widths for each bin in wavelength grid.

Returns:

out

Return type:

array

create_binner() LightcurveBinner[source]

Creates the appropriate binning object.

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

Uncertainty of lightcurve spectrum.

Returns:

err – Error at each point in lightcurve spectrum

Return type:

array

classmethod input_keywords() Tuple[str, ...][source]

Input keywords for this class.

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

Raw lightcurve data read from file

Returns:

lc_data

Return type:

array

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

Return a Light curve spectrum.

Spectrum is not a true spectrum but in the context of Taurex it is seen as one to a retrieval.

The lightcurve spectrum comes in the form of multiple lightcurves stuck together into one long spectrum. The number of lightcurves is equal to the number of bins in wavelengthGrid().

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

Returns wavelength grid in microns

Returns:

wlgrid

Return type:

array

write(output: OutputGroup) OutputGroup[source]

Write to output group.