pandeia_io.find_closest_sed

pandeia_io.find_closest_sed(
    teff,
    logg,
    models_teff=None,
    models_logg=None,
    sed_type='phoenix',
)

A very simple cost-function to find the closest stellar model within a non-regular Teff-log_g grid.

Since these are not regular grids, the cost function is not an absolute science, it depends on what weights more Teff of logg for a given case. The current formula seems to be a good balance.

Parameters

Name Type Description Default
teff Target effective temperature. required
logg Target log(g). required
models_teff SED model effective-temperature grid. None
models_logg SED model log(g) grid. None
sed_type Select from ‘phoenix’ or ‘k93models’ 'phoenix'

Returns

Name Type Description
If models_teff or models_logg are None sed: String The SED key that best matches the teff,logg pair.
Else idx: integer index of model with the closest Teff and logg.

Examples

>>> import gen_tso.pandeia_io as jwst
>>>
>>> # Kurucz models
>>> sed = jwst.find_closest_sed(
>>>     teff=4143.0, logg=4.66, sed_type='k93models',
>>> )
>>> print(f'SED: {repr(sed)}')
SED: 'k7v'
>>>
>>> # PHOENIX models when I already have the list of models:
>>> keys, names, p_teff, p_logg = jwst.load_sed_list('phoenix')
>>> teff = 4143.0
>>> logg = 4.66
>>> idx = jwst.find_closest_sed(teff, logg, p_teff, p_logg)
>>> print(f'{keys[idx]}: {repr(names[idx])}')
k5v: 'K5V 4250K log(g)=4.5'
Back to top