HRC-S Gain Map and Filtering Software

HRC-S Gain Map and Filtering Software

Nov 25, 2008

The new gain map and filter have been incorporated into CIAO as of Dec. 15, 2009. This page will eventually be removed. Please see HRC-S Gain Map and LETG Background Filter.

Required Files

Users working on older data may wish to Generate a New Level=1.5 Event File.

Creation of an Augmented L1.5 File and New L2 File

The following steps effectively replace the Generate a New Level=2 Event File section of the CIAO LETG/HRC-S Grating Spectra thread.

The calculation of HRC-S SAMP and SPI data requires the presence of the AMP_SF, SUMAMPS, and RAWX/Y columns. By default, tg_resolve_events does not propagate these data to the L1.5 event list, so they must be copied from the L1 event list to an augmented L1.5 event list (evt1a_xtra.fits) using dmpaste.

$ dmpaste evt1a.fits 'evt1.fits[cols raw, amp_sf, sumamps]' evt1a_xtra.fits

In the process, the L1.5 REGION block is lost by dmpaste so it must be appended back onto the augmented L1.5 file.

$ dmappend 'evt1a.fits[region]' evt1a_xtra.fits

Also, the TLMAX value for the RAWY column was probably copied incorrectly by dmpaste (as of CIAO 4.0) so that must be fixed.

$ dmhedit evt1a_xtra.fits none add `dmlist evt1a_xtra.fits header,raw | grep -i rawy | grep -i ttype | perl -ple 's/.*ttype(\d+).*/tlmax$1/i'` 49151 datatype=long

(That ugly dmlist pipe is extracting the header TLMAX keyword corresponding to the RAWY column; it ultimately evaluates to something like tlmax23. Please cut and paste the command to avoid confusion between apostrophes and backticks.)

Now the default L2 status bit and GTI filters can be reapplied, along with RAWY filtering to remove high-background, badly behaved pixels near the plate gaps. (This extra RAWY filtering will be implemented via a revised badpixel map in a future CALDB release.)

$ dmcopy 'evt1a_xtra.fits[rawy=:16383,17070:32200,32980:,status=xxxxxx00xxxx0xxx0000x000x00000xx]' evt1a_xtra_flt.fits opt=all
$ dmcopy 'evt1a_xtra_flt.fits[events][@std_flt1.fits]' evt2.fits opt=all

Application of the Gain Map and SPI Filtering

Finally, addspi adds the SAMP column, calculates the appropriate time-dependent corrections to the gain map, and computes the gain-corrected SPI values. The resulting event file can then be filtered as a function of wavelength (tg_mlam) and SPI using spifilter. The gain map and programs can be downloaded here. Both programs are written in Perl and require the PDL and Astro::FITS::CFITSIO modules.

$ addspi evt2.fits evt2_spi.fits
$ spifilter evt2_spi.fits evt2_flt.fits

The final filtered output has been written to evt2_flt.fits. Users can now Extract a Grating Spectrum.

Contact

In case of software problems, please contact pratzlaff [at] cfa [dot] harvard [dot] edu.
For questions regarding development or application of the gain map/filter, please contact bwargelin [at] cfa [dot] harvard [dot] edu.