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

List of Routines

ULY_SSP Define a SSP component
ULY_SSP_ALLOC ULY_SSP_FREE Allocate/free a structure containing the stellar population models
ULY_SSP_CHCK Check if a model grid matchs specifications given in keywords
ULY_SSP_EXTR Interpolate in the model grid to extract a spectrum
ULY_SSP_INIT Initialize a SSP component
ULY_SSP_INTERP Get interpolated spectrum for logT, Met and [Mg/Fe]
ULY_SSP_READ Read a grid of population model and sample it according to
ULY_SSP_WRITE Write a SSP model grid to a FITS file

Routine Descriptions

ULY_SSP

[Next Routine] [List of Routines]
 NAME:           ULY_SSP

 PURPOSE:        Define a SSP component 
              
 USAGE:
                 cmp = uly_ssp(MODEL_FILE=model_file, 
                               DATA=template_grid,  
                               LSF=lsf_file,                           
                               AL=a_limits, 
                               ZL=z_limits, 
                               MGFEL=mg_limits,
                               AG=a_guess, 
                               ZG=z_guess, 
                               MGFEG=mg_guess, 
                               NAME=name, 
                               FIXPAR=fixpar, 
                               WL=lim_weight)


 DESCRIPTION:    
      Return a CMP structure describing a SSP component that can be passed to 
      the program ULYSS.

      A SSP is a function of age, metallicity and possibly of [Mg/Fe]. The set of 
      models is defined by MODEL_FILE, by default Pegase-HR models computed with 
      ELODIE.3.1 and Salpeter IMF will be used.
      A list of the models included in the basic distribution of the package
      can be found on the models page. And other models can be downloaded
      from the same page.

      To define a n-bursts model use n times ULY_SSP and make an array
      of these cmp_n: cmp = [cmp_1, cmp_2,... cmp_n]

      Note that the SSP components are not obligarory SSPs, they may for example 
      be population with constant SFR. They just depend at maximum on age, metallicity 
      and [Mg/Fe]. (An exponentially decreasing SFR cannot be modeled with this CMP.

 KEYWORDS:
   MODEL_FILE:  Name of the FITS file containing the SSP grid.
                Defaulted to models/PHR_Elodie31.fits (PEGASE_HR
                grid with Elodie.3.1 library).
                An alternative choice, provided in the distribution
                is to use the Vazdekis models build with the Miles
                library (uly_root+'/models/Vaz_Miles.fits').

   DATA:        This keyword is used for template model (input and output). 
                Normally ULYSS reads the model grid specified with MODEL_FILE.
                If <template_grid> is the correct model for the required 
                action, then it uses it without reloading. 
                The same keyword is used for output of the loaded model, ie.,
                you can set this keyword to an empty named variable where 
                the loaded model will be stored.                

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

   AL:          [Myr] default=limits of the grid
                Limits for the age. dblarr(2). 

   ZL:          [dex] default=limits of the grid
                dblarr(2). Limits for the metallicities.

   MGFEL:       [dex] default=limits of the grid
                dblarr(2); Limits for [Mg/Fe].

   AG:          [Myr] default=8000
                Guess for the age. This can be a scalar or an array.

   ZG:          [dex] default=-0.4
                Guess for the metallicity. This can be a scalar or an array.

   MGFEG:       [dex] default=0.0
                Guess for the [Mg/Fe]. This may be an array. 

   NAME:        Character string to name the component. By default a unique
                name is generated.

   FIXPAR:      array[3], for [age, Fe/H, Mg/Fe]
                the elements which have to be fixed 0/1 - free/fixed

   WL:          limits for the weight of each model component [min_w, max_w]
                The weight is in data units over component units.
                By default the weight is constrained to be positive, to
                suppress any constraint, set: WL=[-1,1]*machar(/DOUBLE)).xmax
                This constraint is ignored when ULySS fits a single component.

 EXAMPLE:
                To fit Vaz-Miles SSP with PHR-ELODIE
                 cmp=uly_ssp()
                 ulyss, uly_root+'/data/VazMiles_z-0.40t07.94.fits', cmp

 HISTORY:
     CREATION    2008/07/24 Mina Koleva

(See pgm/uly_ssp.pro)


ULY_SSP_ALLOC ULY_SSP_FREE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:    ULY_SSP_ALLOC ULY_SSP_FREE

 PURPOSE:
          Allocate/free a structure containing the stellar population models

 USAGE:
          grid = uly_ssp_alloc()

          uly_ssp_free, grid

 DESCRIPTION:
          ULY_SSP_ALLOC allocates an empty structure.
          ULY_SSP_FREE frees an existing one.

   This structure has the same tags as the spect structure 
   (see ULY_SPECT_ALLOC) plus some additional ones. Therefore, many
   functions designed to manipulate spect structures can be used, but
   notice that (i) these functions will not handle the specific tags and
   (ii) only ULY_SSP_FREE will correctly free the memory.

   The anonymous structure contains the following tags:
     title         string
                Title, to be filled with the name of the grid                 
     hdr        Array of character strings
                FITS style header, to be filled with the hdr of the grid 
     start      double precision
                Wavelength of the centre of the first pixel
                If 'sampling'=0, wavelength in Angstrom
                If 'sampling'=1, log(wavelength)  (natural log)
                If 'sampling'=2, wavelength can not be described with
                start/step
     step       double precision
                Wavelength step between two pixels 
                If 'sampling'=0, in Angstrom
                If 'sampling'=1, logarithmic step
                If 'sampling'=2, not a constant step
     sampling   integer
                Type of sampling scale
                0 for linear in wavelength
                1 for logarithmic scale  
                2 for non-constant step
     wavelen    Wavelength array, relevant if sampling=2
     waverange  2 elements vector
                The wavelength range for the data
     goodpix    integer 1D array
                List of valid pixels
     data       real array of dimension 3 or 4
                Pointer on Array of the values of the flux  
     err        A pointer to null to make the structure compatible with 'spect'
     o_age      Array of models' log(ages)
     o_metal    Array of models' metallicities
     o_mgfe     Array of models' [Mg/Fe], for a grid resolved in [Mg/Fe]
     d2t        3 or 4D array containing the 2nd time derivatives
                used for spline interpolation
     dof_factor Dummy varaible to make the structure compatible with 'spect'

 RETURN:
            empty model structure, to be filled with the (para)data of the
            models 

 SEE ALSO:  ULY_SPECT_ALLOC

 AUTHOR:
    Martin France, Mina Koleva, Philippe Prugniel
            CRAL-Observatoire de Lyon

(See pgm/uly_ssp_alloc.pro)


ULY_SSP_CHCK

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

 PURPOSE:
         Check if a model grid matchs specifications given in keywords

 USAGE:  
         status = uly_ssp_chck(model_grid,                    $
                     WAVERANGE=waverange, VELSCALE=velscale,  $
                     AGERANGE=agerange, METALRANGE=metalrange,$
                     MODEL_FILE=model_file, QUIET=quiet       $
                    

 DESCRIPTION:
         Check if a grid of population models previously read
         (likely with ULY_SSP_READ) corresponds to some reading
         specification. This may save to reload it.
         This routine check if the model (MODEL_FILE, for example
         'PHR_Elodie31.fits' or 'Vaz_Miles.fits'), WCS
         (waverange, velscale) or range of parameters
         (agerange, metalrange) match.
         This routine compares the characteristics of the model grid
         as they are stored in the structure (model_grid) with those
         specified in keywords

         If a model grid is passed in entry to ULY_SSP_READ through
         the keyword MODEL_FILE, the present routine is called
         to test if the grid is consistent with the other parameters.

 ARGUMENT:
    model_grid: input  (not modified by this routine)
         Structure created by eg. uly_ssp_read and containing the
         model.
         If not give, ULY_SSP_CHCK returns 0.

 KEYWORD:
    The keywords are similar to those of ULY_SSP_READ
     WAVERANGE: (optional)
        Two element array giving the limits of the range to read, 
        in Angstrom. For example WAVERANGE=[4000d,4786d].
        By default the whole data range is read.
     VELSCALE: (optional)
        Size of the pixels in km/s. For example VELSCALE=30.
        If VELSCALE is not given, the models are not rebinned, ie.
        they are as stored in the disk file (in linear or log scale).
     AGERANGE, METALRANGE: (optional)
        Extracted region of the grid. Ages are in log(Myr) and metallicities
        in dex.
        By default the whole data range is read.
        For example AGERANGE=alog([100,15000]), METALRANGE=[-1.4,+0.7]
     MODEL_FILE: (string) Name of the file containing the grid of SSPs.
     QUIET:  verbosity control

 RETURN:
    integer (model_reload): 1 if (model_grid) does not corresponds to
                              the specifications
                            0 if (model_grid) corresponds to the specs

 EXAMPLE:
        Read a grid of Pegase-HR/Elodie with given wavelength, age
        and metallicity ranges:
             grid = uly_ssp_read(uly_root+'/models/PHR_Elodie31.fits', $
                          WAVERANGE=[4000d, 5500d], VELSCALE=30., $
                          AGERANGE=alog([20,2000]), METALRANGE=[-1.4,-0.1])
        Check it if <grid> corresponds to the reading specifications:
             if uly_ssp_chck(grid,                                 $
                     WAVERANGE=[4000d,5500d], VELSCALE=30,         $
                     AGERANGE=[20, 2000], METALRANGE=[-1.4,-0.1],  $
                     MODEL_FILE='models/PHR_elodie31.fits', /QUIET $
                    ) eq 1 then print, 'It is the correct grid!'

 DEPENDENCE:
            ULY_SSP_ALLOC.PRO

 AUTHOR:  Antoine Bouchard, Philippe Prugniel

(See pgm/uly_ssp_chck.pro)


ULY_SSP_EXTR

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

 PURPOSE:
             Interpolate in the model grid to extract a spectrum
                      
 USAGE:
               model = uly_ssp_extr(<galaxy>, <model_file>,
                                           <pars>, SIGMA=sigma, /QUIET)

 DESCRIPTION:
       Extract 1D spectrum from an interpolated grid of model spectra
       at a given age, metallicity and [Mg/Fe]. Rebin it according to the  
       WCS of the input spectrum <galaxy> and cut it in the wavelength range
       of this latter spectrum.
       
       To simply interpolate a model at given age, metallicity and [Mg/Fe] 
       first read the model grid with ULY_SSP_READ and after use the 
       lower level function ULY_SSP_INTERP.
     

 ARGUMENT:
       <galaxy>      filename or spectrum structure serving as a model 
                     for the WCS.
       <model_file>  Identification of the model
       <pars>        array of parameters of the model SSP ([age, met, mgf])
                     
 KEYWORD:
   SIGMA:   Gaussian velocity dispersion in km/s, to convolve the
            model grid with when loading it.
   QUIET:   Verbosity control.

 RETURNS:    
       A 1D SSP spectrum as a spect structure, see ULY_SPECT_ALLOC
            
 EXAMPLE:
       To extract a model of PHR/Elodie with the same
       SSP equvalent age/metallicity like Vazdekis/Miles's model 
            model = $
            uly_ssp_extr(uly_root+'/data/VazMiles_z-0.40t07.94.fits', $
            uly_root+'/models/PHR_Elodie31.fits', [7980, -0.38, 0])
 
 DEPENDENCE:
            [uly_spect_read.pro], [uly_spect_alloc.pro],
            [uly_spect_logrebin.pro],  uly_spect_get.pro,
            uly_spect_free.pro, uly_ssp_read.pro, uly_ssp_interp.pro 

 HISTORY:
            Creation  Mina Koleva 2008/03/11 

(See pgm/uly_ssp_extr.pro)


ULY_SSP_INIT

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

 PURPOSE:        Initialize a SSP component

 USAGE:          cmp_new = uly_ssp_init(cmp, 
                                        WAVERANGE=waverange,
                                        VELSCALE=velscale, 
                                        QUIET=quiet)

 DESCRIPTION:
    This initialization function is automatically
                 executed by ULY_FIT_INIT when a component has been
                 defined using ULY_SSP (fit of a Single Stellar Population).

                 This function is recorded in the member:
                 cmp.init_fun of the component structure.

                 The initialization consist in reading the grid of
                 SSPs (ULY_SSP_READ) sample it according to WAVERANGE
                 and VELSCALE and possibly inject the LSF.
 ARGUMENTS:
    cmp:         a component defined using ULY_SSP (look its doc for
                 more details)

 KEYWORDS:
    WAVERANGE:   wavelength range for which the models are read
    VELSCALE:    if this keyword is set the models are going to be
                 rebined in log with a step in km/s equal to the velscale
                 value
    QUIET:       verbosity control 

 DEPENDENCE:     ULY_SSP_READ.pro

 HISTORY:        creation PhP

(See pgm/uly_ssp.pro)


ULY_SSP_INTERP

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

 PURPOSE:
        Get interpolated spectrum for logT, Met and [Mg/Fe]

 USAGE:
          model_new = uly_ssp_interp(model_grid, para)

 DESCRIPTION:
    Interpolate spectrum from a grid of models at given
                 log(age), [Fe/H] and [Mg/Fe]. Use ULY_2DERIV and
                 INTERP_3D. Called, for example, from ULY_SSP_EXTR
                 and ULY_FIT_LIN.

 ARGUMENTS:
   model_grid:   Grid of model (structure)
   [x, y, mgfe]: Log of age (Myr); metallicity (dex); [Mg/Fe]

 RETURN:         Interpolated spectrum (array)

 EXAMPLE:
        Read a model grid and then extract a spectrum at
                 given 10 Gyr and solar metallicity 
                 model_grid=uly_ssp_read(uly_root+'/models/PHR_Elodie31.fits')
                 model = uly_ssp_interp(model_grid, [alog(10000), 0.0])

 AUTHOR:         Philippe Prugniel

(See pgm/uly_ssp_interp.pro)


ULY_SSP_READ

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

 PURPOSE:
        Read a grid of population model and sample it according to 
                 specifications

 USAGE:
          grid = uly_ssp_read( model_file,                   $
                          TEMPLATE_GRID=template_grid,              $
                          WAVERANGE=waverange, VELSCALE=velscale,   $
                          AGERANGE=agerange, METALRANGE=metalrange, $
                          LSF=lsf_file,                             $
                          SIGMA=sigma, QUIET=quiet )

 ARGUMENTS:
    model_file:  Name of the FITS file where the model are read

 INPUT KEYWORDS:
    TEMPLATE_GRID (optional)
        If given, ULY_SSP_READ checks that its value is a model
        grid matching the description given through the other arguments
        (see ULY_SSP_CHCK). If the grid match those specification
        it is returned directly. Otherwise a new grid is read and
        returned.

     VELSCALE (optional)
        Size of the pixels in km/s. For example VELSCALE=30.
        If VELSCALE is not given, the models are not rebinned, ie.
        they are as stored in the disk file (in linear or log scale).

     WAVERANGE (optional)
        Two element array giving the limits of the range to read, 
        in Angstrom. For example WAVERANGE=[4000d,4786d].
        By default the whole data range is read.

     AGERANGE, METALRANGE (optional)
        Extracted region of the grid. Ages in log(Myr) and metallicities
        in dex.
        By default the whole data range is read.
        For example AGERANGE=alog([100,15000]), METALRANGE=[-1.4,+0.7]

     LSF_FILE (optional)
        Name of a file containing the LSF (see ULY_LSF and
        ULY_SSP_LSFCONVOL) to be injected in the grid.

     SIGMA (optional)
        If given, the models are convolved by a Gaussian whose standard
        deviation is SIGMA [km/s]

     /QUIET (optional)
        Verbosity control. 

 RETURN:
   Structure containing the models grid. See ULY_SSP_ALLOC.
   In case of error, return the scalar value -1.

 DESCRIPTION:
        A grid of population model contains synthetic spectra at a
        sample of ages, metallicity and possibly [Mg/Fe]. It is
        used to generate a model at given age, metallicity and [Mg/Fe]
        by interpolation.
        The function ULY_SSP_READ returns a structure containing
        the grid and all its description (wcs, sampling points in
        age, metallicity ...).

 EXAMPLE: 
   grid = uly_ssp_read(uly_root+'/models/PHR_Elodie31.fits', $
                          WAVERANGE=[4000d, 5500d], VELSCALE=30., $
                          AGERANGE=alog([12,20000]), METALRANGE=[-2.4,0.7])

   grid = uly_ssp_read(uly_root+'/models/PHR_Elodie31.fits', VELS=30)

 AUTHORS:
  Philippe Prugniel, Martin France, Mina Koleva

(See pgm/uly_ssp_read.pro)


ULY_SSP_WRITE

[Previous Routine] [List of Routines]
 NAME:                 ULY_SSP_WRITE

 PURPOSE:
                       Write a SSP model grid to a FITS file

 USAGE:
                uly_ssp_write, <model_grid>, <filename>

 ARGUMENTS:
   <model_grid> :      Structure with the models (see ULY_SSP_READ)

   <filename>   :      Name of the output FITS file

 DESCRIPTION:
   Write the model structure <model_grid> into the file <filename> that
   can be used later with ULY_SSP_READ or to define a component with ULY_SSP.

   This function is in particular useful when a LSF has been injected in
   an original model in order to use this new model to analyse
   several spectra.

   Description of the model file:
   The data grid is stored as a N-dimensional array whose first dimension
   is the wavelength. The other dimensions are the axes of the models:
   AGE and METAL.
   The coordinates on the wavelength axis are described with a standard
   WCS, while for the other axese they are stored in extensions respectively
   named AGE and METAL.
   An additional extension, PARAM, if present, contains further information
   on each spectrum of the model (like flux in given bands or Lick indices)
   

 EXAMPLE:
                       Read a grid, inject a LSF, write the modified grid
     grid = uly_ssp_read(uly_root+'/models/PHR_Elodie31.fits', VEL=30.)
     uly_spect_lsfconvol, 'lsf', grid
     uly_ssp_write, grid, 'convolved_grid.fits'

                       The LSF file 'lsf' used above can be generated as:
     galaxy = uly_root+'/data/VazMiles_z-0.40t07.94.fits'
     model = uly_ssp_extr(galaxy, $
      uly_root+'/models/PHR_Elodie31.fits' ,[8000.,-0.4,0.], SIG=30)
     cmp = uly_star(model)
     uly_lsf, galaxy, cmp, 200, 100, FIL='lsf', /QUIET

 HISTORY:  
           creation     Mina Koleva
           update       Philippe Prugniel

(See pgm/uly_ssp_write.pro)


This page was created by the ULySS routine uly_html_help.
Contact: ulyss at obs.univ-lyon1.fr Last modified: Wed Feb 24 10:42:28 2016.