Re: back_fun problems

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Wed, 31 Oct 2007 10:32:54 -0400
    John> On Sun, Oct 28, 2007 at 15:04 -0400, David P. Huenemoerder wrote:
    >> Hi -
    >> 
    >> I'm trying to create a model background for HRC-S for simulation
    >> purposes. So I used tg_bkg (a ciao contrib script) and dmtype2split (a

...

    John> Isis doesn't perform this scaling on input.  Does your script
    John> do this explicitly?

...

Sorry - I thought I posted my own reply to my question, but it did not
make it to isis-users due to a typo.  The message I intended to send
is below.

--Dave


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Date: Mon, 29 Oct 2007 23:04:12 -0400
In-reply-to: <200710281904.l9SJ4EpU022662_at_email.domain.hiddenSubject: Re: isis-users: back_fun problems


After talking w/ John H., I was able to go answer my own question.  So
for the record:

    David> I'm trying to create a model background for HRC-S for
    David> simulation purposes. So I used tg_bkg (a ciao contrib
    David> script) and dmtype2split (a ciao tool) to create PHA Type I
    David> files of the summed _up, _down background from the default
    David> "bow-tie" LETGS extractions. These have a constant ratio of
    David> background width to source width of 10, so the BACKSCALE is
    David> 10, and the counts are scaled by 1/BACKSCALE when loaded.

That was not correct.  The data, when loaded, do not get scaled by
BACKSCAL.  (I don't know exactly what I compared - probably a rebinned
or scaled dataset with the unbinned file's counts.)

    David> So I then load the background spectrum for -1 order, and fit a
    David> poly(1)+gauss(1) (and no responses assigned).  So the resulting model
    David> defines the counts/s/A/area.  (where "area" means spectral region
    David> width of 1 unit).  This model gives a reasonable reproduction of the
    David> LETG/HRC-S background.

To get counts/s/A/area, you can load the background pha file, and then 
scale to 1/area:

  isis> f = "background_pha.fits" ;
  isis> h = load_data( f );
  isis> b = fits_read_key( f, "BACKSCAL" ) ; 
  isis> c = get_data_counts( h ) ;
  isis> c.value /= b ;
  isis> put_data_counts( h, c ) ; 

Then fit the data with your model, and save it  e.g.,  save_par( "bg.par" ) ; 

(This assumes that the BACKSCAL is appropriate for the source spectrum
to be fit.)


    David> If I then try to use this model as a back_fun via:

    David> back_fun( 1, "get_data_exposure(1)*bin_width(1)*( poly(1)+gauss(1) )" ) ; 


That is also wrong.  It should be:

    isis>  back_fun( 1, "get_data_exposure( 1 ) * ( poly(1) + gauss(1) )" ) ;

or whatever background model you used.


    David> fit_fun("Powerlaw(1)");
    David> set_par( "Powerlaw(1).norm", 0.0, 0, 0, 1);

    David> I should recover the background model when I eval_counts.

... and now I do.




-- Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu.ezproxyberklee.flo.org/home/dph
MIT Kavli Institute for Astrophysics and Space Research
70 Vassar St., NE80-6065,
Cambridge, MA  02139
[Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden
----
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 Oct 31 2007 - 10:32:56 EDT

This archive was generated by hypermail 2.2.0 : Wed Oct 31 2007 - 10:34:34 EDT