species.data package#

Submodules#

species.data.allers2013 module#

Module for adding young, M- and L-type dwarf spectra from Allers & Liu (2013) to the database. All spectra are also available in the SpeX Prism Library Analysis Toolkit.

species.data.allers2013.add_allers2013(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the spectra of young, M- and L-type dwarfs from Allers & Liu (2013) to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – The HDF5 database.

Returns

None

Return type

NoneType

species.data.bonnefoy2014 module#

Module for adding young, M- and L-type dwarf spectra from Bonnefoy et al. (2014) to the database.

species.data.bonnefoy2014.add_bonnefoy2014(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the SINFONI spectra of young, M- and L-type dwarfs from Bonnefoy et al. (2014) to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – The HDF5 database.

Returns

None

Return type

NoneType

species.data.companions module#

Module for extracting data of directly imaged planets and brown dwarfs.

species.data.companions.companion_spectra(input_path: str, comp_name: str, verbose: bool = True) Optional[Dict[str, Tuple[str, Optional[str], float]]][source]#

Function for getting available spectra of directly imaged planets and brown dwarfs.

Parameters
  • input_path (str) – Path of the data folder.

  • comp_name (str) – Companion name for which the spectra will be returned.

  • verbose (bool) – Print details on the companion data that are added to the database.

Returns

Dictionary with the spectra of comp_name. A None will be returned if there are not any spectra available.

Return type

dict, None

species.data.companions.get_data() Dict[str, Dict[str, Union[str, bool, Tuple[float, float], Dict[str, Union[Tuple[float, float], List[Tuple[float, float]]]]]]][source]#

Function for extracting a dictionary with the distances (pc) and apparent magnitudes of directly imaged planets and brown dwarfs. These data can be added to the database with add_companion().

Returns

Dictionary with the parallaxes and apparent magnitudes of directly imaged companions. Distances are mainly from the Gaia Early Data Release 3 DR2.

Return type

dict

species.data.companions.get_spec_data() Dict[str, Dict[str, Tuple[str, Optional[str], float, str]]][source]#

Function for extracting a dictionary with the spectra of directly imaged planets. These data can be added to the database with add_companion().

Returns

Dictionary with the spectrum, optional covariances, spectral resolution, and filename.

Return type

dict

species.data.database module#

Module with functionalities for reading and writing of data.

class species.data.database.Database[source]#

Bases: object

Class with reading and writing functionalities for the HDF5 database.

Returns

None

Return type

NoneType

add_calibration(tag: str, filename: Optional[str] = None, data: Optional[numpy.ndarray] = None, units: Optional[Dict[str, str]] = None, scaling: Optional[Tuple[float, float]] = None) None[source]#

Function for adding a calibration spectrum to the database.

Parameters
  • tag (str) – Tag name in the database.

  • filename (str, None) – Name of the file that contains the calibration spectrum. The file could be either a plain text file, in which the first column contains the wavelength (um), the second column the flux density (W m-2 um-1), and the third column the uncertainty (W m-2 um-1). Or, a FITS file can be provided in which the data is stored as a 2D array in the primary HDU. The data argument is not used if set to None.

  • data (np.ndarray, None) – Spectrum stored as 3D array with shape (n_wavelength, 3). The first column should contain the wavelength (um), the second column the flux density (W m-2 um-1), and the third column the error (W m-2 um-1). The filename argument is used if set to None.

  • units (dict, None) – Dictionary with the wavelength and flux units, e.g. {'wavelength': 'angstrom', 'flux': 'w m-2'}. The default units (um and W m-2 um-1) are used if set to None.

  • scaling (tuple(float, float), None) – Scaling for the wavelength and flux as (scaling_wavelength, scaling_flux). Not used if set to None.

Returns

None

Return type

NoneType

add_companion(name: Union[str, None, List[str]] = None, verbose: bool = True) None[source]#

Function for adding the magnitudes and spectra of directly imaged planets and brown dwarfs from get_data and get_comp_spec() to the database.

Parameters
  • name (str, list(str), None) – Name or list with names of the directly imaged planets and brown dwarfs (e.g. 'HR 8799 b' or ['HR 8799 b', '51 Eri b', 'PZ Tel B']). All the available companion data are added if the argument is set to None.

  • verbose (bool) – Print details on the companion data that are added to the database.

Returns

None

Return type

NoneType

add_comparison(tag: str, goodness_of_fit: numpy.ndarray, flux_scaling: numpy.ndarray, model_param: List[str], coord_points: List[numpy.ndarray], object_name: str, spec_name: List[str], model: str, scale_spec: List[str], extra_scaling: Optional[numpy.ndarray]) None[source]#
Parameters
  • tag (str) – Database tag where the results will be stored.

  • goodness_of_fit (np.ndarray) – Array with the goodness-of-fit values.

  • flux_scaling (np.ndarray) – Array with the best-fit scaling values to match the model spectra with the data.

  • model_param (list(str)) – List with the names of the model parameters.

  • coord_points (list(np.ndarray)) – List with 1D arrays of the model grid points, in the same order as model_param.

  • object_name (str) – Object name as stored in the database with add_object() or add_companion().

  • spec_name (list(str)) – List with spectrum names that are stored at the object data of object_name.

  • model (str) – Atmospheric model grid that is used for the comparison.

  • scale_spec (list(str)) – List with spectrum names to which an additional scaling has been applied.

  • extra_scaling (np.ndarray. None) – Array with extra scalings that have been applied to the spectra of scale_spec. The argument can be set to None if no extra scalings have been applied.

Returns

None

Return type

NoneType

add_dust() None[source]#

Function for adding optical constants of MgSiO3 and Fe, and MgSiO3 cross sections for a log-normal and power-law size distribution to the database. The optical constants have been compiled by Mollière et al. (2019) for petitRADTRANS from the following sources:

  • MgSiO3, crystalline
    • Scott & Duley (1996), ApJS, 105, 401

    • Jäger et al. (1998), A&A, 339, 904

  • MgSiO3, amorphous
    • Jäger et al. (2003), A&A, 408, 193

  • Fe, crystalline
    • Henning & Stognienko (1996), A&A, 311, 291

  • Fe, amorphous
    • Pollack et al. (1994), ApJ, 421, 615

Returns

None

Return type

NoneType

add_empirical(tag: str, names: List[str], sptypes: List[str], goodness_of_fit: List[float], flux_scaling: List[numpy.ndarray], av_ext: List[float], rad_vel: List[float], object_name: str, spec_name: List[str], spec_library: str) None[source]#
Parameters
  • tag (str) – Database tag where the results will be stored.

  • names (list(str)) – Array with the names of the empirical spectra.

  • sptypes (list(str)) – Array with the spectral types of names.

  • goodness_of_fit (list(float)) – Array with the goodness-of-fit values.

  • flux_scaling (list(np.ndarray)) – List with arrays with the best-fit scaling values to match the library spectra with the data. The size of each array is equal to the number of spectra that are provided as argument of spec_name.

  • av_ext (list(float)) – Array with the visual extinction \(A_V\).

  • rad_vel (list(float)) – Array with the radial velocities (km s-1).

  • object_name (str) – Object name as stored in the database with add_object() or add_companion().

  • spec_name (list(str)) – List with spectrum names that are stored at the object data of object_name.

  • spec_library (str) – Name of the spectral library that was used for the empirical comparison.

Returns

None

Return type

NoneType

add_filter(filter_name: str, filename: Optional[str] = None, detector_type: str = 'photon', verbose: bool = True) None[source]#

Function for adding a filter profile to the database, either from the SVO Filter profile Service or from an input file. Additional filters that are automatically added are Magellan/VisAO.rp, Magellan/VisAO.ip, Magellan/VisAO.zp, Magellan/VisAO.Ys, ALMA/band6, and ALMA/band7.

Parameters
  • filter_name (str) – Filter name from the SVO Filter Profile Service (e.g., ‘Paranal/NACO.Lp’) or a user-defined name if a filename is specified.

  • filename (str) – Filename of the filter profile. The first column should contain the wavelength (um) and the second column the fractional transmission. The profile is downloaded from the SVO Filter Profile Service if the argument of filename is set to None.

  • detector_type (str) – The detector type (‘photon’ or ‘energy’). The argument is only used if a filename is provided. Otherwise, for filters that are fetched from the SVO website, the detector type is read from the SVO data. The detector type determines if a wavelength factor is included in the integral for the synthetic photometry.

  • verbose (bool) – Print details on the companion data that are added to the database.

Returns

None

Return type

NoneType

add_isochrones(model: str, filename: Optional[str] = None, tag: Optional[str] = None) None[source]#

Function for adding isochrone data to the database.

Parameters
  • model (str) – Evolutionary model (‘ames’, ‘bt-settl’, ‘sonora’, ‘baraffe’, or ‘saumon2008’). For ‘ames’, ‘bt-settl’, ‘sonora’, and ‘saumon2008’, the isochrones will be automatically downloaded and added to the database. For ‘baraffe’, the isochrone data can be downloaded from https://phoenix.ens-lyon.fr/Grids/ and manually added by setting the filename and tag arguments.

  • filename (str, None) – Filename with the isochrone data. Only required with model='baraffe' and can be set to None otherwise.

  • tag (str) – Database tag name where the isochrone that will be stored. Only required with model='baraffe' and can be set to None otherwise.

Returns

None

Return type

NoneType

add_model(model: str, wavel_range: Optional[Tuple[float, float]] = None, spec_res: Optional[float] = None, teff_range: Optional[Tuple[float, float]] = None) None[source]#

Function for adding a grid of model spectra to the database. All spectra have been resampled to logarithmically-spaced wavelengths. The spectral resolution is returned with the get_spec_res() method of ReadModel, but is typically of the order of several thousand. It should be noted that the original spectra were often calculated with a constant step size in wavenumber, so the original spectral resolution decreased from short to long wavelengths.

Parameters
  • model (str) – Model name (‘ames-cond’, ‘ames-dusty’, ‘atmo’, ‘bt-settl’, ‘bt-settl-cifist’, ‘bt-nextgen’, ‘drift-phoenix’, ‘petitcode-cool-clear’, ‘petitcode-cool-cloudy’, ‘petitcode-hot-clear’, ‘petitcode-hot-cloudy’, ‘exo-rem’, ‘blackbody’, bt-cond’, ‘bt-cond-feh, ‘morley-2012’, ‘sonora-cholla’, ‘sonora-bobcat’, ‘sonora-bobcat-co’, ‘koester-wd’).

  • wavel_range (tuple(float, float), None) – Wavelength range (um) for adding a subset of the spectra. The full wavelength range is used if the argument is set to None.

  • spec_res (float, None) – Spectral resolution to which the spectra will be resampled. This parameter is optional since the spectra have already been resampled to a lower, constant resolution (typically \(R = 5000\)). The argument is only used if wavel_range is not None.

  • teff_range (tuple(float, float), None) – Effective temperature range (K) for adding a subset of the model grid. The full parameter grid will be added if the argument is set to None.

Returns

None

Return type

NoneType

add_object(object_name: str, parallax: Optional[Tuple[float, float]] = None, distance: Optional[Tuple[float, float]] = None, app_mag: Optional[Dict[str, Union[Tuple[float, float], List[Tuple[float, float]]]]] = None, flux_density: Optional[Dict[str, Tuple[float, float]]] = None, spectrum: Optional[Dict[str, Tuple[str, Optional[str], Optional[float]]]] = None, deredden: Union[Dict[str, float], float] = None, verbose: bool = True) None[source]#

Function for adding the photometry and/or spectra of an object to the database.

Parameters
  • object_name (str) – Object name that will be used as label in the database.

  • parallax (tuple(float, float), None) – Parallax and uncertainty (mas). Not stored if the argument is set to None.

  • distance (tuple(float, float), None) – Distance and uncertainty (pc). Not stored if the argument is set to None. This parameter is deprecated and will be removed in a future release. Please use the parallax parameter instead.

  • app_mag (dict, None) – Dictionary with the filter names, apparent magnitudes, and uncertainties. For example, {'Paranal/NACO.Lp': (15., 0.2), 'Paranal/NACO.Mp': (13., 0.3)}. For the use of duplicate filter names, the magnitudes have to be provided in a list, for example {'Paranal/NACO.Lp': [(15., 0.2), (14.5, 0.5)], 'Paranal/NACO.Mp': (13., 0.3)}. No photometry is stored if the argument is set to None.

  • flux_density (dict, None) – Dictionary with filter names, flux densities (W m-2 um-1), and uncertainties (W m-1 um-1). For example, {'Paranal/NACO.Lp': (1e-15, 1e-16)}. Currently, the use of duplicate filters is not implemented. The use of app_mag is preferred over flux_density because with flux_density only fluxes are stored while with app_mag both magnitudes and fluxes. However, flux_density can be used in case the magnitudes and/or filter profiles are not available. In that case, the fluxes can still be selected with inc_phot in FitModel. The argument of flux_density is ignored if set to None.

  • spectrum (dict, None) – Dictionary with the spectrum, optional covariance matrix, and spectral resolution for each instrument. The input data can either have a FITS or ASCII format. The spectra should have 3 columns with wavelength (um), flux (W m-2 um-1), and uncertainty (W m-2 um-1). The covariance matrix should be 2D with the same number of wavelength points as the spectrum. For example, {'SPHERE': ('spectrum.dat', 'covariance.fits', 50.)}. No covariance data is stored if set to None, for example, {'SPHERE': ('spectrum.dat', None, 50.)}. The spectrum parameter is ignored if set to None. For GRAVITY data, the same FITS file can be provided as spectrum and covariance matrix.

  • deredden (dict, float, None) – Dictionary with spectrum and app_mag names that will be dereddened with the provided \(A_V\). For example, deredden={'SPHERE': 1.5, 'Keck/NIRC2.J': 1.5} will deredden the provided spectrum named ‘SPHERE’ and the Keck/NIRC2 J-band photometry with a visual extinction of 1.5. For photometric fluxes, the filter-averaged extinction is used for the dereddening.

  • verbose (bool) – Print details on the object data that are added to the database.

Returns

None

Return type

NoneType

add_photometry(phot_library: str) None[source]#
Parameters

phot_library (str) – Photometric library (‘vlm-plx’ or ‘leggett’).

Returns

None

Return type

NoneType

add_retrieval(tag: str, output_folder: str, inc_teff: bool = False) None[source]#

Function for adding the output data from the atmospheric retrieval with AtmosphericRetrieval to the database.

Parameters
  • tag (str) – Database tag to store the posterior samples.

  • output_folder (str) – Output folder that was used for the output files by MultiNest.

  • inc_teff (bool) – Calculate \(T_\mathrm{eff}\) for each sample by integrating the model spectrum from 0.5 to 50 um. The \(T_\mathrm{eff}\) samples are added to the array with samples that are stored in the database. The computation time for adding \(T_\mathrm{eff}\) will be long because the spectra need to be calculated and integrated for all samples.

Returns

None

Return type

NoneType

add_samples(sampler: str, samples: numpy.ndarray, ln_prob: numpy.ndarray, tag: str, modelpar: List[str], ln_evidence: Optional[Tuple[float, float]] = None, mean_accept: Optional[float] = None, spectrum: Tuple[str, str] = None, parallax: Optional[float] = None, spec_labels: Optional[List[str]] = None, attr_dict: Optional[Dict] = None)[source]#

This function stores the posterior samples from classes such as FitModel in the database, including some additional attributes.

Parameters
  • sampler (str) – Sampler (‘emcee’, ‘multinest’, or ‘ultranest’).

  • samples (np.ndarray) – Samples of the posterior.

  • ln_prob (np.ndarray) – Log posterior for each sample.

  • tag (str) – Database tag.

  • modelpar (list(str)) – List with the model parameter names.

  • ln_evidence (tuple(float, float)) – Log evidence and uncertainty. Set to None when sampler is ‘emcee’.

  • mean_accept (float, None) – Mean acceptance fraction. Set to None when sampler is ‘multinest’ or ‘ultranest’.

  • spectrum (tuple(str, str)) – Tuple with the spectrum type (‘model’ or ‘calibration’) and spectrum name (e.g. ‘drift-phoenix’ or ‘evolution’).

  • parallax (float, None) – Parallax (mas) of the object. Not used if the argument is set to None.

  • spec_labels (list(str), None) – List with the spectrum labels that are used for fitting an additional scaling parameter. Not used if set to None.

  • attr_dict (dict, None) – Dictionary with data that will be stored as attributes of the dataset with samples.

Returns

None

Return type

NoneType

add_spectra(spec_library: str, sptypes: Optional[List[str]] = None) None[source]#
Parameters
  • spec_library (str) – Spectral library (‘irtf’, ‘spex’, ‘kesseli+2017’, ‘bonnefoy+2014’, ‘allers+2013’).

  • sptypes (list(str)) – Spectral types (‘F’, ‘G’, ‘K’, ‘M’, ‘L’, ‘T’). Currently only implemented for ‘irtf’.

Returns

None

Return type

NoneType

add_spectrum(spec_library: str, sptypes: Optional[List[str]] = None) None[source]#

DEPRECATION: This method is deprecated and will be removed in a future release. Please use the add_spectra() method instead.

Parameters
  • spec_library (str) – Spectral library (‘irtf’, ‘spex’, ‘kesseli+2017’, ‘bonnefoy+2014’, ‘allers+2013’).

  • sptypes (list(str)) – Spectral types (‘F’, ‘G’, ‘K’, ‘M’, ‘L’, ‘T’). Currently only implemented for ‘irtf’.

Returns

None

Return type

NoneType

static available_models() Dict[source]#

Function for printing an overview of the available model grids that can be downloaded and added to the database with add_model.

Returns

Dictionary with the details on the model grids. The dictionary is created from the model_data.json file in the species.data folder.

Return type

dict

delete_data(data_set: str) None[source]#

Function for deleting a dataset from the HDF5 database.

Parameters

data_set (str) – Group or dataset path in the HDF5 database. The content and structure of the database can be shown with list_content(). That could help to determine which argument should be provided as argument of data_set. For example, data_set="models/drift-phoenix" will remove the model spectra of DRIFT-PHOENIX.

Returns

None

Return type

NoneType

get_compare_sample(tag: str) Dict[str, float][source]#

Function for extracting the sample parameters with the highest posterior probability.

Parameters

tag (str) – Database tag where the results from compare_model() are stored.

Returns

Dictionary with the best-fit parameters.

Return type

dict

get_evidence(tag: str) Tuple[float, float][source]#

Function for returning the log-evidence (i.e. marginalized likelihood) that was computed by the nested sampling algorithm when using FitModel or AtmosphericRetrieval.

Parameters

tag (str) – Database tag with the posterior samples.

Returns

  • float – Log-evidence.

  • float – Uncertainty on the log-evidence.

get_mcmc_photometry(tag: str, filter_name: str, burnin: Optional[int] = None, phot_type: str = 'magnitude') numpy.ndarray[source]#

Function for calculating synthetic magnitudes or fluxes from the posterior samples.

Parameters
  • tag (str) – Database tag with the posterior samples.

  • filter_name (str) – Filter name for which the synthetic photometry will be computed.

  • burnin (int, None) – Number of burnin steps to remove. No burnin is removed if the argument is set to None. Is only applied on posterior distributions that have been sampled with emcee.

  • phot_type (str) – Photometry type (‘magnitude’ or ‘flux’).

Returns

Synthetic magnitudes or fluxes (W m-2 um-1).

Return type

np.ndarray

get_mcmc_spectra(tag: str, random: int, burnin: Optional[int] = None, wavel_range: Optional[Union[Tuple[float, float], str]] = None, spec_res: Optional[float] = None, wavel_resample: Optional[numpy.ndarray] = None) Union[List[species.core.box.ModelBox], List[species.core.box.SpectrumBox]][source]#

Function for drawing random spectra from the sampled posterior distributions.

Parameters
  • tag (str) – Database tag with the posterior samples.

  • random (int) – Number of random samples.

  • burnin (int, None) – Number of burnin steps to remove. No burnin is removed if the argument is set to None. Is only applied on posterior distributions that have been sampled with emcee.

  • wavel_range (tuple(float, float), str, None) – Wavelength range (um) or filter name. Full spectrum is used if set to None.

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

  • wavel_resample (np.ndarray, None) – Wavelength points (um) to which the model spectrum will be resampled. The resampling is applied after the optional smoothing to the resolution of spec_res.

Returns

List with ModelBox objects.

Return type

list(species.core.box.ModelBox)

get_median_sample(tag: str, burnin: Optional[int] = None) Dict[str, float][source]#

Function for extracting the median parameter values from the posterior samples.

Parameters
  • tag (str) – Database tag with the posterior results.

  • burnin (int, None) – Number of burnin steps to remove. No burnin is removed if the argument is set to None. Is only applied on posterior distributions that have been sampled with emcee.

Returns

Median parameter values of the posterior distribution.

Return type

dict

get_object(object_name: str, inc_phot: Union[bool, List[str]] = True, inc_spec: Union[bool, List[str]] = True) species.core.box.ObjectBox[source]#

Function for extracting the photometric and/or spectroscopic data of an object from the database. The spectroscopic data contains optionally the covariance matrix and its inverse.

Parameters
  • object_name (str) – Object name in the database.

  • inc_phot (bool, list(str)) – Include photometric data. If a boolean, either all (True) or none (False) of the data are selected. If a list, a subset of filter names (as stored in the database) can be provided.

  • inc_spec (bool, list(str)) – Include spectroscopic data. If a boolean, either all (True) or none (False) of the data are selected. If a list, a subset of spectrum names (as stored in the database with add_object()) can be provided.

Returns

Box with the object’s data.

Return type

species.core.box.ObjectBox

get_probable_sample(tag: str, burnin: Optional[int] = None) Dict[str, float][source]#

Function for extracting the sample parameters with the highest posterior probability.

Parameters
  • tag (str) – Database tag with the posterior results.

  • burnin (int, None) – Number of burnin steps to remove. No burnin is removed if the argument is set to None. Is only applied on posterior distributions that have been sampled with emcee.

Returns

Parameters and values for the sample with the maximum posterior probability.

Return type

dict

get_pt_profiles(tag: str, random: Optional[int] = None, out_file: Optional[str] = None) Tuple[numpy.ndarray, numpy.ndarray][source]#

Function for returning the pressure-temperature profiles from the posterior of the atmospheric retrieval with petitRADTRANS. The data can also optionally be written to an output file.

Parameters
  • tag (str) – Database tag with the posterior samples from the atmospheric retrieval with AtmosphericRetrieval.

  • random (int, None) – Number of random samples that will be used for the P-T profiles. All samples will be selected if set to None.

  • out_file (str, None) – Output file to store the P-T profiles. The data will be stored in a FITS file if the argument of out_file ends with .fits. Otherwise, the data will be written to a text file. The data has two dimensions with the first column containing the pressures (bar) and the remaining columns the temperature profiles (K). The data will not be written to a file if the argument is set to None.

Returns

  • np.ndarray – Array (1D) with the pressures (bar).

  • np.ndarray – Array (2D) with the temperature profiles (K). The shape of the array is (n_pressures, n_samples).

static get_retrieval_spectra(tag: str, random: Optional[int], wavel_range: Union[Tuple[float, float], str] = None, spec_res: Optional[float] = None) Tuple[List[species.core.box.ModelBox], species.read.read_radtrans.ReadRadtrans][source]#

Function for extracting random spectra from the posterior distribution that was sampled with AtmosphericRetrieval.

Parameters
  • tag (str) – Database tag with the posterior samples.

  • random (int, None) – Number of randomly selected samples. All samples are used if set to None.

  • wavel_range (tuple(float, float), str, None) – Wavelength range (um) or filter name. The wavelength range from the retrieval is adopted (i.e. the``wavel_range`` parameter of AtmosphericRetrieval) when set to None. It is mandatory to set the argument to None in case the log_tau_cloud parameter has been used with the retrieval.

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

Returns

  • list(box.ModelBox) – Boxes with the randomly sampled spectra.

  • read_radtrans.Radtrans – Instance of ReadRadtrans.

get_retrieval_teff(tag: str, random: int = 100) Tuple[numpy.ndarray, numpy.ndarray][source]#

Function for calculating \(T_\mathrm{eff}\) and \(L_\mathrm{bol}\) from randomly drawn samples of the posterior distribution that is estimated with AtmosphericRetrieval. This requires the recalculation of the spectra across a broad wavelength range (0.5-50 um).

Parameters
  • tag (str) – Database tag with the posterior samples.

  • random (int) – Number of randomly selected samples.

Returns

  • np.ndarray – Array with \(T_\mathrm{eff}\) samples.

  • np.ndarray – Array with \(\log(L/L_\mathrm{sun})\) samples.

get_samples(tag: str, burnin: Optional[int] = None, random: Optional[int] = None, json_file: Optional[str] = None) species.core.box.SamplesBox[source]#
Parameters
  • tag (str) – Database tag with the samples.

  • burnin (int, None) – Number of burnin steps to remove. No burnin is removed if the argument is set to None. Is only applied on posterior distributions that have been sampled with emcee.

  • random (int, None) – Number of random samples to select. All samples (with the burnin excluded) are selected if set to None.

  • json_file (str, None) – JSON file to store the posterior samples. The data will not be written if the argument is set to None.

Returns

Box with the posterior samples.

Return type

species.core.box.SamplesBox

static list_companions() List[str][source]#

Function for printing an overview of the companion data that are stored in the database. It will return a list with all the companion names. Each name can be used as input for ReadObject.

Returns

List with the object names that are stored in the database.

Return type

list(str)

list_content() None[source]#

Function for listing the content of the HDF5 database. The database structure will be descended while printing the paths of all the groups and datasets, as well as the dataset attributes.

Returns

None

Return type

NoneType

petitcode_param(tag: str, sample_type: str = 'median', json_file: Optional[str] = None) Dict[str, float][source]#

Function for converting the median are maximum likelihood posterior parameters of petitRADTRANS into a dictionary of input parameters for petitCODE.

Parameters
  • tag (str) – Database tag with the posterior samples.

  • sample_type (str) – Sample type that will be selected from the posterior (‘median’ or ‘probable’). Either the median or maximum likelihood parameters are used.

  • json_file (str, None) – JSON file to store the posterior samples. The data will not be written if the argument is set to None.

Returns

Dictionary with parameters for petitCODE.

Return type

dict

species.data.dust module#

Module for optical constants of dust grains.

species.data.dust.add_cross_sections(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the extinction cross section of crystalline MgSiO3 for a log-normal and power-law size distribution to the database.

Parameters
  • input_path (str) – Folder where the data is located.

  • database (h5py._hl.files.File) – Database.

Returns

NoneType

Return type

None

species.data.dust.add_optical_constants(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the optical constants of crystalline and amorphous MgSiO3 and Fe to the database.

Parameters
  • input_path (str) – Folder where the data is located.

  • database (h5py._hl.files.File) – Database.

Returns

NoneType

Return type

None

species.data.filters module#

Module for downloading filter data from the website of the SVO Filter Profile Service.

species.data.filters.download_filter(filter_id: str) Tuple[Optional[numpy.ndarray], Optional[numpy.ndarray], Optional[str]][source]#

Function for downloading filter profile data from the SVO Filter Profile Service.

Parameters

filter_id (str) – Filter name as listed on the website of the SVO Filter Profile Service (see http://svo2.cab.inta-csic.es/svo/theory/fps/).

Returns

  • np.ndarray – Wavelength (um).

  • np.ndarray – Fractional transmission.

  • str – Detector type (‘energy’ or ‘photon’).

species.data.irtf module#

Module for adding the IRTF Spectral Library to the database.

species.data.irtf.add_irtf(input_path: str, database: h5py._hl.files.File, sptypes: Optional[List[str]] = None) None[source]#

Function for adding the IRTF Spectral Library to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – Database.

  • sptypes (list(str), None) – List with the spectral types (‘F’, ‘G’, ‘K’, ‘M’, ‘L’, ‘T’). All spectral types are included if set to None.

Returns

None

Return type

NoneType

species.data.isochrones module#

Module for isochrone data from evolutionary models.

species.data.isochrones.add_ames(database, input_path)[source]#

Function for adding the AMES-Cond and AMES-Dusty isochrone data to the database.

Parameters
  • database (h5py._hl.files.File) – Database.

  • input_path (str) – Folder where the data is located.

Returns

None

Return type

NoneType

species.data.isochrones.add_baraffe(database, tag, file_name)[source]#

Function for adding the Baraffe et al. (2003) isochrone data to the database. Any of the isochrones from https://phoenix.ens-lyon.fr/Grids/ can be used as input.

Parameters
  • database (h5py._hl.files.File) – Database.

  • tag (str) – Tag name in the database.

  • file_name (str) – Filename with the isochrones data.

Returns

None

Return type

NoneType

species.data.isochrones.add_btsettl(database, input_path)[source]#

Function for adding the BT-Settl isochrone data to the database.

Parameters
  • database (h5py._hl.files.File) – Database.

  • input_path (str) – Folder where the data is located.

Returns

None

Return type

NoneType

species.data.isochrones.add_marleau(database, tag, file_name)[source]#

Function for adding the Marleau et al. isochrone data to the database. The isochrone data can be requested from Gabriel Marleau.

https://ui.adsabs.harvard.edu/abs/2019A%26A…624A..20M/abstract

Parameters
  • database (h5py._hl.files.File) – Database.

  • tag (str) – Tag name in the database.

  • file_name (str) – Filename with the isochrones data.

Returns

None

Return type

NoneType

species.data.isochrones.add_saumon(database, input_path)[source]#

Function for adding the Saumon & Marley (2008) isochrone data to the database.

Parameters
  • database (h5py._hl.files.File) – Database.

  • input_path (str) – Folder where the data is located.

Returns

None

Return type

NoneType

species.data.isochrones.add_sonora(database, input_path)[source]#

Function for adding the Sonora Bobcat isochrone data to the database.

Parameters
  • database (h5py._hl.files.File) – Database.

  • input_path (str) – Folder where the data is located.

Returns

None

Return type

NoneType

species.data.kesseli2017 module#

Module for adding O5 through L3 SDSS stellar spectra from Kesseli et al. (2017) to the database.

species.data.kesseli2017.add_kesseli2017(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the SDSS stellar spectra from Kesseli et al. (2017) to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – The HDF5 database.

Returns

None

Return type

NoneType

species.data.leggett module#

Text

species.data.leggett.add_leggett(input_path, database)[source]#

Function for adding the Database of Ultracool Parallaxes to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – Database.

Returns

None

Return type

NoneType

species.data.model_spectra module#

Module for adding a grid of model spectra to the database.

species.data.model_spectra.add_model_grid(model_name: str, input_path: str, database: h5py._hl.files.File, wavel_range: Optional[Tuple[float, float]], teff_range: Optional[Tuple[float, float]], spec_res: Optional[float]) None[source]#

Function for adding a grid of model spectra to the database. The original spectra had been resampled to logarithmically- spaced wavelengths, so at a constant resolution, \(\lambda/\Delta\lambda\). This function downloads the model grid, unpacks the tar file, and adds the spectra and parameters to the database.

Parameters
  • model_name (str) – Name of the model grid.

  • input_path (str) – Folder where the data is located.

  • database (h5py._hl.files.File) – Database.

  • wavel_range (tuple(float, float), None) – Wavelength range (um). The original wavelength points are used if set to None.

  • teff_range (tuple(float, float), None) – Effective temperature range (K). All temperatures are selected if set to None.

  • spec_res (float, None) – Spectral resolution for resampling. Not used if wavel_range is set to None and/or spec_res is set to None

Returns

None

Return type

NoneType

species.data.spex module#

Module for adding the SpeX Prism Spectral Libraries to the database.

species.data.spex.add_spex(input_path: str, database: h5py._hl.files.File) None[source]#

Function for adding the SpeX Prism Spectral Library to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – The HDF5 database.

Returns

None

Return type

NoneType

species.data.vega module#

Text

species.data.vega.add_vega(input_path, database)[source]#

Function for adding a flux-calibrated spectrum of Vega to the database.

Parameters
  • input_path (str) – Path of the data folder.

  • database (h5py._hl.files.File) – Database.

Returns

None

Return type

NoneType

species.data.vlm_plx module#

Module for the photometric data and parallaxes from the Database of Ultracool Parallaxes.

species.data.vlm_plx.add_vlm_plx(input_path, database)[source]#

Function for adding the Database of Ultracool Parallaxes to the database.

Parameters
  • input_path (str) – Data folder.

  • database (h5py._hl.files.File) – HDF5 database.

Returns

None

Return type

NoneType

Module contents#