species.read package

Submodules

species.read.read_calibration module

Module with reading functionalities for calibration spectra.

class species.read.read_calibration.ReadCalibration(tag, filter_name=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 ID that is used for the wavelength range. Full spectrum is used if set to None.
Returns:

None

Return type:

NoneType

get_flux(model_param=None)[source]

Function for calculating the average flux density for the filter_name.

Parameters:model_param (dict, None) – Model parameters. Should contain the ‘scaling’ value. Not used if set to None.
Returns:Average flux density (W m-2 um-1).
Return type:float
get_magnitude(model_param=None, distance=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 (float, None) – Distance to the calibration objects (pc).
Returns:

  • float – Apparent magnitude (mag).
  • float, None – Absolute magnitude (mag).

get_spectrum(model_param=None, apply_mask=False, spec_res=None, extrapolate=False, min_wavelength=None)[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:

species.core.box.SpectrumBox

resample_spectrum(wavel_points, model_param=None, apply_mask=False)[source]

Function for resampling of a spectrum and uncertainties onto a new wavelength grid.

Parameters:
  • wavel_points (numpy.ndarray) – Wavelength points (um).
  • 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.
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 spectral libraries.

class species.read.read_color.ReadColorColor(library, filters_colors)[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)[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, filters_color, filter_mag)[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=None)[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)[source]

Bases: object

Class for reading a filter profile from the database.

Parameters:filter_name (str) – Filter ID as stored in the database. Filter IDs from the SVO Filter Profile Service will be automatically downloaded, stored in the database, and read from the database.
Returns:None
Return type:NoneType
filter_fwhm()[source]

Calculate the full width at half maximum (FWHM) of the filter profile.

Returns:Filter full width at half maximum (um).
Return type:float
get_filter()[source]

Function for selecting a filter profile from the database.

Returns:Filter transmission profile.
Return type:numpy.ndarray
interpolate_filter()[source]

Function for linearly interpolating a filter profile.

Returns:Linearly interpolated filter.
Return type:scipy.interpolate.interpolate.interp1d
mean_wavelength()[source]

Calculate the weighted mean wavelength of the filter profile.

Returns:Mean wavelength (um).
Return type:float
wavelength_range()[source]

Extract the wavelength range of the filter profile.

Returns:
  • float – Minimum wavelength (um).
  • float – Maximum wavelength (um).

species.read.read_isochrone module

Module with reading functionalities for isochrones.

class species.read.read_isochrone.ReadIsochrone(tag)[source]

Bases: object

Class for reading an isochrone from the database.

Parameters:tag (str) – Database tag of the isochrone data.
Returns:None
Return type:NoneType
get_color_color(age, masses, model, filters_colors)[source]

Function for calculating color-magnitude combinations from a selected isochrone.

Parameters:
  • age (str) – Age (Myr) at which the isochrone data is interpolated.
  • masses (numpy.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 IDs for the colors as listed in the file with the isochrone data. The filter IDs should be provided in the format of the SVO Filter Profile Service.
Returns:

Box with the color-color data.

Return type:

species.core.box.ColorColorBox

get_color_magnitude(age, masses, model, filters_color, filter_mag)[source]

Function for calculating color-magnitude combinations from a selected isochrone.

Parameters:
  • age (str) – Age (Myr) at which the isochrone data is interpolated.
  • masses (numpy.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 IDs for the color as listed in the file with the isochrone data. The filter IDs should be provided in the format of the SVO Filter Profile Service.
  • filter_mag (str) – Filter ID 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.
Returns:

Box with the color-magnitude data.

Return type:

species.core.box.ColorMagBox

get_isochrone(age, masses, filters_color, filter_mag)[source]

Function for selecting an isochrone.

Parameters:
  • age (str) – Age (Myr) at which the isochrone data is interpolated.
  • masses (numpy.ndarray) – Masses (Mjup) at which the isochrone data is interpolated.
  • filters_color (tuple(str, str), None) – Filter IDs 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 ID 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.core.box.IsochroneBox

species.read.read_model module

Module with reading functionalities for atmospheric model spectra.

class species.read.read_model.ReadModel(model, wavel_range=None, filter_name=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 ID that is used for the wavelength range. The wavel_range is used if set to None.
Returns:

None

Return type:

NoneType

get_bounds()[source]

Function for extracting the grid boundaries.

Returns:Boundaries of parameter grid.
Return type:dict
get_data(model_param)[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.
Returns:Box with the model spectrum.
Return type:species.core.box.ModelBox
get_flux(model_param, synphot=None)[source]

Function for calculating the average flux density for the filter_name.

Parameters:
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)[source]

Function for calculating the apparent and absolute magnitudes for the filter_name.

Parameters:model_param (dict) – Model parameters and values.
Returns:
  • float – Apparent magnitude (mag).
  • float – Absolute magnitude (mag).
get_model(model_param, spec_res=None, wavel_resample=None, magnitude=False, smooth=False)[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 and/or resampling the spectrum when wavel_range of FitModel is not None. The original wavelength points are used if both spec_res and wavel_resample are set to None.
  • wavel_resample (numpy.ndarray, None) – Wavelength points (um) to which the spectrum is resampled. In that case, spec_res can still be used to smooth the spectrum.
  • 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 of spec_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:

species.core.box.ModelBox

get_parameters()[source]

Function for extracting the parameter names.

Returns:Model parameters.
Return type:list(str, )
get_points()[source]

Function for extracting the grid points.

Returns:Parameter points of the model grid.
Return type:dict
get_wavelengths()[source]

Function for extracting the wavelength points.

Returns:Wavelength points (um).
Return type:numpy.ndarray
interpolate_grid(bounds, wavel_resample=None, smooth=False, spec_res=None)[source]

Internal function for linearly interpolating the grid of model spectra for a given filter or wavelength sampling, and grid boundaries.

bounds : dict
Dictionary with the parameter boundaries.
wavel_resample : numpy.array, None
Wavelength points for the resampling of the spectrum. The filter_name is used if set to None.
smooth : bool
Smooth the spectrum with a Gaussian line spread function. Only recommended in case the input wavelength sampling has a uniform spectral resolution.
spec_res : float
Spectral resolution that is used for the Gaussian filter when smooth=True.
Returns:None
Return type:NoneType
interpolate_model()[source]

Internal function for linearly interpolating the full grid of model spectra.

Returns:None
Return type:NoneType
open_database()[source]

Internal function for opening the species database.

Returns:The HDF5 database.
Return type:h5py._hl.files.File
wavelength_points(hdf5_file)[source]

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

Parameters:hdf5_file (h5py._hl.files.File) – The HDF5 database.
Returns:
  • numpy.ndarray – Wavelength points (um).
  • numpy.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)[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)[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 ID.
Returns:Absolute magnitude (mag), uncertainty (mag).
Return type:float, float
get_distance()[source]

Function for reading the distance to the object.

Returns:
  • float – Distance (pc).
  • float – Uncertainty (pc).
get_photometry(filter_name)[source]

Function for reading the photometry of the object.

Parameters:filter_name (str) – Filter ID.
Returns:Apparent magnitude (mag), magnitude error (error), flux (W m-2 um-1), flux error (W m-2 um-1).
Return type:numpy.ndarray
get_spectrum()[source]

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

Returns:Dictionary with spectra and covariance matrices.
Return type:dict

species.read.read_planck module

Module with reading functionalities for Planck spectra.

class species.read.read_planck.ReadPlanck(wavel_range=None, filter_name=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 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

get_color_color(temperatures, radius, filters_colors)[source]

Function for calculating two colors in the range of 100-10000 K.

Parameters:
  • temperatures (numpy.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

get_color_magnitude(temperatures, radius, filters_color, filter_mag)[source]

Function for calculating the colors and magnitudes in the range of 100-10000 K.

Parameters:
  • temperatures (numpy.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, synphot=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:

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

Return type:

float

get_magnitude(model_param, synphot=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, spec_res)[source]

Function for calculating a Planck spectrum or a combination of multiple Planck spectra.

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.
Returns:

Box with the Planck spectrum.

Return type:

species.core.box.ModelBox

static planck(wavel_points, temperature, scaling)[source]

Internal function for calculating a Planck function.

Parameters:
  • wavel_points (numpy.ndarray) – Wavelength points (um).
  • temperature (float) – Temperature (K).
  • scaling (float) – Scaling parameter.
Returns:

Flux density (W m-2 um-1).

Return type:

numpy.ndarray

static update_parameters(model_param)[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_spectrum module

Module with reading functionalities for spectral libraries.

class species.read.read_spectrum.ReadSpectrum(spec_library, filter_name=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 ID for the wavelength range. Full spectra are read if set to None.
Returns:

None

Return type:

NoneType

get_flux(sptypes=None)[source]

Function for calculating the average flux density 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:species.core.box.PhotometryBox
get_magnitude(sptypes=None)[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:species.core.box.PhotometryBox
get_spectrum(sptypes=None, exclude_nan=True)[source]

Function for selecting spectra from the database.

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