bioniumx.spectra.TransmissionSpectrum

class bioniumx.spectra.TransmissionSpectrum(wavelength, transit_depth, err=None, target_name: str = 'Unknown', instrument: str = 'Unknown', resolution: float | None = None, gti: list | None = None)[source]

Represents a transmission spectrum of an exoplanet atmosphere.

Stores wavelength grid, transit depth (Rp/Rs)², and uncertainties, plus all mission/target metadata.

Parameters:
  • wavelength (array-like) – Wavelength array in microns.

  • transit_depth (array-like) – Transit depth (Rp/Rs)² at each wavelength. Dimensionless.

  • err (array-like, optional) – 1-sigma uncertainty on transit_depth. If None, assumed uniform 0.

  • target_name (str, optional) – Exoplanet identifier (e.g., ‘K2-18 b’).

  • instrument (str, optional) – Observing instrument (e.g., ‘JWST/NIRSpec’, ‘Hubble/WFC3’).

  • resolution (float, optional) – Spectral resolving power R = λ/Δλ.

wavelength

Wavelength in microns.

Type:

np.ndarray

transit_depth

Observed transit depth spectrum.

Type:

np.ndarray

err

Uncertainty array (same shape as transit_depth).

Type:

np.ndarray

meta

Dictionary of all metadata (target_name, instrument, etc.)

Type:

dict

Examples

Load from CSV and compute water detection:

>>> from bioniumx.spectra import TransmissionSpectrum
>>> from bioniumx.io import load_csv
>>> wl, depth, err = load_csv("K2-18b_jwst.csv")
>>> spec = TransmissionSpectrum(wl, depth, err=err, target_name="K2-18 b")
>>> spec
<TransmissionSpectrum | {'wavelength': (256,), 'transit_depth': (256,)}>

References

Madhusudhan et al. (2023), ApJL, 956, L18 — K2-18b carbon detection.

__init__(wavelength, transit_depth, err=None, target_name: str = 'Unknown', instrument: str = 'Unknown', resolution: float | None = None, gti: list | None = None)[source]

Methods

__init__(wavelength, transit_depth[, err, ...])

apply_wavelength_mask(wl_min, wl_max)

Return a masked copy within [wl_min, wl_max] microns.

plot([ax])

Quick-look matplotlib plot of the transmission spectrum.

read(filename[, fmt])

Load an object from a file.

rebin(factor)

Bin down the wavelength grid by averaging factor adjacent channels.

snr()

Compute signal-to-noise ratio per channel.

write(filename[, fmt])

Save this object to a file.