species.read package¶
Submodules¶
species.read.read_calibration module¶
Module with reading functionalities for calibration spectra.
- class species.read.read_calibration.ReadCalibration(tag: str, filter_name: Optional[str] = None)[source]¶
Bases:
object
Class for reading a calibration spectrum from the database.
- Parameters
tag (str) – Database tag of the calibration spectrum.
filter_name (str, None) – Filter that is used for the wavelength range. The full spectrum is read if the argument is set to
None
.
- Returns
None
- Return type
NoneType
- get_flux(model_param: Optional[Dict[str, float]] = None) Tuple[float, float] [source]¶
Function for calculating the average flux for the
filter_name
.- Parameters
model_param (dict, None) – Model parameters. Should contain the ‘scaling’ value. Not used if set to
None
.- Returns
float – Average flux (W m-2 um-1).
float – Uncertainty (W m-2 um-1).
- get_magnitude(model_param: Optional[Dict[str, float]] = None, distance: Optional[Tuple[float, float]] = None) Tuple[Tuple[float, Optional[float]], Tuple[Optional[float], Optional[float]]] [source]¶
Function for calculating the apparent magnitude for the
filter_name
.- Parameters
model_param (dict, None) – Model parameters. Should contain the ‘scaling’ value. Not used if set to
None
.distance (tuple(float, float), None) – Distance and uncertainty to the calibration object (pc). Not used if set to
None
, in which case the returned absolute magnitude is(None, None)
.
- Returns
tuple(float, float) – Apparent magnitude and uncertainty.
tuple(float, float), tuple(None, None) – Absolute magnitude and uncertainty.
- get_spectrum(model_param: Optional[Dict[str, float]] = None, apply_mask: bool = False, spec_res: Optional[float] = None, extrapolate: bool = False, min_wavelength: Optional[float] = None) species.core.box.SpectrumBox [source]¶
Function for selecting the calibration spectrum.
- Parameters
model_param (dict, None) – Model parameters. Should contain the ‘scaling’ value. Not used if set to
None
.apply_mask (bool) – Exclude negative values and NaN values.
spec_res (float, None) – Spectral resolution. Original wavelength points are used if set to
None
.extrapolate (bool) – Extrapolate to 6 um by fitting a power law function.
min_wavelength (float, None) – Minimum wavelength used for fitting the power law function. All data is used if set to
None
.
- Returns
Box with the spectrum.
- Return type
- resample_spectrum(wavel_points: numpy.ndarray, model_param: Optional[Dict[str, float]] = None, spec_res: Optional[float] = None, apply_mask: bool = False) species.core.box.SpectrumBox [source]¶
Function for resampling the spectrum and optional uncertainties onto a new wavelength grid.
- Parameters
wavel_points (np.ndarray) – Wavelengths (um).
model_param (dict, None) – Dictionary with the model parameters, which should only contain the
'scaling'
keyword. No scaling is applied if the argument ofmodel_param
is set toNone
.spec_res (float, None) – Spectral resolution that is used for smoothing the spectrum before resampling the wavelengths. No smoothing is applied if the argument is set to
None
. The smoothing can only be applied ti spectra with a constant spectral resolution (which is the case for all model spectra that are compatible withspecies
) or a constant wavelength spacing. The first smoothing approach is fastest.apply_mask (bool) – Exclude negative values and NaNs.
- Returns
Box with the resampled spectrum.
- Return type
species.read.read_color module¶
species.read.read_filter module¶
Module with reading functionalities for filter profiles.
- class species.read.read_filter.ReadFilter(filter_name: str)[source]¶
Bases:
object
Class for reading a filter profile from the database.
- Parameters
filter_name (str) – Filter name as stored in the database. Filter names from the SVO Filter Profile Service will be automatically downloaded, stored in the database, and read from the database.
- Returns
None
- Return type
NoneType
- detector_type() str [source]¶
Return the detector type.
- Returns
Detector type (‘energy’ or ‘photon’).
- Return type
str
- effective_width() numpy.float32 [source]¶
Calculate the effective width of the filter profile. The effective width is equivalent to the horizontal size of a rectangle with height equal to the maximum transmission and with the same area as the one covered by the filter profile.
- Returns
Effective width (um).
- Return type
float
- filter_fwhm() float [source]¶
Calculate the full width at half maximum (FWHM) of the filter profile.
- Returns
Full width at half maximum (um).
- Return type
float
- get_filter() numpy.ndarray [source]¶
Function for selecting a filter profile from the database.
- Returns
Array with the wavelengths and filter transmission.
- Return type
np.ndarray
- interpolate_filter() scipy.interpolate.interpolate.interp1d [source]¶
Function for linearly interpolating a filter profile.
- Returns
Linearly interpolated filter.
- Return type
scipy.interpolate.interpolate.interp1d
species.read.read_isochrone module¶
Module with reading functionalities for isochrones.
- class species.read.read_isochrone.ReadIsochrone(tag: str)[source]¶
Bases:
object
Class for reading isochrone data from the database.
- Parameters
tag (str) – Database tag of the isochrone data.
- Returns
None
- Return type
NoneType
- get_color_color(age: float, masses: numpy.ndarray, model: str, filters_colors: Tuple[Tuple[str, str], Tuple[str, str]]) species.core.box.ColorColorBox [source]¶
Function for calculating color-magnitude combinations from a selected isochrone.
- Parameters
age (float) – Age (Myr) at which the isochrone data is interpolated.
masses (np.ndarray) – Masses (Mjup) at which the isochrone data is interpolated.
model (str) – Atmospheric model used to compute the synthetic photometry.
filters_colors (tuple(tuple(str, str), tuple(str, str))) – Filter names for the colors as listed in the file with the isochrone data. The filter names should be provided in the format of the SVO Filter Profile Service.
- Returns
Box with the color-color data.
- Return type
- get_color_magnitude(age: float, masses: numpy.ndarray, model: str, filters_color: Tuple[str, str], filter_mag: str, adapt_logg: bool = False) species.core.box.ColorMagBox [source]¶
Function for calculating color-magnitude combinations from a selected isochrone.
- Parameters
age (float) – Age (Myr) at which the isochrone data is interpolated.
masses (np.ndarray) – Masses (Mjup) at which the isochrone data is interpolated.
model (str) – Atmospheric model used to compute the synthetic photometry.
filters_color (tuple(str, str)) – Filter names for the color as listed in the file with the isochrone data. The filter names should be provided in the format of the SVO Filter Profile Service.
filter_mag (str) – Filter name for the absolute magnitude as listed in the file with the isochrone data. The value should be equal to one of the
filters_color
values.adapt_logg (bool) – Adapt \(\log(g)\) to the upper or lower boundary of the atmospheric model grid whenever the \(\log(g)\) that has been calculated from the isochrone mass and radius lies outside the available range of the synthetic spectra. Typically \(\log(g)\) has only a minor impact on the broadband magnitudes and colors.
- Returns
Box with the color-magnitude data.
- Return type
- get_isochrone(age: float, masses: numpy.ndarray, filters_color: Optional[Tuple[str, str]] = None, filter_mag: Optional[str] = None) species.core.box.IsochroneBox [source]¶
Function for selecting an isochrone.
- Parameters
age (float) – Age (Myr) at which the isochrone data is interpolated.
masses (np.ndarray) – Masses (Mjup) at which the isochrone data is interpolated.
filters_color (tuple(str, str), None) – Filter names for the color as listed in the file with the isochrone data. Not selected if set to
None
or if only evolutionary tracks are available.filter_mag (str, None) – Filter name for the absolute magnitude as listed in the file with the isochrone data. Not selected if set to
None
or if only evolutionary tracks are available.
- Returns
Box with the isochrone.
- Return type
species.read.read_model module¶
Module with reading functionalities for atmospheric model spectra.
- class species.read.read_model.ReadModel(model: str, wavel_range: Optional[Tuple[float, float]] = None, filter_name: Optional[str] = None)[source]¶
Bases:
object
Class for reading a model spectrum from the database.
- Parameters
model (str) – Name of the atmospheric model.
wavel_range (tuple(float, float), None) – Wavelength range (um). Full spectrum is selected if set to
None
. Not used iffilter_name
is notNone
.filter_name (str, None) – Filter name that is used for the wavelength range. The
wavel_range
is used if set toNone
.
- Returns
None
- Return type
NoneType
- static apply_ext_ism(wavelengths: numpy.ndarray, flux: numpy.ndarray, v_band_ext: float, v_band_red: float) numpy.ndarray [source]¶
Internal function for applying ISM extinction to a spectrum.
- wavelengthsnp.ndarray
Wavelengths (um) of the spectrum.
- fluxnp.ndarray
Fluxes (W m-2 um-1) of the spectrum.
- v_band_extfloat
Extinction (mag) in the V band.
- v_band_redfloat
Reddening in the V band.
- Returns
Fluxes (W m-2 um-1) with the extinction applied.
- Return type
np.ndarray
- static apply_lognorm_ext(wavelength: numpy.ndarray, flux: numpy.ndarray, radius_interp: float, sigma_interp: float, v_band_ext: float) numpy.ndarray [source]¶
Internal function for applying extinction by dust to a spectrum.
- wavelengthnp.ndarray
Wavelengths (um) of the spectrum.
- fluxnp.ndarray
Fluxes (W m-2 um-1) of the spectrum.
- radius_interpfloat
Logarithm of the mean geometric radius (um) of the log-normal size distribution.
- sigma_interpfloat
Geometric standard deviation (dimensionless) of the log-normal size distribution.
- v_band_extfloat
The extinction (mag) in the V band.
- Returns
Fluxes (W m-2 um-1) with the extinction applied.
- Return type
np.ndarray
- static apply_powerlaw_ext(wavelength: numpy.ndarray, flux: numpy.ndarray, r_max_interp: float, exp_interp: float, v_band_ext: float) numpy.ndarray [source]¶
Internal function for applying extinction by dust to a spectrum.
- wavelengthnp.ndarray
Wavelengths (um) of the spectrum.
- fluxnp.ndarray
Fluxes (W m-2 um-1) of the spectrum.
- r_max_interpfloat
Maximum radius (um) of the power-law size distribution.
- exp_interpfloat
Exponent of the power-law size distribution.
- v_band_extfloat
The extinction (mag) in the V band.
- Returns
Fluxes (W m-2 um-1) with the extinction applied.
- Return type
np.ndarray
- get_bounds() Dict[str, Tuple[float, float]] [source]¶
Function for extracting the grid boundaries.
- Returns
Boundaries of parameter grid.
- Return type
dict
- get_data(model_param: Dict[str, float], spec_res: Optional[float] = None, wavel_resample: Optional[numpy.ndarray] = None) species.core.box.ModelBox [source]¶
Function for selecting a model spectrum (without interpolation) for a set of parameter values that coincide with the grid points. The stored grid points can be inspected with
get_points()
.- Parameters
model_param (dict) – Model parameters and values. Only discrete values from the original grid are possible. Else, the nearest grid values are selected.
spec_res (float, None) – Spectral resolution that is used for smoothing the spectrum with a Gaussian kernel. No smoothing is applied to the spectrum if the argument is set to
None
.wavel_resample (np.ndarray, None) – Wavelength points (um) to which the spectrum will be resampled. In that case,
spec_res
can still be used for smoothing the spectrum with a Gaussian kernel. The original wavelength points are used if the argument is set toNone
.
- Returns
Box with the model spectrum.
- Return type
- get_flux(model_param: Dict[str, float], synphot=None)[source]¶
Function for calculating the average flux density for the
filter_name
.- Parameters
model_param (dict) – Model parameters and values.
synphot (species.analysis.photometry.SyntheticPhotometry, None) – Synthetic photometry object. The object is created if set to None.
- Returns
float – Average flux (W m-2 um-1).
float, None – Uncertainty (W m-2 um-1), which is set to
None
.
- get_magnitude(model_param: Dict[str, float]) Tuple[Optional[float], Optional[float]] [source]¶
Function for calculating the apparent and absolute magnitudes for the
filter_name
.- Parameters
model_param (dict) – Dictionary with the model parameters. A
radius
(Rjup) anddistance
(pc) are required for the apparent magnitude (i.e. to scale the flux from the planet to the observer). Only aradius
is required for the absolute magnitude.- Returns
float – Apparent magnitude. A
None
is returned if the dictionary ofmodel_param
does not contain aradius
anddistance
.float, None – Absolute magnitude. A
None
is returned if the dictionary ofmodel_param
does not contain aradius
.
- get_model(model_param: Dict[str, float], spec_res: Optional[float] = None, wavel_resample: Optional[numpy.ndarray] = None, magnitude: bool = False, smooth: bool = False) species.core.box.ModelBox [source]¶
Function for extracting a model spectrum by linearly interpolating the model grid.
- Parameters
model_param (dict) – Dictionary with the model parameters and values. The values should be within the boundaries of the grid. The grid boundaries of the spectra in the database can be obtained with
get_bounds()
.spec_res (float, None) – Spectral resolution that is used for smoothing the spectrum with a Gaussian kernel when
smooth=True
. The wavelengths will be resampled to the argument ofspec_res
ifsmooth=False
.wavel_resample (np.ndarray, None) – Wavelength points (um) to which the spectrum is resampled. In that case,
spec_res
can still be used for smoothing the spectrum with a Gaussian kernel. The original wavelength points are used if the argument is set toNone
.magnitude (bool) – Normalize the spectrum with a flux calibrated spectrum of Vega and return the magnitude instead of flux density.
smooth (bool) – If
True
, the spectrum is smoothed with a Gaussian kernel to the spectral resolution ofspec_res
. This requires either a uniform spectral resolution of the input spectra (fast) or a uniform wavelength spacing of the input spectra (slow).
- Returns
Box with the model spectrum.
- Return type
- get_parameters() List[str] [source]¶
Function for extracting the parameter names.
- Returns
Model parameters.
- Return type
list(str)
- get_points() Dict[str, numpy.ndarray] [source]¶
Function for extracting the grid points.
- Returns
Parameter points of the model grid.
- Return type
dict
- get_spec_res() float [source]¶
Function for extracting the spectral resolution as stored in the database.
- Returns
Spectral resolution.
- Return type
float
- get_wavelengths() numpy.ndarray [source]¶
Function for extracting the wavelength points.
- Returns
Wavelength points (um).
- Return type
np.ndarray
- interpolate_grid(wavel_resample: Optional[numpy.ndarray] = None, smooth: bool = False, spec_res: Optional[float] = None) None [source]¶
Internal function for linearly interpolating the grid of model spectra for a given filter or wavelength sampling.
- wavel_resamplenp.ndarray, None
Wavelength points for the resampling of the spectrum. The
filter_name
is used if set toNone
.- smoothbool
Smooth the spectrum with a Gaussian line spread function. Only recommended in case the input wavelength sampling has a uniform spectral resolution.
- spec_resfloat
Spectral resolution that is used for the Gaussian filter when
smooth=True
.
- Returns
None
- Return type
NoneType
- interpolate_model() None [source]¶
Internal function for linearly interpolating the full grid of model spectra.
- Returns
None
- Return type
NoneType
- open_database() h5py._hl.files.File [source]¶
Internal function for opening the species database.
- Returns
The HDF5 database.
- Return type
h5py._hl.files.File
- wavelength_points(hdf5_file: h5py._hl.files.File) Tuple[numpy.ndarray, numpy.ndarray] [source]¶
Internal function for extracting the wavelength points and indices that are used.
- Parameters
hdf5_file (h5py._hl.files.File) – The HDF5 database.
- Returns
np.ndarray – Wavelength points (um).
np.ndarray – Array with the size of the original wavelength grid. The booleans indicate if a wavelength point was used.
species.read.read_object module¶
Module with reading functionalities for data from individual objects.
- class species.read.read_object.ReadObject(object_name: str)[source]¶
Bases:
object
Class for reading data from an individual object from the database.
- Parameters
object_name (str) – Object name as stored in the database (e.g. ‘beta Pic b’, ‘PZ Tel B’).
- Returns
None
- Return type
NoneType
- get_absmag(filter_name: str) Union[Tuple[float, Optional[float]], Tuple[numpy.ndarray, Optional[numpy.ndarray]]] [source]¶
Function for calculating the absolute magnitudes of the object from the apparent magnitudes and distance. The errors on the apparent magnitude and distance are propagated into an error on the absolute magnitude.
- Parameters
filter_name (str) – Filter name.
- Returns
float, np.ndarray – Absolute magnitude.
float, np.ndarray – Error on the absolute magnitude.
- get_distance() Tuple[float, float] [source]¶
Function for reading the distance to the object.
- Returns
float – Distance (pc).
float – Uncertainty (pc).
species.read.read_planck module¶
Module with reading functionalities for Planck spectra.
- class species.read.read_planck.ReadPlanck(wavel_range: Optional[Tuple[Union[float, numpy.float32], Union[float, numpy.float32]]] = None, filter_name: Optional[str] = None)[source]¶
Bases:
object
Class for reading a Planck spectrum.
- Parameters
wavel_range (tuple(float, float), None) – Wavelength range (um). A wavelength range of 0.1-1000 um is used if set to None. Not used if
filter_name
is notNone
.filter_name (str, None) – Filter name that is used for the wavelength range. The
wavel_range
is used if set toNone
.
- Returns
None
- Return type
NoneType
- static get_color_color(temperatures: numpy.ndarray, radius: float, filters_colors: Tuple[Tuple[str, str], Tuple[str, str]]) species.core.box.ColorColorBox [source]¶
Function for calculating two colors in the range of 100-10000 K.
- Parameters
temperatures (np.ndarray) – Temperatures (K) for which the colors are calculated.
radius (float) – Radius (Rjup).
filters_colors (tuple(tuple(str, str), tuple(str, str))) – Two tuples with the filter names for the colors.
- Returns
Box with the colors.
- Return type
- static get_color_magnitude(temperatures: numpy.ndarray, radius: float, filters_color: Tuple[str, str], filter_mag: str) species.core.box.ColorMagBox [source]¶
Function for calculating the colors and magnitudes in the range of 100-10000 K.
- Parameters
temperatures (np.ndarray) – Temperatures (K) for which the colors and magnitude are calculated.
radius (float) – Radius (Rjup).
filters_color (tuple(str, str)) – Filter names for the color.
filter_mag (str) – Filter name for the absolute magnitudes.
- Returns
Box with the colors and magnitudes.
- Return type
- get_flux(model_param: Dict[str, Union[float, List[float]]], synphot=None) Tuple[float, None] [source]¶
Function for calculating the average flux density for the
filter_name
.- Parameters
model_param (dict) – Dictionary with the ‘teff’ (K), ‘radius’ (Rjup), and ‘distance’ (pc).
synphot (species.analysis.photometry.SyntheticPhotometry, None) – Synthetic photometry object. The object is created if set to None.
- Returns
float – Average flux density (W m-2 um-1).
NoneType – None
- get_magnitude(model_param: Dict[str, Union[float, List[float]]], synphot=None) Tuple[Tuple[float, None], Tuple[float, None]] [source]¶
Function for calculating the magnitude for the
filter_name
.- Parameters
model_param (dict) – Dictionary with the ‘teff’ (K), ‘radius’ (Rjup), and ‘distance’ (pc).
synphot (species.analysis.photometry.SyntheticPhotometry, None) – Synthetic photometry object. The object is created if set to None.
- Returns
float – Apparent magnitude (mag).
float – Absolute magnitude (mag)
- get_spectrum(model_param: Dict[str, Union[float, List[float]]], spec_res: float, smooth: bool = False, wavel_resample: Optional[numpy.ndarray] = None) species.core.box.ModelBox [source]¶
Function for calculating a Planck spectrum or a combination of multiple Planck spectra. The spectrum is calculated at \(R = 500\). Afterwards, an optional smoothing and wavelength resampling can be applied.
- Parameters
model_param (dict) – Dictionary with the ‘teff’ (K), ‘radius’ (Rjup), and ‘distance’ (pc). The values of ‘teff’ and ‘radius’ can be a single float, or a list with floats for a combination of multiple Planck functions, e.g. {‘teff’: [1500., 1000.], ‘radius’: [1., 2.], ‘distance’: 10.}.
spec_res (float) – Spectral resolution that is used for smoothing the spectrum with a Gaussian kernel when
smooth=True
.smooth (bool) – If
True
, the spectrum is smoothed to the spectral resolution ofspec_res
.wavel_resample (np.ndarray, None) – Wavelength points (um) to which the spectrum will be resampled. The resampling is applied after the optional smoothing to
spec_res
whensmooth=True
.
- Returns
Box with the Planck spectrum.
- Return type
- static planck(wavel_points: numpy.ndarray, temperature: float, scaling: float) numpy.ndarray [source]¶
Internal function for calculating a Planck function.
- Parameters
wavel_points (np.ndarray) – Wavelength points (um).
temperature (float) – Temperature (K).
scaling (float) – Scaling parameter.
- Returns
Flux density (W m-2 um-1).
- Return type
np.ndarray
- static update_parameters(model_param: Dict[str, Union[float, List[float]]]) Dict[str, float] [source]¶
Internal function for updating the dictionary with model parameters.
- Parameters
model_param (dict) – Dictionary with the ‘teff’ (K), ‘radius’ (Rjup), and ‘distance’ (pc). The values of ‘teff’ and ‘radius’ can be a single float, or a list with floats for a combination of multiple Planck functions, e.g. {‘teff’: [1500., 1000.], ‘radius’: [1., 2.], ‘distance’: 10.}.
- Returns
Updated dictionary with model parameters.
- Return type
dict
species.read.read_radtrans module¶
Module for generating atmospheric model spectra with petitRADTRANS
. Details on the
radiative transfer code can be found in Mollière et al. (2019).
- class species.read.read_radtrans.ReadRadtrans(line_species: Optional[List[str]] = None, cloud_species: Optional[List[str]] = None, scattering: bool = False, wavel_range: Optional[Tuple[float, float]] = None, filter_name: Optional[str] = None, pressure_grid: str = 'smaller', res_mode: str = 'c-k', cloud_wavel: Optional[Tuple[float, float]] = None)[source]¶
Bases:
object
Class for generating a model spectrum with
petitRADTRANS
.- Parameters
line_species (list, None) – List with the line species. No line species are used if set to
None
.cloud_species (list, None) – List with the cloud species. No clouds are used if set to
None
.scattering (bool) – Include scattering in the radiative transfer.
wavel_range (tuple(float, float), None) – Wavelength range (um). The wavelength range is set to 0.8-10 um if set to
None
or not used iffilter_name
is notNone
.filter_name (str, None) – Filter name that is used for the wavelength range. The
wavel_range
is used if ‘’filter_name`` is set toNone
.pressure_grid (str) – The type of pressure grid that is used for the radiative transfer. Either ‘standard’, to use 180 layers both for the atmospheric structure (e.g. when interpolating the abundances) and 180 layers with the radiative transfer, or ‘smaller’ to use 60 (instead of 180) with the radiative transfer, or ‘clouds’ to start with 1440 layers but resample to ~100 layers (depending on the number of cloud species) with a refinement around the cloud decks. For cloudless atmospheres it is recommended to use ‘smaller’, which runs faster than ‘standard’ and provides sufficient accuracy. For cloudy atmosphere, one can test with ‘smaller’ but it is recommended to use ‘clouds’ for improved accuracy fluxes.
res_mode (str) – Resolution mode (‘c-k’ or ‘lbl’). The low-resolution mode (‘c-k’) calculates the spectrum with the correlated-k assumption at \(\lambda/\Delta \lambda = 1000\). The high-resolution mode (‘lbl’) calculates the spectrum with a line-by-line treatment at \(\lambda/\Delta \lambda = 10^6\).
cloud_wavel (tuple(float, float), None) – Tuple with the wavelength range (um) that is used for calculating the median optical depth of the clouds at the gas-only photosphere and then scaling the cloud optical depth to the value of
log_tau_cloud
. The range ofcloud_wavel
should be encompassed by the range ofwavel_range
. The full wavelength range (i.e.wavel_range
) is used if the argument is set toNone
.
- Returns
None
- Return type
NoneType
- get_flux(model_param: Dict[str, float]) Tuple[float, None] [source]¶
Function for calculating the average flux density for the
filter_name
.- Parameters
model_param (dict) – Dictionary with the model parameters and values.
- Returns
float – Flux (W m-2 um-1).
NoneType – Error (W m-2 um-1). Always set to
None
.
- get_model(model_param: Dict[str, float], quenching: Optional[str] = None, spec_res: Optional[float] = None, wavel_resample: Optional[numpy.ndarray] = None, plot_contribution: Optional[str] = None) species.core.box.ModelBox [source]¶
Function for calculating a model spectrum with
petitRADTRANS
.- Parameters
model_param (dict) – Dictionary with the model parameters and values.
quenching (str, None) – Quenching type for CO/CH4/H2O abundances. Either the quenching pressure (bar) is a free parameter (
quenching='pressure'
) or the quenching pressure is calculated from the mixing and chemical timescales (quenching='diffusion'
). The quenching is not applied if the argument is set toNone
.spec_res (float, None) – Spectral resolution, achieved by smoothing with a Gaussian kernel. No smoothing is applied when the argument is set to
None
.wavel_resample (np.ndarray, None) – Wavelength points (um) to which the spectrum will be resampled. The original wavelengths points will be used if the argument is set to
None
.plot_contribution (str, None) – Filename for the plot with the emission contribution. The plot is not created if the argument is set to
None
.
- Returns
Box with the petitRADTRANS model spectrum.
- Return type
species.read.read_spectrum module¶
Module with reading functionalities for spectral libraries.
- class species.read.read_spectrum.ReadSpectrum(spec_library: str, filter_name: str = None)[source]¶
Bases:
object
Class for reading spectral library data from the database.
- Parameters
spec_library (str) – Name of the spectral library (‘irtf’, ‘spex’) or other type of spectrum (‘vega’).
filter_name (str, None) – Filter name for the wavelength range. Full spectra are read if set to
None
.
- Returns
None
- Return type
NoneType
- get_flux(sptypes: List[str] = None) species.core.box.PhotometryBox [source]¶
Function for calculating the average flux density for the
filter_name
.- Parameters
sptypes (list(str), None) – Spectral types to select from a library. The spectral types should be indicated with two characters (e.g. ‘M5’, ‘L2’, ‘T3’). All spectra are selected if set to
None
.- Returns
Box with the synthetic photometry.
- Return type
- get_magnitude(sptypes: List[str] = None) species.core.box.PhotometryBox [source]¶
Function for calculating the apparent magnitude for the
filter_name
.- Parameters
sptypes (list(str)) – Spectral types to select from a library. The spectral types should be indicated with two characters (e.g. ‘M5’, ‘L2’, ‘T3’). All spectra are selected if set to
None
.- Returns
Box with the synthetic photometry.
- Return type
- get_spectrum(sptypes: List[str] = None, exclude_nan: bool = True) species.core.box.SpectrumBox [source]¶
Function for selecting spectra from the database.
- Parameters
sptypes (list(str), None) – Spectral types to select from a library. The spectral types should be indicated with two characters (e.g. ‘M5’, ‘L2’, ‘T3’). All spectra are selected if set to
None
. For each object in thespec_library
, the requestedsptypes
are first compared with the optical spectral type and, if not available, secondly the near-infrared spectral type.exclude_nan (bool) – Exclude wavelength points for which the flux is NaN.
- Returns
Box with the spectra.
- Return type