Stellar spectra#
pytransit.stars gives access to two grids of theoretical stellar spectra that PyTransit ships
with. They are what the Contamination models integrate over passbands, and what the
gravity-darkened model uses to convert local surface temperature into
observed flux.
The grids#
Both grids are precomputed and binned. The original spectra are averaged over surface gravity and metallicity for each effective temperature and binned to a uniform 1 nm wavelength grid. This keeps them small enough to distribute inside the package – together about 18 MB – while remaining accurate enough for the broadband flux ratios they are used for.
Grid |
Wavelengths |
Temperatures |
Reference |
|---|---|---|---|
BT-Settl |
10-30000 nm |
1200-7000 K, 68 steps |
Allard et al. (2012) |
Husser2013 |
300-2500 nm |
2300-12000 K, 73 steps |
Husser et al. (A&A 553, A6, 2013) |
BT-Settl covers a much wider wavelength range and reaches down to brown dwarf temperatures,
which makes it the grid of choice for cool hosts, M dwarfs, and low-mass contaminants. It is the
default in SMContamination.
Husser2013 extends to hotter stars, up to early A types, but over a narrower wavelength range.
Neither grid resolves individual lines after binning. They are meant for integrating over passbands, not for spectroscopy.
Reading a grid#
Each grid has a read_*_table function returning a pandas.DataFrame with the effective
temperatures as the index and the wavelengths as the columns.
from pytransit.stars import read_bt_settl_table
df = read_bt_settl_table()
df.shape
# (68, 29991)
df.index.values[:5] # effective temperatures in K
df.columns.values[:5] # wavelengths in nm
Interpolating#
For a spectrum at an arbitrary temperature, create_*_interpolator returns a
scipy.interpolate.RegularGridInterpolator over (temperature, wavelength).
from numpy import linspace, full, transpose
from pytransit.stars import create_bt_settl_interpolator
ip = create_bt_settl_interpolator()
wl = linspace(400.0, 900.0, 500)
spectrum = ip(transpose([full(wl.size, 5500.0), wl]))
The interpolator is built from the full table each time it is created, so create it once and reuse it.
Note
The interpolators do not extrapolate. Requesting a temperature or wavelength outside the grid raises a ValueError.
Rebuilding the tables#
compute_averaged_bt_settl_table and compute_averaged_husser2013_table regenerate the shipped
tables from a locally downloaded spectrum grid. These are package maintenance functions – PyTransit
comes with the tables precomputed, so they only need to be run to rebuild them.
API#
BT-Settl#
- pytransit.stars.read_bt_settl_table()[source]#
Read the wavelength-binned BT-Settl stellar spectrum table shipped with PyTransit.
Reads the precomputed spectrum table from
bt_settl_file. The table holds spectra averaged over surface gravity and metallicity and binned to a uniform 1 nm wavelength grid covering 10-30000 nm at 68 effective temperatures from 1200 K to 7000 K. The binning keeps the table small enough to distribute with the package while remaining accurate enough for broadband flux ratios. The temperature coverage makes this the grid of choice for cool stars, M dwarfs, and brown dwarfs.- Returns:
pandas.DataFrame – Spectra with the effective temperatures in K as the index and the wavelengths in nm as the columns.
See also
create_bt_settl_interpolatoran interpolator over the same table.
- pytransit.stars.create_bt_settl_interpolator()[source]#
Create a 2D interpolator over the BT-Settl spectrum table.
- Returns:
scipy.interpolate.RegularGridInterpolator – Interpolator over (effective temperature [K], wavelength [nm]) returning the flux.
- pytransit.stars.compute_averaged_bt_settl_table(datadir)[source]#
Recompute the binned BT-Settl spectrum table from the original spectra.
Reads the original BT-Settl spectra from datadir, averages them over surface gravity and metallicity for each effective temperature, bins them to a 1 nm grid, and overwrites the table at
bt_settl_file.This is a package maintenance function: PyTransit ships with a precomputed table, so it only needs to be run to rebuild that table from a locally downloaded spectrum grid.
- Parameters:
datadir (pathlib.Path) – Directory holding the original spectra as
*.fits.gzfiles.
- pytransit.stars.bt_settl_file#
Absolute path to the FITS file holding the binned BT-Settl table.
Husser et al. (2013)#
- pytransit.stars.read_husser2013_table()[source]#
Read the wavelength-binned Husser et al. (2013) PHOENIX stellar spectrum table shipped with PyTransit.
Reads the precomputed spectrum table from
husser2013_file. The table holds spectra averaged over surface gravity and metallicity and binned to a uniform 1 nm wavelength grid covering 300-2500 nm at 73 effective temperatures from 2300 K to 12000 K. The binning keeps the table small enough to distribute with the package while remaining accurate enough for broadband flux ratios. The temperature coverage extends to hotter stars than the BT-Settl grid, but the wavelength coverage is narrower.- Returns:
pandas.DataFrame – Spectra with the effective temperatures in K as the index and the wavelengths in nm as the columns.
See also
create_husser2013_interpolatoran interpolator over the same table.
- pytransit.stars.create_husser2013_interpolator()[source]#
Create a 2D interpolator over the Husser et al. (2013) PHOENIX spectrum table.
- Returns:
scipy.interpolate.RegularGridInterpolator – Interpolator over (effective temperature [K], wavelength [nm]) returning the flux.
Examples
from pytransit.stars import create_husser2013_interpolator ip = create_husser2013_interpolator() flux = ip([[5500.0, 650.0]])
- pytransit.stars.compute_averaged_husser2013_table(datadir)[source]#
Recompute the binned Husser et al. (2013) PHOENIX spectrum table from the original spectra.
Reads the original Husser et al. (2013) PHOENIX spectra from datadir, averages them over surface gravity and metallicity for each effective temperature, bins them to a 1 nm grid, and overwrites the table at
husser2013_file.This is a package maintenance function: PyTransit ships with a precomputed table, so it only needs to be run to rebuild that table from a locally downloaded spectrum grid.
- Parameters:
datadir (pathlib.Path) – Directory holding the original spectra as
*.fits.gzfiles.
- pytransit.stars.husser2013_file#
Absolute path to the FITS file holding the binned Husser et al. (2013) table.