Re: background

From: Manfred Hanke <Manfred.Hanke_at_email.domain.hidden>
Date: Tue, 24 Feb 2009 22:30:14 +0100
Hi,

> 1. Suppose I have a spectrum with corresponding response and background 
> files, and I use "define_back" to load the background file and associate 
> it with the spectrum.
> What does this do? Does it subtract the background from the data before 
> a model is fit to it, like xspec? Or does it add onto the model in lieu 
> of an explicitly modeled background? If the latter is true,
I think it is.
Except for plotting issues, it shouldn't matter, as
data - background - model  =  (d - b) - m  =  d - (b + m)

 > how does the fit algorithm account
 > for the statistical error on the background?
> 
> Also, is "define_back" sufficient to include a treatment of the 
> background in spectral fitting, or must further steps be taken during 
> the fitting process?
> 
> 2. I can load a type I pha spectrum with corresponding type I pha 
> background (e.g. XMM RGS data). What about HETGS data? The background 
> information is contained in the columns BACKGROUND_UP and _DOWN of the 
> main type II pha spectrum file, or it can be split off into a separate 
> type II file. But "define_back" only takes type I pha files. Does this 
> mean I need to split off the background into type I pha files? Or is 
> there a more elegant way to do this?

I'm using the following code which I've copied from somebody in my very 
first days with ISIS:

   variable spec = load_data(specFile, row);
   variable back = load_data(backFile, row);
   variable s = get_data_counts(spec);
   variable b = get_data_counts(back);
   variable bp = fits_read_key(phaFile, "BACKSCAL"); % background scale
   variable bbu= fits_read_key(phaFile, "BACKSCUP");
   variable bbd= fits_read_key(phaFile, "BACKSCDN");
   variable scale = bp/(bbu+bbd);
   s.value -= b.value*scale;
   variable err = sqrt(s.value + scale*scale*b.value); % assuming Poisson
   delete_data(spec);
   delete_data(back);
   spec = define_counts(s.bin_lo, s.bin_hi, s.value, err);
   set_data_info(spec, info);
   set_data_exposure(spec, exposure);

I wonder whether this is still the way of doing it (which we probably 
wouldn't call an elegant one), so I bet that this is something that will 
be improved in a new version of ISIS -- if it hasn't been done already.

> 3. How can I plot a background subtracted spectrum?
Mike Nowak has a set of indeed very nice plotting routines, which he 
provides at 
http://space.mit.edu/home/mnowak/isis_vs_xspec/download.html. You can 
directly use his ISIS startup file .isisrc, but be careful not to 
overwrite your own ~/.isisrc in case you have one!
The function you're probably looking for is plot_bsub_all.

> I also have one other unrelated question. When I load XMM RGS data into 
> isis, I can only plot it in keV. _isis_plot.x_unit does not seem to 
> affect this. How can I change back to Angstrom?
That's just
    plot_unit("A");
I think, the behaviour of Mike's plot_bsub_* functions can be changed 
with his function Plot_Unit.

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 Tue Feb 24 2009 - 16:30:29 EST

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