Re: using fakeit

From: Manfred Hanke <Manfred.Hanke_at_email.domain.hidden>
Date: Wed, 19 Aug 2009 19:09:18 +0200
Hi,

 > First, when I try...
>    (lo, hi) = linear_grid (0.6, 10, 500);
> it works fine inside isis, but when I put it in the script, I get...
>    lo is undefined
>    ./fake.sl:16:<top-level>:Undefined Name
>    Failed loading file fake.sl
Unlike on the interactive shell, variables have to be declared in a 
script. So you want to do
    variable lo, hi;
    (lo, hi) = linear_grid (0.6, 10, 500);


> 2.) I'm having trouble figuring out the other grid method defined under 
> user-grid. It gives the general form:
>    Struct_Type = grid_hook (hist_index, Struct_Type);
> but while I've tried several different iterations, I can't figure out exactly 
> what Struct_Type should actually look like.

That's what the following sentences in the help try to explain:

     USER_GRID means that, when the model is evaluated for each
     dataset, it is evaluated on the wavelength grid supplied by a
     user-provided S-Lang function.  This function must be of the
     form
         Struct_Type = grid_hook (hist_index, Struct_Type);
     where the Struct_Type has fields bin_lo and bin_hi.  The grid
     returned by this function must define a wavelength grid in
     Angstrom units, in ascending order.

I.e., your function defines the grid by the bin_lo and bin_hi fields of 
the structure. The help also gives an example:

     First, define a function to provide the necessary grid:
         define extender (id, s)
         {
            % <generate s.bin_lo, s.bin_hi here>
            return s;
         }
     We can then impose this model grid using:
        set_eval_grid_method (USER_GRID, [3:8], &extender);

To adopt your example, we could define it in the following way:
         define extender (id, s)
         {
            (s.bin_lo, s.bin_hi) = linear_grid (0.6, 10, 500);
            return s;
         }

But as I said, I don't think that the USER_GRID is what you need for 
your problem. One needs it if the model isn't local, i.e., if you cannot 
evaluate the model in the bins defined by your detector without knowing 
the flux in other regions. This can easily happen if you are using a 
convolution model. Imagine a Comptonization spectrum. The seed photon 
distribution may be at lower energies than your measured spectrum, 
nevertheless the seed photon model has to be evaluated there before it 
can be upscattered properly.

I hope that helps.
Cheers,

Manfred
----
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 Wed Aug 19 2009 - 13:09:31 EDT

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:46 EDT