milespy.stellar_library.StellarLibrary

class milespy.stellar_library.StellarLibrary(source='MILES_STARS', version='9.1')

Bases: Repository

Single stars library.

source

Name of input library being used

Type:

str

version

Version number of the library

Type:

str

Attributes:
models

The spectra (or spectrum-like) object holding the loaded models.

Methods

closest(teff, logg, FeH[, MgFe])

Gets closest star in database for given set of parameters

get_starname([id])

Gets a starname in database for a given ID

in_range(teff_lims, logg_lims, FeH_lims[, ...])

Gets set of stars with parameters range

interpolate(teff, logg, FeH[, MgFe, ...])

Interpolates a star spectrum for given set of parameters using Delaunay triangulation

resample(new_wave)

Resample all models onto the given wavelength grid.

search_by_id([id])

Searches a star in database for a given ID

trim(lower, upper)

Restrict the spectral range of all models to [lower, upper].

__init__(source='MILES_STARS', version='9.1')

Creates an instance of the class

Parameters:
  • source – Name of input models to use. If none of the options below, it will assume that source is the path to an external model repository file. Valid inputs are MILES_STARS/CaT_STARS/EMILES_STARS

  • version – Version number of the models

closest(teff, logg, FeH, MgFe=None)

Gets closest star in database for given set of parameters

Parameters:
Returns:

Spectrum from the closest star in the library.

Return type:

Spectra

get_starname(id=None)

Gets a starname in database for a given ID

Parameters:

id – integer with the star ID in database

Return type:

Star name

in_range(teff_lims, logg_lims, FeH_lims, MgFe_lims=None)

Gets set of stars with parameters range

Parameters:
  • teff_lims (Quantity) – Limits in Teff

  • logg_lims (Quantity) – Limits in Log(g)

  • FeH_lims (Quantity) – Limits in [Fe/H]

  • MgFe_lims (Optional[Quantity]) – Limits in [Mg/Fe]

Returns:

Object instance for stars within parameters range

Return type:

StellarLibrary

interpolate(teff, logg, FeH, MgFe=None, closest=False, simplex=False)

Interpolates a star spectrum for given set of parameters using Delaunay triangulation

Parameters:
  • teff (Quantity) – Desired Teff

  • logg (Quantity) – Desired Log(g)

  • FeH (Quantity) – Desired [Fe/H]

  • MgFe (Optional[Quantity]) – Desired [Mg/Fe]

  • closest (bool) – Return the closest spectra, rather than performing the interpolation. If only one interpolation is performed, all the spectra in the simplex vertices are returned.

  • simplex (bool) – If only one set of input parameters is given, return all the spectra that form part of the simplex used for the interpolation. These spectra have the weights information in their meta dictionary.

Returns:

Interpolated spectrum. If closest == True, return the closest spectra from the repository, rather than doing the interpolation.

Return type:

Spectra

Raises:
  • RuntimeError – If the values are out of the grid.

  • ValueError – If the provided parameters do not have the same shape.

property models

The spectra (or spectrum-like) object holding the loaded models.

resample(new_wave)

Resample all models onto the given wavelength grid.

Updates models in place; metadata is preserved.

Parameters:

new_wave (Quantity) – New spectral axis (e.g. wavelength in u.AA).

Return type:

None

search_by_id(id=None)

Searches a star in database for a given ID

Parameters:

id – integer with the star ID in database

Return type:

Object instance for selected items

trim(lower, upper)

Restrict the spectral range of all models to [lower, upper].

Updates models in place with the trimmed spectra; metadata is preserved.

Parameters:
  • lower (Quantity) – Lower wavelength bound (e.g. u.AA).

  • upper (Quantity) – Upper wavelength bound.

Return type:

None