Loving ISIS - Confessions of a Former XSPEC User

 

Model Grids

This is a topic that 95% of you don't have to worry about 95% of the time. If you fall into that category, you might want to skip ahead to the discussion of models.

The default for ISIS (and XSPEC) is to evaluate a model on a wavelength/energy grid for each dataset, over the channels that actually contribute to the noticed energy bins. There are several cases where you might want to override that behavior:

  • You wish to evaluate, and possibly plot, the model in regions not directly related to the data fit.
  • You have multiple datasets (with common normalizations), being fitted with a computationally expensive model, so you wish to evaluate the model only once on a common wavelength/energy grid.
  • You are applying a convolution model to the data, and there are contributions to the data from well beyond the noticed wavelength/energy ranges.
ISIS allows you to deal with each of these possibilities via its intrinsic function set_eval_grid_method. The third situation above applies to the example presented here, where the reflect model (a convolution model) is applied to the data. This model requires that the data be examined at high energies beyond the upper energy boundaries of the PCA and HEXTE data. We accomplish this via the following set of S-lang code:
define grid_hook(id,s)
{
    switch(id)
    {
       case(1):
       s.bin_lo = _A(10^[-9.:-7.:0.01]);
       s.bin_hi = make_hi_grid(s.bin_lo);
    }
    {
       s.bin_lo = _A(10^[-0.5:3:0.002]);
       s.bin_hi = make_hi_grid(s.bin_lo);
    }
    return s;
}

set_eval_grid_method (USER_GRID, [1:3], &grid_hook);
The above is the functional equivalent of the XSPEC command extend. (Notice, however, that we are doing more than just extending the grid - we are also redefining all the grid points to be whatever resolution that we choose.)

I have also written a number of wrapper functions, found in my startup scripts, that make these set ups a little easier.

Model Caching

When defining a custom grid, ISIS allows for the option of caching model evaluations. This allows the model evaluation to be reused for all data sets placed on this common grid. (XSPEC has this functionality for data sets that already share a common grid.)

Caching cannot be applied, however, if the models differ among the datasets. For example, if one applies an overall dataset-dependent normalization to the model, then a single cached set of model values cannot be used in the fits. Note in the above grid_hook we create two sets of grids: one for the radio and PCA data that share a common normalization, and another for the HEXTE data as it has its own overall normalization constant.

However, very often the fit run time can be dominated by just a few slow components. ISIS allows for caching of individual model components. These models are evaluated on a user-defined grid -- ideally one that has resolution at least as fine as the highest resolution dataset, and that spans the full range of energies/wavelengths present in all of the datasets. This cached model is then interpolated onto each dataset grid individually. Furthermore, so long as the model parameters have not been updated, ISIS will continue to use the cached version of the model. Using model caching can greatly speed up fits when simultaneously evaluating models applied to multiple datasets. The ISIS command for creating a cached model is:

   caching_name = cache_fun (name, lo, hi [; __qualifiers]);
See the help file for cache_fun for information on its use. cache_fun is a very powerful tool that can potentially speed up fits by large factors. (The multi-spacecraft fit of Cyg X-1 shown in the introduction was sped up by a factor of 5 using cache_fun!)

Next up: Models


This page was last updated Oct 7, 2013 by Michael Nowak. To comment on it or the material presented here, send email to mnowak@space.mit.edu.
Valid HTML 4.01! Made with JED. Viewable With Any Browser.