Model Library Grid¶
Module to define the Library class
This module defines the Library object used for specmatch-synth
-
class
smsyn.library.
Library
(header, model_table, wav, model_spectra, wavlim=None)[source]¶ The Library object
This object handles reading the model grid and associating the models with stellar parameters
- Args:
- header (dict): a dictionary containing metadata that describes
- the model library. ‘model_name’ and ‘model_reference’ are the only required keys. (e.g. {‘model_name’: ‘coelho05’, ‘model_reference’: ‘Coelho et al. (2005)’})
- model_table (DataFrame): Pandas DataFrame with the following
- columns: teff, logg, fe, model_index. The model_index column should give the index to the model spectrum in the model_spectra array that is associated with the given parameters.
- wav (array): 1-d vector containng the wavelength scale for the
- model spectra
- model_spectra (array): array containing all model spectra
- ordered so that the they can be referenced by the indicies contained in the model_table.
- wavlim (2-element iterable): (optional) list, tuple, or other
- 2-element itarable that contains the upper and lower wavelengths limits to be read into memory
-
select_model
(pars)[source]¶ Select a model spectrum
Grab a model spectrum from the library that corresponds to a given set of stellar parameters.
- Args:
- pars (3-element iterable): A 3-element tuple containing teff, logg,
- and fe
- Returns:
- array: model spectrum flux resampled at the new wavelengths
-
synth
(wav, teff, logg, fe, vsini, psf, rotation='rot', interp_kw=None)[source]¶ Synthesize a model spectrum
For a given set of wavelengths teff, logg, fe, vsini, psf, compute a model spectrum by:
- Determine the 8 coelho models surounding the (teff,logg,fe)
- Perform trilinear interpolation
- Resample onto new wavelength scale
- Broaden with rot-macro turbulence
- Broaden with PSF (assume gaussian)
- Args:
- wav (array): wavelengths where the model will be calculated teff (float): effective temp (K) logg (float): surface gravity (logg) fe (float): metalicity [Fe/H] (dex) vsini (float): rotational velocity (km/s) psf (float): sigma for instrumental profile (pixels)
- Returns:
- array: synthesized model calculated at the wavelengths specified
- in the wav argument
-
smsyn.library.
read_hdf
(filename, wavlim=None)[source]¶ Read model library grid
Read in a model library grid from an h5 file and initialze a Library object.
- Args:
- filename (string): path to h5 file that contains the grid
- of stellar atmosphere models
- wavlim (2-element iterable): upper and lower wavelength limits
- (in Angstroms) to load into RAM
- Returns:
- Library object
-
smsyn.library.
trilinear_interp
(c, v0, v1, vi)[source]¶ Trilinear interpolation
Perform trilinear interpolation as described here. http://en.wikipedia.org/wiki/Trilinear_interpolation
- Args:
- c (8 x n array): where C each row of C corresponds to the value at one
- corner
v0 (length 3 array): with the origin v1 (length 3 array): with coordinates on the diagonal vi (length 3 array): specifying the interpolated coordinates
- Returns:
- interpolated value of c at vi