species.read package

Contents

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: str | None = 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: Dict[str, float] | None = 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: Dict[str, float] | None = None, distance: Tuple[float, float] | None = None) Tuple[Tuple[float, float | None], Tuple[float | None, float | None]][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: Dict[str, float] | None = None, apply_mask: bool = False, wavel_sampling: float | None = None, extrapolate: bool = False, min_wavelength: float | None = None) 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.

  • wavel_sampling (float, None) – Wavelength sampling \(\lambda/\Delta\lambda\). The 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:

species.core.box.SpectrumBox

resample_spectrum(wavel_points: ndarray, model_param: Dict[str, float] | None = None, spec_res: float | None = None, apply_mask: bool = False, interp_highres: bool = False) 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 of model_param is set to None.

  • 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 to spectra with a constant spectral resolution (which is the case for all model spectra that are supported by species) or a constant wavelength spacing. The first smoothing approach is fastest.

  • apply_mask (bool) – Exclude negative values and NaNs.

  • interp_highres (bool) – Oversample the spectrum to $R = 10000$, such that the spec_res parameter can be applied on a spectrum with constant $lambda/Deltalambda$. The uncertainties are crudely propagated with an interpolation as well and should only be considered as estimate.

Returns:

Box with the resampled spectrum.

Return type:

species.core.box.SpectrumBox

species.read.read_color module#

Module with reading functionalities of color and magnitude data from photometric and libraries.

class species.read.read_color.ReadColorColor(library: str, filters_colors: Tuple[Tuple[str, str], Tuple[str, str]])[source]#

Bases: object

Class for reading color-color data from the database.

Parameters:
  • library (str) – Photometric (‘vlm-plx’ or ‘leggett’) or spectral (‘irtf’ or ‘spex’) library.

  • filters_colors (tuple(tuple(str, str), tuple(str, str))) – Filter names for the colors. For a photometric library, these have to be present in the database (typically in the MKO, 2MASS, or WISE system). For a spectral library, any filter names can be provided as long as they overlap with the wavelength range of the spectra.

Returns:

None

Return type:

NoneType

get_color_color(object_type: str | None = None) ColorColorBox[source]#

Function for extracting color-color data from the selected library.

Parameters:

object_type (str, None) – Object type for which the colors and magnitudes are extracted. Either field dwarfs (‘field’) or young/low-gravity objects (‘young’). All objects are selected if set to None.

Returns:

Box with the colors.

Return type:

species.core.box.ColorColorBox

class species.read.read_color.ReadColorMagnitude(library: str, filters_color: Tuple[str, str], filter_mag: str)[source]#

Bases: object

Class for reading color-magnitude data from the database.

Parameters:
  • library (str) – Photometric (‘vlm-plx’ or ‘leggett’) or spectral (‘irtf’ or ‘spex’) library.

  • filters_color (tuple(str, str)) – Filter names for the color. For a photometric library, these have to be present in the database (typically in the MKO, 2MASS, or WISE system). For a spectral library, any filter names can be provided as long as they overlap with the wavelength range of the spectra.

  • filter_mag (str) – Filter name for the absolute magnitudes (see also description of filters_color).

Returns:

None

Return type:

NoneType

get_color_magnitude(object_type: str | None = None) ColorMagBox[source]#

Function for extracting color-magnitude data from the selected library.

Parameters:

object_type (str, None) – Object type for which the colors and magnitudes are extracted. Either field dwarfs (‘field’) or young/low-gravity objects (‘young’). All objects are selected if set to None.

Returns:

Box with the colors and magnitudes.

Return type:

species.core.box.ColorMagBox

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_wavelength() float32 | float64[source]#

Calculate the effective wavelength of the filter profile. The effective wavelength is calculated as the weighted average based on the filter profile and the spectrum of Vega.

Returns:

Effective wavelength (\(\mu\mathrm{m}\)).

Return type:

float

effective_width() 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 (\(\mu\mathrm{m}\)).

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 (\(\mu\mathrm{m}\)).

Return type:

float

get_filter() ndarray[source]#

Select a filter profile from the database.

Returns:

Array with the wavelengths and filter transmission. The array has 2 dimensions with the shape (n_wavelengths, 2).

Return type:

np.ndarray

interpolate_filter() interp1d[source]#

Interpolate a filter profile with the interp1d function from scipy.interpolate and linear kind of interpolation.

Returns:

Linearly interpolated filter profile.

Return type:

scipy.interpolate.interp1d

mean_wavelength() float32 | float64[source]#

Calculate the weighted mean wavelength of the filter profile.

Returns:

Mean wavelength (\(\mu\mathrm{m}\)).

Return type:

float

wavelength_range() Tuple[float32 | float64, float32 | float64][source]#

Extract the wavelength range of the filter profile.

Returns:

  • float – Minimum wavelength (\(\mu\mathrm{m}\)).

  • float – Maximum wavelength (\(\mu\mathrm{m}\)).

species.read.read_isochrone module#

Module with reading functionalities for isochrones and cooling curves.

class species.read.read_isochrone.ReadIsochrone(tag: str | None = None, create_regular_grid: bool = False, extrapolate: bool = False)[source]#

Bases: object

Class for reading isochrone data from the database. This class interpolates the evolutionary track or isochrone data. Please carefully check for interpolation effects. Setting masses=None in get_isochrone() extracts the isochrones at the masses of the original grid, so using that option helps with comparing results for which the masses have been interpolated. Similarly, by setting ages=None with the get_isochrone() method will fix the ages to those of the original grid.

Parameters:
  • tag (str, None) – Database tag of the isochrone data (e.g. ‘ames-cond’, ‘sonora+0.0’, ‘atmo-ceq’). A list with the isochrone data that are stored in the current species database is printed if the argument of tag is set to None.

  • create_regular_grid (bool) – Evolutionary grids can be irregular in the (age, mass) space. By setting create_regular_grid=True, the grid will be interpolated and extrapolate onto a regular grid that is based on all the unique age and mass values of the original grid. The resampling of the evolutionary parameters (i.e. \(T_\mathrm{eff}\) (K), \(\log{(L/L_\odot)}\), \(\log{(g)}\), and \(R\)) is done as function of mass, separately for each age. Setting create_regular_grid=True can be helpful if some values are missing at the edge of the grid. However, please carefully check results since there might be inaccuracies in the extrapolated parts of the parameter space, in particular for the cooling curves extracted with get_cooling_curve().

  • extrapolate (str) – DEPRECATED: This parameter has been renamed to create_regular_grid and will be removed in a future release. Please use the create_regular_grid parameter instead.

Returns:

None

Return type:

NoneType

contrast_to_mass(age: float, distance: float, filter_name: str, star_mag: float, contrast: List[float] | ndarray, use_mag: bool = True, atmospheric_model: str | None = None, extra_param: Dict[str, float] | None = None, calc_phot: bool = False) ndarray[source]#

Function for converting contrast values into masses. This can be used to convert a list/array with detection limits of companions into mass limits. Either one of the available filter names from the isochrone grid can be selected (i.e. the filters returned by get_filters()), or any of the filters from the SVO Filter Profile Service. For the first case, the magnitudes will be directly interpolated from the grid of evolution data. For the second case, the associated model spectra will be used for calculating synthetic photometry for the isochrone age and selected filter. These will then be interpolated to the requested contrast values. The atmospheric model that is associated with the evolutionary model is by default automatically selected and added to the database if needed.

Parameters:
  • age (float) – Age (Myr) at which the bulk parameters will be interpolated from the grid with evolutionary data.

  • distance (float) – Distance (pc) that is used for scaling the fluxes from the atmosphere to the observer.

  • filter_name (str) –

    Filter name for which the magnitudes will be interpolated, either directly from the isochrone grid or by calculating synthetic photometry from the associated model spectra. The first case only works for the filters that are returned by the get_filters() method of ReadIsochrone because these will have pre-calculated magnitudes. The second case will work for any of the filter names from the SVO Filter Profile Service. This will require more disk space and a bit more computation time.

  • star_mag (float) – Stellar apparent magnitude for the filter that is set as argument of filter_name.

  • contrast (list(float), np.ndarray) – List or array with the contrast values between a companion and the star. The magnitude of the star should be provided as argument of star_mag. The contrast values will be converted into masses, while taking into account the stellar magnitude. The values should be provided either as ratio (e.g. [1e-2, 1e-3, 1e-4]) or as magnitudes (e.g. [5.0, 7.5, 10.0]). For ratios, it is important to set use_mag=False.

  • use_mag (bool) – Set to True if the values of contrast are given as magnitudes. Set to False if the values of contrast are given as ratios. The default is set to True.

  • atmospheric_model (str, None) – Atmospheric model used to compute the synthetic photometry in case the filter_name is set to a value from the SVO Filter Profile Service. The argument can be set to None such that the correct atmospheric model is automatically selected that is associated with the evolutionary model. If the user nonetheless wants to test a non-self-consistent approach by using a different atmospheric model, then the argument can be set to any of the models that can be added with add_model().

  • extra_param (dict, None) – Optional dictionary with additional parameters that are required for the atmospheric model but are not part of the evolutionary model grid, for example because they were implicitly set by the evolution model (e.g. solar metallicity). In case additional parameters are required for the atmospheric model but they are not provided in extra_param then a manual input will be requested when running the get_photometry method. Typically the extra_param parameter is not needed so the argument can be set to None. It will only be required if a non-self-consistent approach will be tested, that is, the calculation of synthetic photometry from an atmospheric model that is not associated with the evolutionary model.

  • calc_phot (bool) – Calculate synthetic photometry from the model spectra regardless if pre-calculated magnitudes for the filter_name are already available with the isochrone data. Typically the argument can be set to False, but to force the calculation of synthetic photometry the argument can be set to True.

Returns:

Array with the masses (in \(M_\mathrm{J}\)) for the requested contrast values.

Return type:

np.ndarray

get_color_color(age: float, masses: ndarray | None, filters_colors: Tuple[Tuple[str, str], Tuple[str, str]], atmospheric_model: str | None = None, extra_param: Dict[str, float] | None = None) ColorColorBox[source]#

Function for calculating color-color pairs from a selected isochrone. The function selects the corresponding atmosphere model and computes synthetic photometry by interpolating and integrating the spectra for any given filters.

Parameters:
  • age (float) – Age (Myr) at which the isochrone data is interpolated.

  • masses (np.ndarray, None) – Masses (\(M_\mathrm{J}\)) at which the isochrone data is interpolated. The masses at the nearest age in the grid with evolutionary data are selected if the argument is set to None.

  • 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.

  • atmospheric_model (str, None) – Atmospheric model used to compute the synthetic photometry. The argument can be set to None such that the correct atmospheric model is automatically selected that is associated with the evolutionary model. If the user nonetheless wants to test a non-self-consistent approach by using a different atmospheric model, then the argument can be set to any of the models that can be added with add_model().

  • extra_param (dict, None) – Optional dictionary with additional parameters that are required for the atmospheric model but are not part of the evolutionary model grid. In case additional parameters are required for the atmospheric model but they are not provided in extra_param then a manual input will be requested when running the get_photometry method. Typically the extra_param parameter is not needed so the argument can be set to None. It will only be required if a non-self-consistent approach will be tested, that is, the calculation of synthetic photometry from an atmospheric model that is not associated with the evolutionary model.

Returns:

Box with the color-color data.

Return type:

species.core.box.ColorColorBox

get_color_magnitude(age: float, masses: ndarray | None, filters_color: Tuple[str, str], filter_mag: str, adapt_logg: bool = False, atmospheric_model: str | None = None, extra_param: Dict[str, float] | None = None) ColorMagBox[source]#

Function for calculating color-magnitude pairs from a selected isochrone. The function selects the corresponding atmosphere model and computes synthetic photometry by interpolating and integrating the spectra for any given filters.

Parameters:
  • age (float) – Age (Myr) at which the isochrone data is interpolated.

  • masses (np.ndarray, None) – Masses (\(M_\mathrm{J}\)) at which the isochrone data is interpolated. The masses at the nearest age in the grid with evolutionary data are selected if the argument is set to None.

  • 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.

  • atmospheric_model (str, None) – Atmospheric model used to compute the synthetic photometry. The argument can be set to None such that the correct atmospheric model is automatically selected that is associated with the evolutionary model. If the user nonetheless wants to test a non-self-consistent approach by using a different atmospheric model, then the argument can be set to any of the models that can be added with add_model().

  • extra_param (dict, None) – Optional dictionary with additional parameters that are required for the atmospheric model but are not part of the evolutionary model grid. In case additional parameters are required for the atmospheric model but they are not provided in extra_param then a manual input will be requested when running the get_photometry method. Typically the extra_param parameter is not needed so the argument can be set to None. It will only be required if a non-self-consistent approach will be tested, that is, the calculation of synthetic photometry from an atmospheric model that is not associated with the evolutionary model.

Returns:

Box with the color-magnitude data.

Return type:

species.core.box.ColorMagBox

get_cooling_curve(mass: float, ages: ndarray | None = None, filter_mag: str | None = None, filters_color: Tuple[str, str] | None = None) CoolingBox[source]#

Function for interpolating a cooling curve.

Parameters:
  • mass (float) – Mass (\(M_\mathrm{J}\)) for which the cooling curve will be interpolated.

  • ages (np.ndarray, None) – Ages (Myr) at which the cooling curve will be interpolated. The ages are not interpolated if the argument is set to None, in which case the age sampling from the evolutionary data is used.

  • 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.

  • 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.

Returns:

Box with the cooling curve.

Return type:

species.core.box.CoolingBox

get_filters() List[str] | None[source]#

Function for get a list with filter names for which there are are magnitudes stored with the isochrone data.

Returns:

List with filter names. A None is returned if there are no filters and magnitudes stored with the isochrone data.

Return type:

list(str), None

get_isochrone(age: float, masses: ndarray | None = None, filter_mag: str | None = None, filters_color: Tuple[str, str] | None = None) IsochroneBox[source]#

Function for interpolating an isochrone.

Parameters:
  • age (float) – Age (Myr) at which the isochrone data is interpolated.

  • masses (np.ndarray, None) – Masses (\(M_\mathrm{J}\)) at which the isochrone data is interpolated. The masses are not interpolated if the argument is set to None, in which case the mass sampling from the evolutionary data is used.

  • 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.

  • 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.

Returns:

Box with the isochrone.

Return type:

species.core.box.IsochroneBox

get_mass(age: float, log_lum: ndarray) ndarray[source]#

Function for interpolating a mass for a given age and array with bolometric luminosities.

Parameters:
  • age (float) – Age (Myr) at which the masses will be interpolated.

  • log_lum (np.ndarray) – Array with the bolometric luminosities, \(\log{(L/L_\odot)}\), for which the masses will be interpolated.

Returns:

Array with masses (\(M_\mathrm{J}\)).

Return type:

np.ndarray

get_photometry(age: float, mass: float, distance: float, filter_name: str, atmospheric_model: str | None = None, extra_param: Dict[str, float] | None = None) PhotometryBox[source]#

Function for computing synthetic photometry by interpolating and integrating the associated spectra. Bulk and atmosphere parameters are interpolated from the evolutionary data for the requested age and mass. The output from the evolutionary data is then used as input for the atmospheric model. This function is useful if the required magnitudes or fluxes are not part of the available filters of the evolutionary data (i.e. the filters returned by get_filters()). The atmospheric model that is associated with the evolutionary model is by default automatically selected and added to the database if needed.

Parameters:
  • age (float) – Age (Myr) at which the bulk parameters will be interpolated from the grid with evolutionary data.

  • mass (float) – Mass (\(M_\mathrm{J}\)) at which the bulk parameters will be interpolated from the grid with evolutionary data.

  • distance (float) – Distance (pc) that is used for scaling the fluxes from the atmosphere to the observer.

  • filter_name (tuple(str, str), None) –

    Filter name for which the synthetic photometry will be computed. Any filter name from the SVO Filter Profile Service can be used as argument.

  • atmospheric_model (str, None) – Atmospheric model used to compute the synthetic photometry. The argument can be set to None such that the correct atmospheric model is automatically selected that is associated with the evolutionary model. If the user nonetheless wants to test a non-self-consistent approach by using a different atmospheric model, then the argument can be set to any of the models that can be added with add_model().

  • extra_param (dict, None) – Optional dictionary with additional parameters that are required for the atmospheric model but are not part of the evolutionary model grid. In case additional parameters are required for the atmospheric model but they are not provided in extra_param then a manual input will be requested when running the get_photometry method. Typically the extra_param parameter is not needed so the argument can be set to None. It will only be required if a non-self-consistent approach will be tested, that is, the calculation of synthetic photometry from an atmospheric model that is not associated with the evolutionary model.

Returns:

Box with the synthetic photometry (magnitude and flux).

Return type:

species.core.box.PhotometryBox

get_radius(age: float, log_lum: ndarray) ndarray[source]#

Function for interpolating a radius for a given age and array with bolometric luminosities.

Parameters:
  • age (float) – Age (Myr) at which the masses will be interpolated.

  • log_lum (np.ndarray) – Array with the bolometric luminosities, \(\log{(L/L_\odot)}\), for which the masses will be interpolated.

Returns:

Array with radii (\(R_\mathrm{J}\)).

Return type:

np.ndarray

get_spectrum(age: float, mass: float, distance: float, wavel_range: Tuple[float, float] | None = None, spec_res: float | None = None, atmospheric_model: str | None = None, extra_param: Dict[str, float] | None = None) ModelBox[source]#

Function for interpolating the model spectrum at a specified age and mass. Bulk and atmosphere parameters are interpolated from the evolutionary data for the requested age and mass. The output from the evolutionary data is then used as input for the atmospheric model. The atmospheric model that is associated with the evolutionary model is by default automatically selected and added to the database if needed.

Parameters:
  • age (float) – Age (Myr) at which the bulk parameters will be interpolated from the grid with evolutionary data.

  • mass (float) – Mass (\(M_\mathrm{J}\)) at which the bulk parameters will be interpolated from the grid with evolutionary data.

  • distance (float) – Distance (pc) that is used for scaling the fluxes from the atmosphere to the observer.

  • wavel_range (tuple(float, float), None) – Wavelength range (um). Full spectrum is selected if the argument is set to None.

  • spec_res (float, None) – Spectral resolution that is used for smoothing the spectrum with a Gaussian kernel. No smoothing is applied when the argument is set to None.

  • atmospheric_model (str, None) – Atmospheric model used to compute the synthetic photometry. The argument can be set to None such that the correct atmospheric model is automatically selected that is associated with the evolutionary model. If the user nonetheless wants to test a non-self-consistent approach by using a different atmospheric model, then the argument can be set to any of the models that can be added with add_model().

  • extra_param (dict, None) – Optional dictionary with additional parameters that are required for the atmospheric model but are not part of the evolutionary model grid. In case additional parameters are required for the atmospheric model but they are not provided in extra_param then a manual input will be requested when running the get_photometry method. Typically the extra_param parameter is not needed so the argument can be set to None. It will only be required if a non-self-consistent approach will be tested, that is, the calculation of synthetic photometry from an atmospheric model that is not associated with the evolutionary model.

Returns:

Box with the model spectrum.

Return type:

species.core.box.ModelBox

grid_points() Dict[str, ndarray][source]#

Function for returning a dictionary with the unique grid points of the parameters of the evolutionary data. The grid may not be regularly sampled unless create_regular_grid=True.

Returns:

Dictionary with the parameter names and the arrays with the unique values in the grid of evolutionary data.

Return type:

dict(str, np.array)

species.read.read_model module#

Module with reading functionalities for atmospheric model spectra.

class species.read.read_model.ReadModel(model: str, wavel_range: Tuple[float, float] | None = None, filter_name: str | None = 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 if filter_name is not None.

  • filter_name (str, None) – Filter name that is used for the wavelength range. The wavel_range is used if set to None.

Returns:

None

Return type:

NoneType

static apply_ext_ism(wavelengths: ndarray, flux: ndarray, v_band_ext: float, v_band_red: float) Tuple[ndarray, 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:

  • np.ndarray – Fluxes (W m-2 um-1) with the extinction applied.

  • np.ndarray – Extinction (mag) as function of wavelength.

apply_lognorm_ext(wavelength: ndarray, flux: ndarray, radius_interp: float, sigma_interp: float, v_band_ext: float) 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

apply_powerlaw_ext(wavelength: ndarray, flux: ndarray, r_max_interp: float, exp_interp: float, v_band_ext: float) 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

binary_spectrum(model_param: Dict[str, float], spec_res: float | None = None, wavel_resample: ndarray | None = None, **kwargs) ModelBox[source]#

Function for extracting a model spectrum of a binary system. A weighted combination of two spectra will be returned. The model_param dictionary should contain the parameters for both components (e.g. teff_0 and teff_1, instead of teff). Apart from that, the same parameters are used as with get_model().

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. No smoothing is applied if the argument is set to None.

  • 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 to None.

Returns:

Box with the model spectrum.

Return type:

species.core.box.ModelBox

create_color_color(model_param: Dict[str, float], filters_colors: Tuple[Tuple[str, str], Tuple[str, str]]) ColorColorBox[source]#

Function for creating a ColorColorBox for a given set of filter names and model parameters. The effective temperature, \(T_\mathrm{eff}\), is varied such that the returned ColorColorBox contains the colors as function of \(T_\mathrm{eff}\) and can be provide as input to the plot_color_color() function.

Parameters:
  • model_param (dict) – Dictionary with the model parameters and values. The values should be within the boundaries of the grid. The boundaries of the model grid can be inspected by using the get_bounds() method. The effective temperature, \(T_\mathrm{eff}\), does not need to be included in the dictionary since it is varied. The values of \(T_\mathrm{eff}\) are set to the grid points. The grid points can be inspected with the get_points() method.

  • filters_colors (tuple(tuple(str, str), tuple(str, str))) –

    Filter names that are used for the two colors. Any of the filter names from the SVO Filter Profile Service are compatible.

Returns:

Box with the colors.

Return type:

species.core.box.ColorColorBox

create_color_magnitude(model_param: Dict[str, float], filters_color: Tuple[str, str], filter_mag: str) ColorMagBox[source]#

Function for creating a ColorMagBox for a given set of filter names and model parameters. The effective temperature, \(T_\mathrm{eff}\), is varied such that the returned ColorMagBox contains the colors as function of \(T_\mathrm{eff}\) and can be provide as input to the plot_color_magnitude() function.

Parameters:
  • model_param (dict) – Dictionary with the model parameters and values. The values should be within the boundaries of the grid. The boundaries of the model grid can be inspected by using the get_bounds() method. The effective temperature, \(T_\mathrm{eff}\), does not need to be included in the dictionary since it is varied. The values of \(T_\mathrm{eff}\) are set to the grid points. The grid points can be inspected with the get_points() method.

  • filters_color (tuple(str, str)) –

    Filter names that are used for the color. Any of the filter names from the SVO Filter Profile Service are compatible.

  • filter_mag (str) –

    Filter name that is used for the magnitude. Any of the filter names from the SVO Filter Profile Service are compatible.

Returns:

Box with the colors and magnitudes.

Return type:

species.core.box.ColorMagBox

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: float | None = None, wavel_resample: ndarray | None = None, ext_filter: str | None = None) 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 to None.

  • ext_filter (str, None) –

    Filter that is associated with the (optional) extinction parameter, ism_ext. When the argument of ext_filter is set to None, the extinction is defined in the visual as usual (i.e. \(A_V\)). By providing a filter name from the SVO Filter Profile Service as argument then the extinction ism_ext is defined in that filter instead of the $V$ band.

Returns:

Box with the model spectrum.

Return type:

species.core.box.ModelBox

get_flux(model_param: Dict[str, float], synphot=None, return_box: bool = False) Tuple[float | None, float | None] | PhotometryBox[source]#

Function for calculating the average flux density for the filter_name.

Parameters:
  • model_param (dict) – Model parameters and values.

  • synphot (SyntheticPhotometry, None) – Synthetic photometry object. The object is created if set to None.

  • return_box (bool) – Return a PhotometryBox if set to True or return the two values that are specified below if set to False. By default, the argument is set to False. The advantage of returning the output in a PhotometryBox is that it can directly be provided as input to plot_spectrum().

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], return_box: bool = False) Tuple[float | None, float | None] | PhotometryBox[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), and parallax (mas) or distance (pc) are required for the apparent magnitude (i.e. to scale the flux from the planet to the observer). Only a radius is required for the absolute magnitude.

  • return_box (bool) – Return a PhotometryBox if set to True or return the two values that are specified below if set to False. By default, the argument is set to False. The advantage of returning the output in a PhotometryBox is that it can directly be provided as input to plot_spectrum().

Returns:

  • float – Apparent magnitude. A None is returned if the dictionary of model_param does not contain a radius, and parallax or distance.

  • float, None – Absolute magnitude. A None is returned if the dictionary of model_param does not contain a radius.

get_model(model_param: Dict[str, float], spec_res: float | None = None, wavel_resample: ndarray | None = None, magnitude: bool = False, fast_rot_broad: bool = True, ext_filter: str | None = None, **kwargs) 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. No smoothing is applied if the argument is set to None.

  • wavel_resample (np.ndarray, None) – Wavelength points (um) to which the spectrum is resampled. Optional smoothin with spec_res is applied for resampling with wavel_resample. The wavelength points as stored in the database are used if the argument is set to None.

  • magnitude (bool) – Normalize the spectrum with a flux calibrated spectrum of Vega and return the magnitude instead of flux density.

  • fast_rot_broad (bool) – Apply fast algorithm for the rotational broadening if set to True, otherwise a slow but more accurate broadening is applied if set to False. The fast algorithm will only provide an accurate broadening if the wavelength range of the spectrum is somewhat narrow (e.g. only the \(K\) band). The argument is only used if the vsini parameter is included in the model_param dictionary.

  • ext_filter (str, None) –

    Filter that is associated with the (optional) extinction parameter, ism_ext. When the argument of ext_filter is set to None, the extinction is defined in the visual as usual (i.e. \(A_V\)). By providing a filter name from the SVO Filter Profile Service as argument then the extinction ism_ext is defined in that filter instead of the $V$ band.

Returns:

Box with the model spectrum.

Return type:

species.core.box.ModelBox

get_parameters() List[str][source]#

Function for extracting the parameter names.

Returns:

Model parameters.

Return type:

list(str)

get_points() Dict[str, ndarray][source]#

Function for extracting the grid points.

Returns:

Parameter points of the model grid.

Return type:

dict

get_sampling() float[source]#

Function for returning the wavelength sampling, \(\lambda/\Delta\lambda\), of the model spectra as stored in the database.

Returns:

Wavelength sampling, \(\lambda/\Delta\lambda\).

Return type:

float

get_wavelengths() ndarray[source]#

Function for extracting the wavelength points.

Returns:

Wavelength points (um).

Return type:

np.ndarray

integrate_spectrum(model_param: Dict[str, float]) float[source]#

Function for calculating the bolometric flux by integrating a model spectrum at the requested parameters. In principle, the calculated luminosity should be approximately the same as the value that can be calculated directly from the \(T_\mathrm{eff}\) and radius parameters, unless the atmospheric model had not properly converged.

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().

Returns:

Bolometric luminosity (\(\log{(L/L_\odot)}\)).

Return type:

float

interpolate_grid(wavel_resample: ndarray | None = None, spec_res: float | None = None, **kwargs) 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 to None.

spec_resfloat, None

Spectral resolution that is used for the Gaussian filter. No smoothing is applied if the argument is set to None.

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() File[source]#

Internal function for opening the HDF5 database.

Returns:

The HDF5 database.

Return type:

h5py._hl.files.File

wavelength_points() Tuple[ndarray, ndarray][source]#

Internal function for extracting the wavelength points and indices that are used.

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) Tuple[float, float | None] | Tuple[ndarray, ndarray | None][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 as stored in the database.

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).

get_parallax() Tuple[float, float][source]#

Function for reading the parallax of the object.

Returns:

  • float – Parallax (mas).

  • float – Uncertainty (mas).

get_photometry(filter_name: str) ndarray[source]#

Function for reading photometric data of the object for a specified filter name.

Parameters:

filter_name (str) – Filter name as stored in the database. The list_filters() method can be used for listing the filter names for which photometric data of the object is available.

Returns:

Apparent magnitude, magnitude error (error), flux (W m-2 um-1), flux error (W m-2 um-1).

Return type:

np.ndarray

get_spectrum() dict[source]#

Function for reading the spectra and covariance matrices of the object.

Returns:

Dictionary with spectra and covariance matrices.

Return type:

dict

list_filters(verbose=True) List[str][source]#

Function for listing and returning the filter profile names for which there is photometric data stored in the database.

Parameters:

verbose (bool) – Print the filter names if set to True.

Returns:

List with names of the filter profiles.

Return type:

list(str)

species.read.read_planck module#

Module with reading functionalities for Planck spectra.

class species.read.read_planck.ReadPlanck(wavel_range: Tuple[float | float32, float | float32] | None = None, filter_name: str | None = 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 not set to None.

  • filter_name (str, None) – Filter name that is used for the wavelength range. The wavel_range is used if set to None.

Returns:

None

Return type:

NoneType

static get_color_color(temperatures: ndarray, radius: float, filters_colors: Tuple[Tuple[str, str], Tuple[str, str]]) 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:

species.core.box.ColorColorBox

static get_color_magnitude(temperatures: ndarray, radius: float, filters_color: Tuple[str, str], filter_mag: str) 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:

species.core.box.ColorMagBox

get_flux(model_param: Dict[str, 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 ‘parallax’ (mas) or ‘distance’ (pc).

  • synphot (SyntheticPhotometry, None) – Synthetic photometry object. The object is created if the argument is set to None.

Returns:

  • float – Average flux density (W m-2 um-1).

  • NoneType – None

get_magnitude(model_param: Dict[str, 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 ‘parallax’ (mas) or ‘distance’ (pc).

  • synphot (SyntheticPhotometry, None) – Synthetic photometry object. The object is created if the argument is set to None.

Returns:

  • float – Apparent magnitude (mag).

  • float – Absolute magnitude (mag)

get_spectrum(model_param: Dict[str, float | List[float]], spec_res: float | None = None, wavel_resample: ndarray | None = None, **kwargs) 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 ‘parallax’ (mas) or ‘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, None) – Spectral resolution that is used for smoothing the spectrum with a Gaussian kernel. No smoothing is applied if the argument is set to None.

  • wavel_resample (np.ndarray, None) – Wavelength points (\(\mu`m) to which the spectrum will be resampled. The resampling is applied after the optional smoothing to the value of ``spec_res`\).

Returns:

Box with the Planck spectrum.

Return type:

species.core.box.ModelBox

static planck(wavel_points: ndarray, temperature: float, scaling: float) 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, 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 ‘parallax’ (mas) or ‘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, atmospheric setup, and opacities can be found in Mollière et al. (2019).

class species.read.read_radtrans.ReadRadtrans(line_species: List[str] | None = None, cloud_species: List[str] | None = None, scattering: bool = False, wavel_range: Tuple[float, float] | None = None, filter_name: str | None = None, pressure_grid: str = 'smaller', res_mode: str = 'c-k', cloud_wavel: Tuple[float, float] | None = None, max_press: float | None = None, pt_manual: ndarray | None = None, lbl_opacity_sampling: int | int64 | None = 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 (\(\mu`m). The wavelength range is set to 0.8-10.0 :math:\)mu`m if set to None or not used if filter_name is not None.

  • filter_name (str, None) – Filter name that is used for the wavelength range. The wavel_range is used if filter_name is set to None.

  • 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 (\(\mu`m) 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 of cloud_wavel should be encompassed by the range of wavel_range. The full wavelength range (i.e. wavel_range) is used if the argument is set to None.

  • max_pressure (float, None) – Maximum pressure (bar) for the free temperature nodes. The default value is set to 1000 bar.

  • pt_manual (np.ndarray, None) – A 2D array that contains the P-T profile that is used when pressure_grid="manual". The shape of array should be (n_pressure, 2), with pressure (bar) as first column and temperature (K) as second column. It is recommended that the pressures are logarithmically spaced.

  • lbl_opacity_sampling (int, None) – This is the same parameter as in petitRADTRANS which is used with res_mode='lbl' to downsample the line-by-line opacities by selecting every lbl_opacity_sampling-th wavelength from the original sampling of \(\lambda/\Delta \lambda = 10^6\). Setting this parameter will lower the computation time. By setting the argument to None, the original sampling is used so no downsampling is applied.

Returns:

None

Return type:

NoneType

get_flux(model_param: Dict[str, float]) Tuple[float, None][source]#

Function for calculating the filter-weighted 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 – Uncertainty (W m-2 um-1). Always set to None.

get_magnitude(model_param: Dict[str, float]) Tuple[float, None][source]#

Function for calculating the magnitude for the filter_name.

Parameters:

model_param (dict) – Dictionary with the model parameters and values.

Returns:

  • float – Magnitude.

  • NoneType – Uncertainty. Always set to None.

get_model(model_param: Dict[str, float], quenching: str | None = None, spec_res: float | None = None, wavel_resample: ndarray | None = None, plot_contribution: bool | str | None = False, temp_nodes: int | integer | None = None) ModelBox[source]#

Function for calculating a model spectrum with radiative transfer code of petitRADTRANS.

Parameters:
  • model_param (dict) –

    Dictionary with the model parameters. Various parameterizations can be used for the pressure-temperature (P-T) profile, abundances (chemical equilibrium or free abundances), and the cloud properties. The type of parameterizations that will be used depend on the parameters provided in the dictionary of model_param. Below is an (incomplete) list of the supported parameters.

    Mandatory parameters:

    • The surface gravity, logg, should always be included. It is provided in cgs units as \(\log_{10}{g}\).

    Scaling parameters (optional):

    • The radius (\(R_\mathrm{J}\)), radius, and parallax (mas), parallax, are optional parameters that can be included for scaling the flux from the planet surface to the observer.

    • Instead of parallax, it is also possible to provided the distance (pc) with the distance parameter.

    Chemical abundances (mandatory – one of the options should be used):

    • Chemical equilibrium requires the metallicity, c_o_ratio parameters. Optionally, the log_p_quench (as \(\log_{10}P/\mathrm{bar}\)) can be included for setting a quench pressure for CO/CH$_4$/H$_2$O. If this last parameter is used, then the argument of quenching should be set to 'pressure'.

    • Free abundances requires the parameters that have the names from line_species and cloud_species. These will be used as \(\log_{10}\) mass fraction of the line and cloud species. For example, if line_species includes H2O_HITEMP then model_param should contain the H2O_HITEMP parameter. For a mass fraction of \(10^{-3}\) the dictionary value can be set to -3. Or, if cloud_species contains MgSiO3(c)_cd then model_param should contain the MgSiO3(c) parameter. So it is provided without the suffix, _cd, for the particle shape and structure.

    Pressure-temperature (P-T) profiles (mandatory – one of the options should be used):

    • Eddington approximation requires the tint and log_delta parameters.

    • Parametrization from Mollière et al (2020) that was used for HR 8799 e. It requires tint, alpa, log_delta, t1, t2, and t3 as parameters.

    • Arbitrary number of free temperature nodes requires parameters t0, t1, t2, etc. So counting from zero up to the number of nodes that are required. The nodes will be interpolated to a larger number of points in log-pressure space (set with the pressure_grid parameter) by using a cubic spline. Optionally, the pt_smooth parameter can also be included in model_param, which is used for smoothing the interpolated P-T profile with a Gaussian kernel in \(\log{P/\mathrm{bar}}\). A recommended value for the kernel is 0.3 dex, so pt_smooth=0.3.

    • Instead of a parametrization, it is also possible to provide a manual P-T profile as numpy array with the argument of pt_manual.

    Cloud models (optional – one of the options can be used):

    • Physical clouds as in Mollière et al (2020) require the parameters fsed, log_kzz, and sigma_lnorm. Cloud abundances are either specified relative to the equilibrium abundances (when using chemical equilibrium abundances for the line species) or as free abundances (when using free abundances for the line species). For the first case, the relative mass fractions are specified for example with the mgsio3_fraction parameter if the list with cloud_species contains MgSiO3(c)_cd.

    • With the physical clouds, instead of including the mass fraction with the _fraction parameters, it is also possible to enforce the clouds (to ensure an effect on the spectrum) by scaling the opacities with the log_tau_cloud parameter. This is the wavelength-averaged optical depth of the clouds down to the gas-only photosphere. The abundances are now specified relative to the first cloud species that is listed in cloud_species. The ratio parameters should be provided with the _ratio suffix. For example, if cloud_species=['MgSiO3(c)_cd', 'Fe(c)_cd', 'Al2O3(c)_cd'] then the fe_mgsio3_ratio and al2o3_mgsio3_ratio parameters are required.

    • Instead of a single sedimentation parameter, fsed, it is also possible to include two values, fsed_1 and fsed_2. This will calculate a weighted combination of two cloudy spectra, to mimic horizontal cloud variations. The weight should be provided with the f_clouds parameter (between 0 and 1) in the model_param dictionary.

    • Parametrized cloud opacities with a cloud absorption opacity, log_kappa_abs, and powerlaw index, opa_abs_index. Furthermore, log_p_base and fsed are required parameters. In addition to absorption, parametrized scattering opacities are added with the optional log_kappa_sca and opa_sca_index parameters. Optionally, the lambda_ray can be included, which is the wavelength at which the opacity changes to a \(\lambda^{-4}\) dependence in the Rayleigh regime. It is also possible to include log_tau_cloud, which can be used for enforcing clouds in the photospheric region by scaling the cloud opacities.

    • Parametrized cloud opacities with a total cloud opacity, log_kappa_0, and a single scattering albedo, albedo. Furthermore, opa_index, log_p_base, and fsed, are required parameters. This is cloud model 2 from Mollière et al (2020) Optionally, log_tau_cloud can be used for enforcing clouds in the photospheric region by scaling the cloud opacities.

    • Gray clouds are simply parametrized with the log_kappa_gray and log_cloud_top parameters. These clouds extend from the bottom of the atmosphere up to the cloud top pressure and have a constant opacity. Optionally, a single scattering albedo, albedo, can be specified. Also log_tau_cloud can be used for enforcing clouds in the photospheric region by scaling the cloud opacities.

    Extinction (optional):

    • Extinction can optionally be applied to the spectrum by including the ism_ext parameter, which is the the visual extinction, $A_V$. The empirical relation from Cardelli et al. (1989) is used for calculating the extinction at other wavelengths.

    • When using ism_ext, the reddening, $R_V$, can also be optionaly set with the ism_red parameter. Otherwise it is set to the standard value for the diffuse ISM, $R_V = 3.1$.

    Radial velocity and broadening (optional):

    • Radial velocity shift can be applied by adding the rad_vel parameter. This shifts the spectrum by a constant velocity (km/s).

    • Rotational broadening can be applied by adding the vsini parameter, which is the projected spin velocity (km/s), \(v\sin{i}\). The broadening is applied with the fastRotBroad function from PyAstronomy (see for details the documentation).

  • quenching (str, None) – Quenching type for CO/CH$_4$/H$_2$O 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 to None.

  • 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 (\(\mu`m) to which the spectrum will be resampled. The original wavelengths points will be used if the argument is set to ``None`\).

  • plot_contribution (bool, str, None) – Filename for the plot with the emission contribution. The plot is not created if the argument is set to False or None. If set to True, the plot is shown in an interface window instead of written to a file.

  • temp_nodes (int, None) – Number of free temperature nodes.

Returns:

Box with the petitRADTRANS model spectrum.

Return type:

species.core.box.ModelBox

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 = None)[source]#

Bases: object

Class for reading spectral library data from the database.

Parameters:
  • spec_library (str) – Name of the spectral library (‘irtf’, ‘spex’, ‘kesseli+2017’, ‘bonnefoy+2014’, ‘allers+2013’, or ‘vega’).

  • filter_name (str, None) – Filter name for the wavelength range. Full spectra are read if the argument is set to None.

Returns:

None

Return type:

NoneType

get_flux(sptypes: List[str] | None = None) 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:

species.core.box.PhotometryBox

get_magnitude(sptypes: List[str] | None = None) PhotometryBox[source]#

Function for calculating the apparent magnitude for the specified filter_name.

Parameters:

sptypes (list(str), None) – Spectral types to select from the 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:

species.core.box.PhotometryBox

get_spectrum(sptypes: List[str] | None = None, exclude_nan: bool = True) 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 the spec_library, the requested sptypes 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:

species.core.box.SpectrumBox

Module contents#