ISGRI spectral extraction

skip to content
INTEGRAL U.S. Guest Observer Facility
SPI: News! User Manuals Data IRFs and RMFs Documents & Links ISDC SPI page FAQs Contact

How to extract ISGRI spectra from the mosaic

last update of this page: 04.08.2005

Here I describe how I do the spectral extraction from ISGRI images for faint sources or to study a possible hard tail. This is one way to extract spectra. There is also the tool mosaic_spec available in OSA 5. I do not claim that the method described here is the best or most correct way. Use it with caution. Thanks to Jerome Rodriguez and Adamantia Paizis at the ISDC for their input!

ASCII version of this page for download and print-out.

  • Run ibis_science_analysis up to the IMA level, disable PICsIT, and set the OBS1_PixSpread parameter to "0". Use a clever energy binning. Remember that you can use only 10 energy bins. For sources which are bright and you want to have more energy bins, you might as well use the spectral extraction available through the script.
    I propose the following binning: 20, 25, 30, 40, 50, 60, 80, 100, 150, 300, 600 keV
  • Go to the results directory

  • Create a region file:

    cat2ds9 catDOL="isgri_srcl_res.fits[1]" fileName="ibisregion.reg"

  • Open the first intensity map:

    ds9 isgri_mosa_ima.fits\[2]

    and load the region file (you might edit the region file before, if there are too many 'NEW' sources displayed).

  • Zoom in and write down the pixel coordinates (X,Y) of the source you are interested in.
  • Now you have to extract the fluxes and errors at this position throughout the energy bins. In order to avoid a lot of opening and closing files manually you can use extract_flux.bat and extract_variance.bat. Make them executable (chmod u+x *.bat) and run them:

    extract_flux.bat isgri_mosa_ima.fits X Y > flux.dat
    extract_variance.bat isgri_mosa_ima.fits X Y > variance.dat

    where X and Y are the pixel coordinates of your source. Used like this, the sripts produce two ASCII output files, flux.dat and variance.dat, and the first script will also give you the exposure time at the given position.

  • The flux and error values have to be filled into a spectrum file. Here is an example of an ISGRI spectrum which you can use and fill with your values. Note that the first and last row are not used, unless your spectrum starts at 13 keV and ends at 993 keV. Note also that the extract_variance.bat script extracts variance values, so you have to apply sqrt(variance) in order to get the error value (this can be done inside fv after filling in the variance values. Also applying systematic errors can be done here).
  • Fill some keywords in the header of the ISGRI spectrum (use fv or the following ftools command):

    fparkey value=0 fitsfile=isgri_spectrum.fits\[1] keyword=TLMIN add=yes
    fparkey value={NUMBER OF BINS} fitsfile=isgri_spectrum.fits\[1] keyword=TLMAX add=yes
    fparkey value={NUMBER OF BINS + 1} fitsfile=isgri_spectrum.fits\[1] keyword=DETCHANS add=yes
    fparkey value={exposure time from the extract_flux.bat result} fitsfile=isgri_spectrum.fits\[1] keyword=EXPOSURE add=yes

  • If you used the binning as indicated above, you can just use this ISGRI_RMF.fits.
  • If you use a different binning: create a binning list like channel.lst. You find the channel/energy correlation in the ISGRI RMF group (e.g. $REP_BASE_PROD/ic/ibis/rsp/isgr_rmf_grp_0016.fits).
    Modify channel.lst according to your binning (it has to start with channel 0 and end with channel 2047). Then run rbnrmf on it (here is the rbnrmf.par parameter file):

    rbnrmf infile="isgr_rmf_grp_0016.fits" ebdfile="%" binfile="channel.lst" outfile="ISGRI_RMF.fits"

  • Use the ARF available for ISGRI. Unfortunately there is only one ARF available at the moment (isgr_arf_rsp_0006.fits), so off-axis effects are not taken into account at this point (as far as I understand it).
  • Write the ARF and RMF into the header of your spectrum file:

    fparkey value=ISGRI_RMF.fits fitsfile=isgri_spectrum.fits\[1] keyword=RESPFILE add=yes
    fparkey value=isgr_arf_rsp_0006.fits fitsfile=isgri_spectrum.fits\[1] keyword=ANCRFILE add=yes

Now the spectrum (isgri_spectrum.fits) is ready to be used inside XSPEC :

data isgri_spectrum.fits
cpd /xs
setpl energy
mo po
fit 1000
flux 20,200
plot ldata

In case of questions and comments: contact me.