Extraction OR mos/pnspectra

For each individual chip (MOS) or quadrant (pn) the mosspectra or pnspectra routine extracts the spectra from both the user specified region of interest (which may be the full FOV) and the corner, and does so for both the observation and the FWC data. These four spectra, extracted from each chip, are required to construct the QPB spectrum of the region of interest; that construction is done by mosback and pnback.

It should be noted that mosspectra and pnspectra extracts spectra and, if the withimages parameter set, images as well. The energy band parameters, elow and ehigh, specify the energy band of the images; in all cases the spectra are extracted for the entire XMM-Newton band.

There are several different layers of event filtering done within mosspectra and pnspectra. First, the PATTERN$<$=12 and ((FLAG & 0x766aa000) == 0) filters are applied for the MOS, and the PATTERN filter (user selected to be either 0 or $<$=4) and ((FLAG & 0xcfa0000) == 0) filter is applied for the pn. Second, the user specified energy selection is applied for images. Third, if the P-bkgregBdet.fits file exists, events in the point source regions are excluded. Finally, if the file indicated by the region parameter exists, the events are further filtered by region. Of course, all of these selections are done simultaneously, with a rather complex selection expression. If the file indicated by the region parameter does not exist, or is empty, then the spectrum and images will be extracted from the entire FOV.

The calls to mosspectra and pnspectra can be simple, relying on default file names, for example:

mosspectra eventfile=mos1S001-allevc.fits
withsrcrem=yes maskdet=mos1S001-bkregtdet.fits
masksky=mos1S001-bkregtsky.fits
withregion=yes regionfile=regmos1.txt
keepinterfiles=yes pattern=12
withimages=yes
elow=350 ehigh=1100 ccds="T T T F F F T"


or the input/output file names can be more expressly specified:

mosspectra eventfile=mos1S001-allevc.fits
withsrcrem=yes maskdet=mos1S001-bkgregtdet.fits
masksky=mos1S001-bkregtsky.fits
cornerfile=mos1S001-corevc.fits
imagefile=mos1S001-fovimt.fits
expmap=mos1S001-expimt.fits
spmask=mos1S001-fovspdet.fits
specfile=mos1S001-fovt.pi
rmfile=mos1S001.rmf arffile=mos1S001.arf
withregion=yes regionfile=regmos1.txt
pattern=12 keepinterfiles=yes
withimages=yes
elow=350 ehigh=1100 ccds="T T T F T F T"


For the pn

pnspectra eventfile=pnS003-allevc.fits
ootevtfile=pnS003-allevc-oot.fits
withsrcrem=yes maskdet=pnS003-bkgregtdet.fits
masksky=pnS003-bkgregsky.fits
withregion=yes regionfile=regpn.txt
keepinterfiles=yes pattern=0
withimages=yes
elow=350 ehigh=1100 quads="T T T T"


In these rather lengthy calls, quite a few input parameters can be ignored if the user is willing to accept the default names for the output files. As a result, we can divide the parameters into required parameters and more cosmetic ones. The essential input parameters are the event file name (in the case of the pn, the OOT event file name as well), the ccds to be included, and the flags for source removal, withsrcrem, region specification, withregion, and image production withimages. For source removal one needs to specify the .fits format source region file maskdet=P-bkregtdet.fits and masksky=P-bkregtsky.fits. For region specification one needs to specify the regionfile parameter. For image construction one needs to specify the energy limits for those images, elow and ehigh.

In these calls, region=regm1.txt is an ascii file containing region descriptors in detector coordinates[*] for the region of interest. The format of the region descriptor files is discussed below. If the selection is to exclude point sources then cheese or an equivalent must have previously been run.

One must specify which CCDs (for MOS) or quadrants (for pn) are to be included, as a string of booleans; “T” for including a CCD or quadrant, and “F” to excluding a CCD or quadrant. (Note that this is a change from previous versions of ESAS.) Be sure to mark as excluded chips that are in an anomalous state or chips that are not operating, such as MOS1 CCD#6 after it was lost to a micrometeorite strike. It is necessary to exclude CCD#1 if it is in small window or timing modes. It is also necessary to exclude chips with no valid events[*].

For the pn the pixel pattern can be set, pattern=0 will select single pixel events while pattern<=4 will select both single and double pixel events. As discussed above, both of these choices have their advantages, and one may want to extract both spectra for some types of analysis. One could set the pixel pattern for the MOS, but it must be set to 12 for the current version of ESAS.

One can also specify the names of many of the output files, cornerfile, imagefile, expmap, spmask, specfile, rmffile, and arffile, but that is not necessary.

It should be noted that both espfilt and mosspectra/pnspectra extract the event list for the corner data. We strongly suggest that the P-corevc.fits file produce by espfilt be removed from the working directory before running mosspectra/pnspectra because we need the filtering of the corner data to be consistent between the current observation and an existing database of corner data. We can't guarantee that the espfilt filtering in future versions will remain consistent as that routine has different needs.

The output of each run of mosspectra is the following lists of files. The first list contains files created with withimage=no:

P-corccdN.pi
- observation data in the corner region for chip N (which does not exist for chip 1). This file is an intermediate step needed by mosback. An oot file is also produced by pnspectra.
P-corevc.fits
- event file for the corner regions.
P-corfwcccdN.pi
- filter-wheel closed data in the corner region for chip N (which does not exist for chip 1). This file is an intermediate step needed by mosback. An oot file is also produced by pnspectra.
P-expimt.fits
- exposure map in sky coordinates for 300-8000 keV
P-fovccdN.pi
- observation data in the region of interest for chip N. This file is an intermediate step needed by mosback. An oot file is also produced by pnspectra.
P-fovfwcccdN.pi
- filter-wheel closed data in the region of interest for chip N. This file is an intermediate step needed by mosback. An oot file is also produced by pnspectra.
P-fovimspdet.fits
- image of the region of interest over all energies in detector coordinates. This will be used by proton to generate the soft proton image
P-fovimt.fits
- image of the region of interest in the specified energy band in sky coordinates. Even if one is not interested in producing images, this is useful diagnostic image to check to make sure that you have included only the correct region for your spectrum. An oot file is also produced by pnspectra.
P-maskimt.fits
- mask for the region of interest.
P-fovt.pi
- spectral data for the entire region of interest (i.e., the FOV excluding the excised point sources and certainly excluding the corner data)
P.arf
- the auxiliary response file for the region covered by P-fovt.pi
P.rmf
- the redistribution matrix for the region covered by P-fovt.pi
where P is a prefix such as “mos1S001” and n is the chip number. The P-fovfwcccdN.pi, P-corfwcccdN.pi, P-fovccdN.pi, and P-corccdN.pi files will be used by mosback or pnback to create the QPB spectrum/image for the region of interest. For the pn, each of the spectrum (*.pi files) will have an analogous counterpart with N running from 1 to 4 over the quadrant numbers. There will also be an oot counterpart for each spectral file.

The output files listed above are for the entire energy range (spectroscopic files) or for the 0.3-8.0 keV range (imaging files). These files are always produced for the same energy ranges no matter what the specified elow and ehigh. This second list contains output images that are created when mosspectra or pnspectra are run in imaging mode (withimages=yes, elow!=0 and/or ehigh!=0):

expimccd1-elo-ehi.fits
- The exposure map for CCD1 in detector coordinates.
expimsky-elo-ehi.fits
- The exposure map for all selected CCDs in sky coordinates.
fovimccd1-elo-ehi.fits
- The object image in detector coordinates for CCD1.
fovimdet-elo-ehi.fits
- The object image for all selected CCDs in band elo-ehi in detector coordinates. This file will be needed by the proton task.
fovimsky-elo-ehi.fits
- The object image for all selected CCDs in band elo-ehi in sky coordinates.
fwcimccdNdet-elo-ehi.fits
- The FWC data within the FOV for CCD N.
maskimccd1-elo-ehi.fits
- Mask file for CCD1 in detector coordinates.
maskimsky-elo-ehi.fits
- Mask file for all selected CCDs in sky coordinates. An oot file is also produced by pnspectra.
where elo-ehi is the band selected by elow and ehigh.