Re: ps

From: John Houck <houck_at_email.domain.hidden>
Date: Tue, 2 Mar 2004 10:32:23 -0500
On Tue, Mar 02, 2004 at 10:12 -0500, Saku Vrtilek wrote:
> 
> double-quotes does not work:
> 
> isis> f = region_flux ("id105.pha", 0.5, 9.8); 
> S-Lang Error: Type Mismatch: Unable to typecast String_Type to Integer_Type
> 

My apologies -- I didnt think long enough before I answered
your first email.  Dave Huenemoerder's later comment was
correct.

The usage message describes how to use the region_flux()
function:

isis> region_flux;
Usage:  Struct_Type = region_flux (hist_index, rmin, rmax [,ymin, ymax])
isis> 

The help page for region_flux, refers to region_counts for the
details:

isis> help region_flux
..
isis> help region_counts

region_counts

 SYNOPSIS
    Compute count statistics for a given wavelength region

 USAGE
    Struct_Type = region_counts (hist_index, xmin, xmax [,ymin, ymax])

 DESCRIPTION
    A data structure is returned for the histogram indicated by
    hist_index.  This structure contains a number of statistics for
    the interval [xmin, xmax). Individual fields are accessible
    using the S-Lang structure syntax; e.g.  s.sum or
    s.centroid_err (see below).
..



To use this function, first load the data file (which I assume
provides counts/bin)

id= load_data ("id105.pha");

It is important to understand that region_flux integrates over
a wavelength range in flux-corrected data.  To flux-correct a
dataset, an ARF must be available (an RMF can also be used in
the calculation but its not mandatory).  The expression used to
compute the flux-corrected values is given in the isis manual.

To perform flux-correction, do the following.  First,
load the ARF and assign it to the dataset in question:

isis> arf = load_arf ("arf.fits");
isis> assign_arf (arf, id);

Optionally, load the RMF and assign it to the dataset:
              isis> rmf = load_rmf ("rmf.fits");
              isis> assign_rmf (rmf, id);

Then flux-correct:
  isis> flux_corr (id);

Having generated the flux-corrected spectrum you can
now use region_flux to integrate over the specific
wavelength range:

isis> f = region_flux (id, 0.5, 9.8);

Alternatively, if you have a model for this dataset, another
approach would be to evaluate the model and integrate over some
wavelength region of the model to compute the model flux.  The
appended function illustrates one way to do that:

define compute_flux (elo, ehi) %{{{
{
   variable lo, hi, e_erg, f;
      
   (lo,hi) = linear_grid(elo, ehi,1000);
   e_erg = 0.5 * (lo+hi) * 1.e3 * Const_eV;
     
   f = reverse(eval_fun (_A(lo,hi)));
        
   return sum (f*e_erg);
}

To use this function, either cut-and-paste its definition at
the command line, (or perhaps add the function definition to
your ~/.isisrc file and re-start isis) define a model, e.g.

isis>  fit_fun ("wabs(1)*mekal(1)");

And then use the compute_flux function:

   isis> f = compute_flux (0.5, 2.5);

It returns the flux in erg/s/cm^2 within the specified
energy range (energies in keV).

Hope that helps,

-John

-- 
John C. Houck                       MIT Center for Space Research
NE80-6005: 617-253-3849                   77 Massachusetts Avenue
42:21:55.105N, 71:05:28.122W             Cambridge, MA 02139-4307





----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Tue Mar 02 2004 - 10:41:28 EST

This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT