# document.write(pagetitle)

Home Download Tutorial 1 Tutorial 2 Tutorial 3 Tutorial 4 Tutorial 5

# List of Routines

 ULY_TGM Define a TGM component ULY_TGM_EVAL Evaluate a TGM model spectrum. ULY_TGM_EXTR Compute a stellar template spectrum using TGM model ULY_TGM_INIT Initialize a TGM component

# Routine Descriptions

## ULY_TGM

[Next Routine] [List of Routines]
NAME:
ULY_TGM
PURPOSE:
Define a TGM component
USAGE:
cmp = uly_tgm(MODEL_FILE=model_file, LSF=lsf_file,
TG=t_guess, LG=l_guess, ZG=z_guess,
TL=t_limits, LL=l_limits, ZL=z_limits,
NAME=name, FIXPAR=fixpar, WL=lim_weight)

KEYWORDS:
MODEL_FILE    Name of the FITS file containing the TGM model, by default
use: /models/elodie32_flux_tgm.fits.

LSF           Name of the file containing a relative LSF to be injected in
the template.

TG            [K] Guess value for the effective temperature (Teff), by
default = 7000.0. If an array is passed, the analysis will
be repeated starting from each element to find the optimal
solution.

LG            [cm/s^2] Guess value for the surface gravity (Logg), by
default = 2.0, it can also be given as an array to search
the absolute minimum.

ZG            [dex] Guess value for the metallicity ([Fe/H]), by
default = 0.0, it can also be given as an array
to search the best minimum from the grid of guesses.

TL            [K], dblarr(2), limits for the Teff,
by default = [3100.0,40000.0] see  ULY_TGM_INIT.

LL            [dex],dblarr(2), limits for the Logg,
by default = [-0.25, 5.9] see ULY_TGM_INIT.

ZL            [dex],dblarr(2), limits for the [Fe/H],
by default = [-2.5, 1.0] see ULY_TGM_INIT.

NAME          A string, name of this component. By default a unique name is
generated.

FIXPAR        An array used to fix some the atmosphere parameters,
0 means that the parameter is free, and 1 that it is fixed.
A fixed parameter keeps its initial value.
The parameters are specified in the following order:
(Teff, Logg, [Fe/H]).

WL            Limits for the weight of the component [min_w, max_w].
The weight is in data units over component units.
By default the weight is constrained to be positive.
This constraint is applicable when multiple components are
fitted (composite spectrum), it is ignored for a single
component.

/REBIN_COEF   Computation mode, see the description below.

DESCRIPTION:
Return a TGM structure describing a TGM component that can be
passed to program ULYSS.

TGM stands for Temperature-Gravity-Metallicity: A TGM component
specifies an interpolated stellar spectrum evaluated as a function
of its atmospheric parameters (Teff, Logg and [Fe/H]) that was
interpolated over a stellar spectral library (e.g. ELODIE 3.2)
or over a grid of synthetic spectra.

The file passed to ULY_TGM contains the coefficients of polynomials
depending on the atmospheric parameter. Each wavelengh bin is represented
separately, therefore the coefficients for each term of the development
form a spectrum. Depending on the interpolator, there are 14 to about
25 terms. The first polynomial interpolator was presented in
Prugniel and Soubiran 2001, A&A 369, 1048 for the ELODIE spectral
libraries, it was updated in subsequent papers, in particular in
Wu et al. 2011, A&A 525, 71. Interpolators for the MILES library were
presented in Prugniel et al. 2011, A&A 531, 169, and Sharma et
al. 2015, submitted. Other interpolators are available on the
ULySS site.

The interpolated spectra are evaluated using the interpolator, and
then rebinned to the WCS of the spectrum to analyse.

REBIN_COEF option:
Rather than rebinning the interpolated spectrum, it first rebin the
coefficients, and then compute the interpolated spectrum. This option is
slightly less precise (because of the spline interpolation of the several
coefficients), but is in some cases faster. This is the case when (i)
a series of several spectra are fitted with the same CMP, and (ii) when
the spectrum to analyse has a sampling much coarser than the interpolator.
(Note that the impact on the precision of the interpolated spectrum
is generally fully acceptable; it was the only available option before
the release 1.3 of ULySS.)

OUTPUT:
TGM cmp struct, for detailed explanation please check uly_fit.pro

REQUIRED FUNCTION:
ULY_CMP_NAME

EXAMPLE:
Fit a CFLIB star:
cmp = uly_tgm()
star = uly_root+'/data/cflib_114642.fits'
ulyss, star, cmp, lmin=3900.0, lmax=6800.0, /PLOT

HISTORY:
Creation Yue WU 2008/06/18

(See pgm/uly_tgm.pro)

## ULY_TGM_EVAL

[Previous Routine] [Next Routine] [List of Routines]
NAME:            ULY_TGM_EVAL

PURPOSE:
Evaluate a TGM model spectrum.

USAGE:
array = uly_tgm_eval(eval_data, para)

ARGUMENTS:
EVAL_DATA:     The interpolated stellar spectrum model coefficients,
it contains three dimensions of data, specifying to
warm, hot and cold stellar regions respectively, in
fact, they are the coefficients of the evaluating
polynomial function.

PARA:          Input 3 atmospheric parameters (log(Teff), Logg, [Fe/H]),
they will be passed to ULY_TGM_MODEL_PARAM to
compute out the parameters which will be applied
to the polynomial function for evaluating
the model spectrum at this given stellar
atmospheric parameters (Teff, log g and [Fe/H]).

DESCRIPTION:
Evaluate a TGM model spectrum which is interpolated as a
function of atmospheric parameters (effective temperature,
surface gravity and [Fe/H]). Each wavelength point is evaluated
by using polynomials.

This function is automatically called by the minimization routines:
ULY_FIT, ULY_FIT_LIN to evaluate a TGM model (see ULY_TGM).

OUTPUT:
Evaluated stellar model spectrum

REQUIRED FUNCTION:
ULY_TGM_MODEL_PARAM, compute the parameters

AUTHOR:
Yue WU, 2008/06/18

(See pgm/uly_tgm_eval.pro)

## ULY_TGM_EXTR

[Previous Routine] [Next Routine] [List of Routines]
NAME:                ULY_TGM_EXTR

PURPOSE:
Compute a stellar template spectrum using TGM model

USAGE:
model = uly_tgm_extr([<spectrum>], <pars>, MODEL_FILE=<file>)

DESCRIPTION:
Compute a 1D stellar template spectrum by using TGM model at a given
Teff, Log g and [Fe/H]. Rebin it with the same sampling as <spectrum>
and with a compatible grid.

If the natural wavelength range of the model is wider than the one
of <spectrum> the returned spectrum has exactly the same sampling as
<spectrum> (same range and same step). If instead the wavelength
range of the model is narrower, the output spectrum will be truncated
with respect to <spectrum> but its wavelength bins will match bins
of <spectrum>.

Note that although the model may be rebinned, its resolution is not
matched to that of <spectrum>.

If <spectrum> is omitted, i. e. if only one argument is given, the
returned spectrum has the original sampling of the model.

ARGUMENT:
<spectrum>    filename or spectrum structure serving as a reference
for the velscale.

<pars>        array of parameters([Teff,Logg,[Fe/H]) used
to evaluate the template spectrum.

KEYWORD:
MODEL_FILE = <file>
Filename of the model to use, by default:
uly_root + '/models/elodie32_flux_tgm.fits'

RETURNS:
A 1D stellar spectrum as a spect structure, see ULY_SPECT_ALLOC

EXAMPLE:
To compute a template spectrum at a given atmosphere parameters
according to uly_root+'/data/cflib_114642.fits's velscale.
model = uly_tgm_extr(uly_root+'/data/cflib_114642.fits', \$
[6400., 4., 0.])

HISTORY:
Yue WU 2008/08/20

(See pgm/uly_tgm_extr.pro)

## ULY_TGM_INIT

[Previous Routine] [List of Routines]
NAME:
ULY_TGM_INIT
PURPOSE:
Initialize a TGM component

USAGE:
cmp_new = uly_tgm_init (cmp, WAVERANGE=lamrange, \$
VELSCALE=velscale, QUIET=quiet)

ARGUMENTS:
CMP:        Component defined by using ULY_TGM, please check it for
more details.

KEYWORDS:
WAVERANGE:  Wavelength range used when the model will be
evaluated with ULY_TGM_EVAL.

VELSCALE:   Size of one pixel in km/s. Used when the model will be
evaluated and log-rebinned with ULY_TGM_EVAL.

QUIET:      verbosity control

DESCRIPTION:
This initialization function is automatically executed by
ULY_FIT_INIT when a component has been defined by using
ULY_TGM. A TGM model component can generate a spectrum at given
stellar atmospheric parameters (Teff,log g and [Fe/H]).

The name of this function is recorded as a member of
cmp.init_fun in the TGM component structure (see ULY_FIT for a
complete description of the component structure).

coefficients from a FITS file whose name is saved in
*cmp.init_data (by default
/models/elodie32_flux_tgm.fits), and also loads in the cmp
structure the WCS.

NOTE
ULY_INIT_TGM is also called by ULY_TGM_EXTR where we use the keywords
SAMPLING, WAVERANGE, STEP, which are more general because they can make
either lin- or log-sampled spectra.
This more general approach may be used in ULY_FIT_INIT in the future, when
we will implement fitting in other than log- (not however that it is not
fully general, because uneven sampling would not be supported).

HISTORY:
Creation Yue WU 2008/06/18

(See pgm/uly_tgm_init.pro)