Thursday, November 30, 2006

Simultaneous fitting of source and background

Caroline Kilbourne points out that the new multiple source capability of xspec provides a clearer way of simultaneously fitting the source and the background. Suppose we have a spectrum source.pi which includes our source and some background and another spectrum back.pi which just contains background. These files have responses source.rsp and back.rsp, respectively. We now read these in by

XSPEC12> data 1:1 source.pi 2:2 back.pi
XSPEC12> resp source.rsp back.rsp
XSPEC12> resp 2:1 source.rsp

Now we set up the model for the background as the default model

XSPEC12> model ....

and the model for source as the second model

XSPEC12> model 2:source ....

The default model now has linked parameters across the two datasets while the second model just contributes to the model for source.pi.

Randall Smith suggests it would be nice to be able to fit models to the background which is read in as a background file eg something like

XSPEC12> data source.pi
XSPEC12> back back.pi
XSPEC12> resp source.rsp
XSPEC12> model ....
XSPEC12> model back ....

Note that this would also require us to be able to associate a background response matrix with the background spectrum eg

XSPEC12> resp back back.rsp

Keywords: HEAsoft, xspec

xselect.mdb update for Suzaku

Switched the default WMAP from SKY to DETECTOR and removed the TIME-OBS and TIME-END from the catalog display since these keywords are no longer used in the event file.

Keywords: HEAsoft, xselect, Suzaku

Tuesday, November 28, 2006

setplot id produces garbage in v11

K.D. Kuntz reported that xspec v11 produces garbage plots when setplot id is used. This was due to a mismatch in string lengths which is fixed in v11.3.2aa.

Keywords: HEAsoft, xspec

Wednesday, November 22, 2006

extractor bug when event file has 1 event !

Phil Evans and Laurence Tyler report from the Leicester Swift team that extractor core dumps when extracting an event file from multiple inputs if the second file has only 1 event. They tracked the problem to a floating divide by zero due to an uninitialized variable in xclock called from w_events. I fixed this by removing the xclock call because it makes no sense in w_events because we don't know the total number of events which will be written. Fixed in v4.71.

Keywords: HEAsoft, xselect, Swift

Thursday, November 16, 2006

extractor and physical coordinates

Added support for ds9 region files in physical coordinates. This is in addition to the options already supported of image, fk4, or fk5 (with the last two either in degrees or hms). v4.70.

Keywords: HEAsoft, extractor

extractor bug when using TIME as a filename filter

Stephen Holland points out that when using the TIME column in a filename filter eg test.evt[TIME=1.2e8:1.3e8] the exposure and gtis are not set correctly. Most people don't do this and it is not used in xselect. This bug is fixed as v4.69.

Keywords: HEAsoft, extractor, xselect

Wednesday, November 08, 2006

subtle problem in xselect filter intensity

Phil Evans spotted a subtle problem using filter intensity. Extra time is rejected at the start and end of each gti of the lightcurve used as the basis of the intensity filtering. The reason is that the lightcurve assigns a time to the center of the bin and these times are used by maketime to create the filter gtis. We used prefr=postfr=0.5 in maketime so that if bin I does not satisfy the filter and bin I+1 does then the starting time of the gti is (t(I)+t(I+1) )/2, which is correct. However, if the first or last bin of an input gti satisfies the filter then maketime just uses t(I) leading to the loss of half a bin. I've corrected this by writing a perl script called by the filter intensity command which creates a new temporary lightcurve with extra bins before and after each gti (and with rate=0). This temporary lightcurve is used as the input for maketime and ensures that no time is lost. A test is to do a filter intensity with range 0.0-* then extract a new lightcurve. The result has exactly the same gti as the pre-filtered lightcurve.

Keywords: HEAsoft, xselect

faking XMM RGS spectra in xspec v11

Piero Ranelli reports that using the background file produced by the SAS tool rgsbkgmodel in xspec v11 fakeit produces errors. The cause was an array overflow in wrtfak.f because I'd not increased the size to allow for up to 7 columns in the output spectrum. This problem does not occur in v12. Fixed as 11.3.2z.

Keywords: HEAsoft, xspec

Tuesday, November 07, 2006

xspec v11 inibin and stwght fixes

Backed out the change to inibin which attempted to have the energy range warning write out once per fit at chatter level 10. A bug caused the message to be written every iteration and the basic idea has a flaw anyway. So now back to writing the message every iteration but at chatter level 15. Bug fix 11.3.2x.

For the weight command trapped the case of no datasets read in. Now writes a warning message and returns immediately. This fixes a bug that if the weight command was used before readinga dataset a then subsequent use of the weight command required an explicit dataset number to have any effect. Bug fix 11.3.2y.

Keywords: HEAsoft, xspec

Saturday, November 04, 2006

xspec tcl script to run multiple fakeits

A handy new script to run fakeit many times for a given input response, background and model then write the results to a FITS binary table. At the moment the script only works for one input file and just does a fit after each fakeit and stores the resulting parameters. It thus provides a way of testing for bias in the fit statistic. The next step is to allow testing for bias in the production of confidence regions.

Updated 9/16/06 with improved speed and error-checking.

Keywords: HEAsoft, xspec

Friday, November 03, 2006

extractor for events with differing WCS

Giacomo Vianello pointed out a confusion in using extractor (actually extract in xselect) when multiple event files with differing WCS are read. The extracted image has sky coordinates corrected to the same WCS however the extracted event file does not. This means that doing a straight extract image produces a sensible looking image but doing an extract events followed by an extract image produces multiple sources. I've checked in a fix (as v4.68) which corrects this and transforms sky coordinates to the same WCS when extracting events. This is at a slight cost in speed but only for the case when WCS differ.

Keywords: HEAsoft, xselect, extractor