next_inactive up previous


Version 5.9: April 15, 2014

COOKBOOK FOR ANALYSIS PROCEDURES FOR XMM-NEWTON
EPIC OBSERVATIONS OF EXTENDED OBJECTS AND THE
DIFFUSE BACKGROUND

Updated for SAS Version 13.5

S. L. SNOWDEN

Code 662, NASA/Goddard Space Flight Center, Greenbelt, MD 20771
steven.l.snowden@nasa.gov

AND

K. D. KUNTZ

Johns Hopkins University, Baltimore, MD
kuntz@pha.jhu.edu

ABSTRACT

The following manual/cookbook is for the use of the XMM-Newton Extended Source Analysis Software (XMM-ESAS) package for the analysis of imaging mode EPIC MOS and pn observations. XMM-ESAS, which was a stand-alone package of FORTRAN 77 routines and perl scripts in the initial public release, became an integral part of SAS with the release of MOS tasks with SAS V9.0. With the release of SAS V11.0, analysis of pn data was also supported completing the basic set of tools. With the release of SAS V13.0 all FORTRAN 77 routines were converted to FORTRAN 90/95. The next major upgrade will be to have most CalDB files included directly in the CCF system.

The package includes tasks that create source and model particle background spectra and exposure-corrected, background-subtracted (particle, soft proton, and solar wind charge exchange) images. The spectra and images are produced for user-defined regions within an observation field of view. The output files are in standard FITS format. Software for mosaicking multiple observations of not necessarily co-aligned observations is included in this package. Tasks are also included which allow the processing of mosaic-mode observations.

We would like to thank members of the MOS and pn hardware and software teams, the XMM-Newton SOC at the European Space Astronomy Center (ESAC), and other members of the EPIC Background Working Group for their contributions that ranged from helping us to understand instrument and software issues to the identification of filter-wheel closed observations in the archive. Carlos Gabriel and Aitor Ibarra of the SOC and Brendan Perry of the NASA GOF deserve special thanks for their efforts in converting XMM-ESAS routines into SAS tasks. We would also like to thank the many users that have provided comments about this software.

Users of this package should be aware of the informational web pages covering the background issues of EPIC observations at: http://xmm.esac.esa.int/external/xmm_sw_cal/background/index.shtml
and the EPIC Calibration Status document at:
http://xmm.esac.esa.int/external/xmm_sw_cal/calib/index.shtml.


Contents


List of Figures

Caveat Emptor

20pt1) Be very careful about running more than one SAS task at a time in the same directory. This can have unforeseen consequences which may not be obvious, and will often produce erroneous results. It is our strong recommendation that this not be done, ever.

20pt2) Observations with small filtered exposures ($\sim5$ ks or less) are likely to be problematic due to the limited number of events in the unexposed corners of the detectors (decent statistics are needed for accurate background modeling). Exposures in the $\sim5-10$ ks range can also be problematic, particularly for the pn, with the QPB being over- or under-subtracted. When the QPB is under-subtracted the fitting of the SP component can correct for this effect, but in an uncertain manner with unknown systematics.

20pt3) Fitting the SP component when the residual contamination is relatively small can produce unreasonable values for the spectral index, especially for the pn. The fitted index can run away to large values, either positive or negative. In general, reasonable indices lie between 0.15 and 1.5 when fitting a single power law or 0.1 and 2.5 for a broken power law. Note that when the fitted value for the SP normalization drops below a few times $10^{-3}$ (for the full FOV) the values are effectively zero. There is no practical difference between normalizations of $10^{-4}$ and $10^{-30}$.

20pt4) In this document many times when examples of task calls are provided they are broken into multiple lines for clarity. When actually invoking a task all parameters should be on one line (or the lines should be ended with the proper continuation character).

20pt5) Changes to enable processing of MOS1 data after the loss of CCD#3 have been included in the V13.0.3 release. Specifically, MOS1 CCD#4 suffered some collateral damage increasing the low energy background tail at higher values for DETX. Task modifications have been prepared which will recover data from $\sim75$% of the CCD. These tasks may change with more experience with affected data.

And a Request

If the ESAS package has been useful for the publication of your results, we would appreciate an acknowledgment in your paper. It will help with our statistics and the justification of our continued existence of the XMM GOF, well, at least for our continued work on the software.

1 CHANGE LOG




SAS         Task     Change
V10.5 pn_back Additional diagnostic output
$-$ espfilt Improve the output plotting
$-$ CalDB files Extensive reformatting of files requiring changes in multiple tasks
$-$ pn_back New release $-$ still under development
$-$ cheese-bands New release
$-$ proton_scale Parameter and input file changes for mode=2
$-$ mos_back Bug fix affecting Mac users
$-$ proton Combined CCF flare files
$-$ comb Updated scale factors for merging data from different filters $-$ assumed
    hardness now selectable
$-$ merge_comp_xmm Same as comb
$-$ swcx Cast SWCX background images
V11.0 CalDB Updated QPB and FWC files $-$ NEW DOWNLOAD REQUIRED
$-$ mos_back Check for MOS1 CCD#6 status
$-$ mos-spectra Check for MOS1 CCD#6 status
$-$ proton Check for MOS1 CCD#6 status
$-$ swcx Check for MOS1 CCD#6 status
$-$ bin_image Implement SWCX processing
$-$ bin_image_merge Implement SWCX processing
$-$ adapt_2000 Implement SWCX processing
$-$ merge_comp_xmm Implement SWCX processing
$-$ conv-region Simplify region description for multiple observations
V12.0 CalDB Updated QPB and FWC files $-$ NEW DOWNLOAD REQUIRED
$-$         $-$ Most critical is the conversion of MOS analysis to 5 eV channels
$-$ comb Bug fix and correct treatment of multiband exposure maps
$-$ bin_image Bug fixed
$-$ merge_comp_xmm Added units and comment line to output images
$-$ mos-filter Diagnostic output added to check for anomalous states
$-$ mos-spectra Convert MOS processing to use 5 eV channels
$-$ mos_back Fix ObsID misidentification in *-spec.qdp
$-$         $-$ Fixes required by changed file format for emask output
$-$         $-$ Changes required to implement 5 eV energy bins
$-$         $-$ Add additional diagnostic information in *-aug.qdp
$-$         $-$ Fixes required for updated QPB files
$-$         $-$ Fixes required for revised version of read_rmf
$-$ pn_back Fixes required for revised version of read_rmf
$-$ adapt_900 Add smoothing scale image and qdp plot output
$-$ adapt_2000 Add smoothing scale image and qdp plot output
$-$ swcx Add pulse-height smearing
$-$         $-$ Requires a new command parameter
$-$ read_rmf Subroutine in subs.f $-$ actually return the response matrix
$-$ cheese Fixes required by changed file format for emask output
$-$ make_mask_merge Fixes required by changed file format for emask output
$-$         $-$ Modify so that it will run with just the output from cheese
$-$ esmosaic_prep New task, companion task to prep_mosaic which adds
$-$         $-$ the correct pointing keywords to the fits headers of the separated
$-$         $-$ observation segments. Not a final solution but works with the
$-$         $-$ correct pixie dust sprinkled liberally.




SAS         Task     Change
V13.0 General Conversion of all FORTRAN 77 routines to FORTRAN 90/95
$-$ esprep_mosaic New task to allow processing of mosaic-mode observations
$-$ esprep_mosaic_time New task to extract the time intervals for mosaic-mode observations
$-$ esas-mosaic Driver task to overwrite header keywords for mosaic-mode observations
$-$ comb Bug fix for scalings using alpha between 1.7 and 2.4
$-$ merge_comp_xmm Bug fix for scalings using alpha between 1.7 and 2.4
$-$ conv_reg New task to convert region information from sky coordinates to detector
    coordinates
$-$ adapt_merge Renaming of adapt_2000 to adapt_merge
$-$ adapt Renaming of adapt_900 to adapt
$-$ Various Inclusion of clobber parameter
V13.0.1 esprep_mosaic_time Bug fix
V13.0.3 mos-filter Fix for processing MOS1 CCD#4 data after loss of CCD#3
$-$ espfilt Fix for processing MOS1 CCD#4 data after loss of CCD#3
$-$ mos-spectra Fix for processing MOS1 CCD#4 data after loss of CCD#3
$-$ mos_back Include corner data from CCD#2 and CCD#7 for the calculation of
    CCD#1 background
$-$ mos_back Bug fix - MOS background spectra uncertainties were too large
$-$ make_mask_merge Code improvement
$-$ rot-im-det-sky Bug fix and addition of modes to allow merging of masks
$-$ rot_det_sky Addition of modes to allow merging of masks

2 ESAS FLOW CHART

Figure 1: General flow chart for ESAS processing of XMM-Newton EPIC data for extended emission.
\begin{figure}\centerline{\psfig{figure=flowchart.ps,width=14.0cm,angle=0.0}}\end{figure}

3 INTRODUCTION

The XMM-Newton (Ehle et al. 2005) Science Analysis System (SAS) Extended Source Analysis Software (XMM-ESAS) package described here follows the methods outlined in Snowden et al. (2008) for the analysis European Photon Imaging Camera (EPIC) MOS (Turner et al. 2001) observations of extended objects and the diffuse X-ray background. XMM-ESAS was subsequently extended to include processing of pn (Strüder et al. 2001) observations. The analysis of pn data is similar to that of MOS data but has the added complication of needing to account for out-of-time (OOT1) events.

Two separate features are incorporated into XMM-ESAS, the capability of creating model quiescent particle background (QPB) spectra (Kuntz & Snowden 2008) for user defined regions of the detectors and the capability of creating background subtracted and exposure corrected images. Also included in the XMM-ESAS package is software to mosaic multiple and not necessarily coaligned observations of regions on the sky. These capabilities also extend to the correct handling of mosaic-mode observations.

4 CAVEATS


4.1 Mosaic-Mode Observations

Processing of mosaic-mode observations is now included in ESAS, but with some cautions. The extraction of time intervals and therefore effective pointing direction for individual subpointings is done in an empirical manner which has worked so far in all observations which have been processed. However, there may be pathological cases where the separation is not clean. If the final product looks odd, like all the events are offset in the field, possibly offset completely out of the field, the method has failed.

4.2 Detector Modes

The ESAS method for creating model background spectra and images relies on data from the unexposed (to the sky) corners of the detectors. This means that for the PN it is dependent on the detector mode, specifically, it can only process data from the Full Frame or Full Frame Extended modes. For the MOS detectors, CCDs #2 through #7 always operate in Full Frame mode providing ESAS-compatible imaging for all observations, at least for the outer CCDs. ESAS can also process the Large and Small Window modes for MOS CCD #1. However, if the central CCDs are operated in timing mode they must be deselected in mos-spectra (and other tasks where relevant).

4.3 PN Analysis

Note the pn detector mode caveat above.

While all pn-specific tasks are now included in the current SAS release, the tasks should still be considered to be under development. There may be an issue concerning an under- or over-estimation of the pn particle background, particularly for relatively short observations (less than $\sim10$ ks of good time). To an unknown (at this time) extent the fitting of the soft proton component (see below) probably corrects at least partially for this inaccuracy. This is likely to be at least partially due to the more limited statistics from the smaller area (than the MOS) of the shielded corners of the detectors, as well as having to correct the data for OOT events. Note that the pn has a very strong low energy tail. In general this limits the low energy cutoff for useful analysis to $>400$ eV, however, occasionally energies as high as 600 eV are affected. A lower energy hard limit for the use of the XMM-ESAS tasks is 300 eV.

4.4 Residual Soft Proton Contamination

Although a temporal filtering of the data will remove considerable contamination from soft proton (SP) flaring, and perhaps all of it for some observations, there is no guarantee that there will not be a significant residual flux. It has been our experience that this is the case for the majority of observations. We suggest an approach to account for residual SP contamination in the spectral fitting section below. Kuntz & Snowden (2008) characterizes the reasonable ranges of the variations in both the spectrum and spatial distribution over the detectors. Building on their results, tasks are included in this package which will spatially model fitted SP contamination in order to subtract it from images.

Figure 2: XMM-Newton MOS SWCX contaminated spectrum compared to an uncontaminated spectrum, both ObsIDs from the Hubble Deep Field North direction that were analyzed in Snowden, Collier, & Kuntz (2004). Note the very strong excess O VIII emission, as well as other line emission, in the SWCX spectrum. These are also lines of interest as diagnostics of astrophysical plasmas.
\begin{figure}\centerline{\psfig{figure=swcx.ps,width=8.0cm,angle=0.0}}\end{figure}

4.5 Solar Wind Charge Exchange Contamination

Solar wind charge exchange (SWCX) emission can contribute significantly to the observed flux below 1.5 keV (see Figure 2), as shown in Snowden, Collier, & Kuntz (2004). Carter & Sembay (2008) have published a method for identifying observations affected by SWCX emission based on the variation of the full FOV light curve for $E<1.35$ keV. The XMM-Newton GOF has created a ``Trend'' data base2 and associated software which will identify observations which have a greater likelihood of being affected by this SWCX emission based on both observation geometry and solar wind flux. SWCX emission may occur both near Earth where the solar wind interacts with exospheric material (e.g., Snowden et al 2009), or distributed through the solar system with targets being interstellar neutrals (hydrogen and helium) flowing through the solar system (e.g., Koutroumpa et al. 2009). The X-ray spectrum of the SWCX in the XMM-Newton band is dominated by line emission from ions that are also of astrophysical interest, e.g., O VII, and O VIII. The magnitude of the emission is strongly variable, as are the line ratios that follow the abundances and ionization states of the solar wind.

4.6 Methodology

Our methodology for producing model QPB spectra (Kuntz & Snowden 2008) and other background components is based as much as possible on ``first principles''. We attempt to model as many of the aspects as possible using a wide range of inputs, e.g., filter-wheel-closed data, data from the unexposed corners of archived observations, and ROSAT All-Sky Survey data. We avoid the use of blank-sky data as they include to an unknown level the contributions of the cosmic background, residual SP contamination, and solar wind charge exchange contamination. This is in part due to the fact that a significant part of our scientific interest lies in the study of the diffuse background so we need a method that would not throw out our ``signal''. Other methods, such at that of Arnaud et al. (2001), Read & Ponman (2003), and Nevalainen, Markevitch, & Lumb (2005), have relied more on blank-field data for their subtractions. A comparison between the methods used in the study of clusters of galaxies using Nevalainen et al. (2005) results is shown in Figure 3. As expected, the results of the two methods are in reasonably good agreement with the size of the uncertainties at large annuli being smaller using the XMM-ESAS method. At smaller annuli the background is small compared to the signal so any differences in the fit results are expected to be minor. Also included in Figure 3 are the results from the Chandra data analyzed by Vikhlinin et al. (2005). The discrepancy between XMM-Newton and Chandra was determined to arise from the Chandra calibration, which has been subsequently corrected.

Figure 3: Comparison of the fitted temperature profile for the Abell 1795 cluster of galaxies as determined by the (red) XMM-ESAS method, the (blue) double background subtraction method of Nevalainen, Markevitch, & Lumb (2005), and the (green) Chandra analysis of Vikhlinin et al. (2005).
\begin{figure}\centerline{\psfig{figure=A1795-compare.ps,width=8.0cm,angle=-90.0}}\end{figure}

4.7 Sparse Sampling

Except for the centers of bright clusters of galaxies and particularly bright supernova remnants, most observations of extended sources will be photon limited, i.e., there will be insufficient detected events to make use of the full EPIC angular resolution ($\sim6''$ FWHM on-axis) beyond the excision of point sources. Even these bright sources will be photon limited at high and low energies where the instruments' effective areas fall off. Binning of the data will therefore be needed to pursue any significant scientific studies. The pixel size of the images produced by XMM-ESAS is $2.5''$, which is a fine enough sampling to provide sufficient flexibility for creative binning (e.g., binning by high-resolution optical data) and the removal of contaminating point sources.

5 OVERVIEW


5.1 The XMM-ESAS Package

The purpose of the XMM-ESAS package is to provide the tools required for the analysis of spectra and images of extended diffuse emission. Its primary functions are to 1) measure, construct, and remove several different non-cosmic background components, 2) provide a relatively automated method for reducing extended diffuse data, and 3) provide a means for mosaicking images of extended emission (background, exposure, and inter-instrument normalizations).

The original XMM-ESAS package consisted of a group of IDL routines and a number of perl scripts used to call both SAS tasks and the IDL routines in the correct order. In the second version (the initial public release), the IDL routines were replaced with FORTRAN for portability, and the perl scripts were cleaned, updated, and extended. The third version of the package saw the FORTRAN routines and perl scripts incorporated into SAS. The fourth version saw the conversion of the FORTRAN routines from FORTRAN 77 to FORTRAN 90/95. The fifth, and hopefully final version will see the addition of the ESAS CalDB files into the SAS CCF. The XMM-ESAS package before you consists of a (growing) number of SAS tasks which continue to add various funtionalities. Some of these SAS tasks are direct inclusions of FORTRAN routines. Others are the appropriately SASified versions of the perl scripts, meaning that the perl has been translated into SAS standard perl. If you should have some special circumstance not covered by the existing routines, you can probably accomplish what you need using basic SAS functions. On the other hand, if there is something nifty that you would like to accomplish that can't currently be done, please contact us with suggestions as we are always open to adding new funtionalities. A complete alphabetical list of SAS routines appears at the beginning of Appendix A. The next section contains the step-by-step instructions for using each of the routines in the order they need to be applied.

There are CalDB files associated with the XMM-ESAS tasks that contain filter wheel closed (FWC), QPB, and SP calibration data. The files are required for the processing both spectra and images. These files are not included in the standard CCF download (yet, they should be part of the CCF by 2013 fall or 2014 spring) and must be downloaded separately from the site:
ftp://xmm.esac.esa.int/pub/ccf/constituents/extras/
    esas_caldb/
Your local directory containing the CalDB data is used as an input parameter in many of the tasks.

6 XMM-ESAS COOKBOOK

The XMM-ESAS package produces a fairly large number of intermediate files during the processing of an observation data set. While a task is included to remove many of them in the end, they shouldn't in general be touched while the processing is in progress. However, as discussed below, if spectra are required from multiple regions of the same exposure, the final products (e.g., spectral files, RMFs, and ARFs) must be renamed. Some (e.g., spectral files from the region of interest) will be overwritten while others (e.g., the RMFs, ARFs, and spectra from the unexposed corners of the detectors) will not. (see § 6.6). For some tasks a ``clobber'' parameter can be set to allow or stop the overwriting of files. The operational premise is that a user extracting multiple spectra will want to rename the basic files anyway. On the other hand, a user extracting multiple bands from the same image will be extracting data from the full FOV and therefore the basic files will remain the same, and will not need to be created each time speeding up the processing.

6.1 Setup

Far be it from us to define a user's directory structure for them, but over the years the authors have found that it is convenient to have a specific setup. First a main directory is created using the ObsID number of the observation to be processed, e.g., /path/0097820101 for the test case of Abell 1795 (where /path is wherever you want to place the data on your computer). Under the main directory two subdirectories are created, /path/0097820101/odf for the ODF data files and /path/0097820101/analysis for all of the processing output. The ODF data for the observation should be copied to the /path/0097820101/odf directory and uncompressed. SAS should be set up to run in the /path/0097820101/analysis directory (the local directory) making sure that the paths are correctly set, e.g.:

setenv SAS_CCF
/path/0097820101/analysis/ccf.cif

setenv SAS_ODF /path/0097820101/odf
setenv SAS_CCFPATH /ccfpath/CCF

It is necessary to point to an existing CIF file or to explicitly run cifbuild to create it. An ODF summary file (*.SAS file) is also needed and which is created by running the task odfingest. This can be accomplished using the following two commands:

cifbuild withccfpath=no analysisdate=now
category=XMMCCF calindexset=$SAS_CCF
fullpath=yes

odfingest odfdir=$SAS_ODF outdir=$SAS_ODF

These commands will produce the necessary ccf.cif file in the analysis directory and the *SUM.SAS file in the odf directory. Note that while often it is not necessary to create a new ccf.cif file each time ODF data are processed (i.e., it is possible to have a single, up-to-date file for general use), it takes little time to run cifbuild and you will be assured that you are pointing to the most recent versions of the CCF files (providing you keep the CCF directory properly updated). In addition, you will have a local version of the ccf.cif file listing precisely which version of the CCF files were used for the specific processing.

6.2 Initial ESAS Processing

The first processing step is to create filtered event files, which is done with tasks epchain (run twice for the normal and OOT processing of the event lists), pn-filter, emchain, and mos-filter, with the commands:

epchain withoutoftime=true
epchain
pn-filter
emchain
mos-filter

It is not overly time consuming (at least compared with the rest of the ESAS processing) so it is not unreasonable to rerun the chains to ensure that the most recent versions of the CCF and SAS software are used. Alternatively, the calibrated photon event files from the pipeline processing can be used. emchain will produce event files for all MOS1 and MOS2 imaging exposures (which includes the outer CCDs, CCD #2 - CCD #7, for timing observations). However, epchain by default will create event files for only the first imaging exposure and must be run explicitly calling out the exposure number if there are multiple exposures (e.g., epchain exposure=2). Note that because the QPB modeling requires data from the unexposed corners of the detector (both MOS and pn), only pn full frame and extended full frame exposures are useful as the pn the large and small window modes exclude the corner regions. The tasks pn-filter and mos-filter will find all of the imaging exposures processed by epchain and emchain, run the task espfilt to filter the data for SP flares, and create assorted diagnostic files.

Figure 4: Temporal filtering results for the MOS1S003 Abell 1795 cluster exposure with ObsID 0097820101. The upper panel plots the light curve histogram for the $2.5-8.5$ keV band from the FOV, the middle panel displays the $2.5-8.5$ keV band FOV light curve, and the lower panel displays $2.5-8.5$ keV band light curve from the unexposed corners of the instrument. The histogram is derived from the smoothed light curve. In the upper panel, the blue vertical lines show the range for the Gaussian fit, the green curve shows the Gaussian fit, while the red vertical lines show the upper and lower bounds for filtering the data. In the bottom two panels green points indicate accepted data while black points indicate data excluded by the filtering algorithm. The high count rate excursions are produced by soft protons rather than a higher-energy particle background flare as the latter case would produce a mirror increase in the MOS corner data light curve. The pn corner data do show an increase with SP flares because of OOT events.
\begin{figure*}\centerline{\psfig{figure=A1795-lc.ps,width=14.0cm,angle=-90.0}}\end{figure*}

The SAS task espfilt, which is called by both pn-filter and mos-filter, provides the light-curve cleaning. It creates two light curves and creates a high-energy count rate histogram from the field-of-view data. For a typical observation the histogram will have a roughly Gaussian peak at a nominal count rate (the count rate during time intervals unaffected, or at least minimally affected, by SP contamination) with a higher count-rate tail. Depending on how contaminated the observation is, the Gaussian peak can be very well defined or a small bump in the distribution. In the latter case, espfilt is unlikely to provide a reasonable result and may even fail completely, and the observation is probably unusable for the study of extended sources. In the former case, espfilt will fit a reasonable Gaussian to the peak and determine thresholds at plus or minus $1.5\sigma$. espfilt then creates an ASCII GTI file for those time intervals with count rates within the thresholds and uses the task evselect to filter the data.

After espfilt has run, mos-filter and pn-filter then rename the useful files, e.g., the filtered event files are renamed to mos``prefix''-clean.fits (hereafter we use the nomenclature, e.g., mosprefix-clean.fits where prefix is the unique exposure identifier, 1S001 for the MOS1 detector and the 001 exposure in this case3) and pnprefix-clean.fits, where as there is only one pn detector the prefix is of the form ``S003''. We stress again that this process does not necessarily remove all of the SP contamination, it only removes time intervals with obvious contamination, i.e., where the count rate is significantly enhanced over a nominal level. In general this provides a reasonable method for minimizing the SP contamination while still leaving the best data to be analyzed.

Figure 5: Temporal filtering results for the MOS1 Magellanic Bridge observation (0049150201). The SP flaring is so strong and affects so much of the observation that the data were not useful for the study of the diffuse emission in the field. Even the roughly 2.5 ks of low count rate exposure are likely to be still contaminated with residual soft protons.
\begin{figure*}\centerline{\psfig{figure=bridge-lc.ps,width=14.0cm,angle=-90.0}}\end{figure*}

mos-filter and pn-filter also create QDP plot files showing the light curves and indicating the accepted time intervals with names such as mos1S001-hist.qdp (i.e., mosprefix-hist.qdp, these are the renamed output from the task espfilt). The QDP files should be plotted and examined to determine whether the exposure is actually useful (see Figures 4 and 5 for examples). Note that ``cal-closed'' exposures (exposures where the instruments are exposed to the on-board calibration sources rather than to the sky) are occasionally included in the data sets (however, they are not processed), as well as short and often heavily contaminated exposures (they will be processed). These exposures are obvious from the light-curve plots and should be discarded. Figure 4 shows the plot for the mos1S003 exposure from the Abell 1795 observation. This is a clear example where there is likely to be residual SP contamination, as evidenced by the slight ripple in the nominally constant level of the light curve. While the selection criteria could be tweaked to remove more of the contaminated time intervals, there would still be no guarantee that there isn't some finite minimum contamination at all times. Figure 5 shows the plot for an observation much more strongly affected by SP flaring where the data are effectively useless for studies of diffuse emission. Unfortunately for the authors, this was one of their observations.

6.3 Examination of Data for CCDs in Anomalous States

Some of the individual CCDs in the MOS detectors can occasionally operate in anomalous states where the background at $E<1$ keV is strongly enhanced (see Kuntz & Snowden 2008 and Figure 6). XMM-ESAS at this time4does not adequately handle this situation and so the data must be screened and any affected CCDs excluded from further processing. The screening can usually be simply accomplished by checking the final diagnostic output of mos-filter and examining the soft band ($0.2-0.9$ keV) images (also produced by mos-filter, mosprefix-obj-image-det-soft.fits). The diagnostic output shows the corner hardness ratio and uncertainty for each CCD as well as the acceptable threshold. The soft band plots are images of the full FOV, including the unexposed corners (see Figure 7 for an example). The unexposed corner of an anomalous-state CCD will have many more counts those in their normal states. As the mission has progressed, those CDDs affected by anomalous states have in general been more frequently affected. Anomalous state CCDs can be excluded in further processing by an explicit CCD selection input in several of the tasks.

Figure 6: MOS1 spectra from FWC data with CCDs in their nominal state (red), CCDs #4 and #5 in their anomalous states (green) and CCD#4 (blue) in its anonymous anomalous state. Note the excess at energies less than 1 keV for the anomalous states. The data have been normalized so that the peaks of the Al K$\alpha$ lines ($E\sim1.5$ keV) are equal to 1.0. The variations in the strength of the Si K$\alpha$ is due to the relative variations of the line strengths over the area of the detector.
\begin{figure}\centerline{\psfig{figure=fwc-anom-spec.ps,width=8.0cm,angle=-90.0}}\end{figure}

Figure 7: MOS1 and MOS2 event images in the $0.2-0.9$ keV band showing the CCD IDs and two CCDs in anomalous states. The observation (ObsID 0402530201) was performed in 2006 June after the loss of MOS1 CCD#6 due to a meteorite hit (2005 March 9, $\sim$01:30 UT). MOS2 CCD#5 is clearly in an anomalous state, however MOS1 CCD#5 is in a fainter anomalous state as well.
\begin{figure}\centerline{\psfig{figure=mos-anom.ps,width=8.0cm,angle=0.0}}\end{figure}

If the observation is short, visual screening may not be sufficient. In that case, examination of the diagnostic output from mos-spectra described in § 6.5 will reveal the existence of anomalous states. However, it should be noted that the ``anonymous'' anomalous state of MOS1 CCD#4 is not always detectable from the unexposed corner data. Thus, comparing spectra from different CCDs is important for detecting (and removing) this anomalous state.


6.4 Detection and Excision of Point Sources

The cheese and cheese-bands tasks in XMM-ESAS (only one of which needs to be run) will run source-detection tasks and create source lists and masks (see Figure 8) for use in excising sources from spectra and images. In general for the analysis of diffuse emission it is desirable to remove the contribution of point sources in the field to a uniform threshold. The cheese and cheese-bands tasks will combine both MOS and pn data for the source detection creating images and exposure maps in a selected single band (cheese) or hard soft, and total (combined) bands (cheese-bands). They will create source lists that then can be used to create source-excluded spectra and make ``Swiss-cheese'' masks for image processing. The calls for cheese and cheese-bands are extensive, e.g.:


cheese prefixm="1S003 2S004" prefixp=S005
scale=0.25 rate=1.0 dist=40.0 clobber=1
elow=400 ehigh=7200


cheese-bands prefixm="1S003 2S004"
prefixp=S005 scale=0.25 ratet=1.0
rates=1.0 rateh=1.0 dist=40.0
clobber=1 elowlist="400 2000"
ehighlist="1250 7200"


where the prefixes of the MOS and pn exposures are called out. The scale=0.25 is the PSF threshold to which the point sources are masked, and is in terms of the fraction of the local background (i.e., a value of 0.25 means that the point source is removed down to a level where the surface brightness of the point source is one quarter of the surrounding background). The rate=1.0 and the ratet=1.0 rates=1.0 rateh=1.0 parameters are the point-source flux thresholds in units of $10^{-14}$ ergs cm$^{-2}$ s$^{-1}$. The dist=40.0 is the minimum separation for point sources in arc seconds (this avoids the excision of large areas of bright extended sources like the inner regions of clusters of galaxies). However, the dist parameter may need to be ``tuned'' to get the desired result. The clobber=1 allows existing files to be overwritten and elow=400 and ehigh=7200 and the elowlist='400 2000' and ehighlist='1250 7200' are the energy band limits in eV for the source detection.

Figure 8: MOS1 cheese image from the Abell 1795 observation.
\begin{figure}\centerline{\psfig{figure=cheese.ps,width=8.0cm,angle=0.0}}\end{figure}

Occasionally the source detection algorithms will miss an obvious source. This can happen when the source lies, for instance, is the gap between CCDs on one of the detectors. Because of this effect we recommended the simple test of using the blink function in $ds9$ to flip between the cheese image and the event sky image for each detector.

ds9 mos1S003-obj-image-sky.fits
mos1S003-cheese.fits &

There are a number of circumstances in which one would like to use a different or external source list to generate the masks. This can be done in a relatively straightforward manner by modifying the external source list so that it has the same format as the emllist.fits file. Most of the columns do not matter for the purposes of making a mask, but the RA, Dec, RADEC_ERR, should all be populated with the correct values. The DIST_NN column should be set to a large number (like 1000) so that the make_mask routine will not merge sources. Then, for each observation:

region eventset=mos1S001-clean.fits
operationstyle=global
srclisttab=extern_emllist.fits:SRCLIST
bkgregionset=mos1S001-bkg_region-det.fits
energyfraction=0.85 radiusstyle=enfrac
outunit=detxy verbosity=1
region eventset=mos1S001-clean.fits
operationstyle=global
srclisttab=extern_emllist.fits:SRCLIST
bkgregionset=mos1S001-bkg_region-sky.fits
energyfraction=0.85 radiusstyle=enfrac
outunit=xy verbosity=1
make_mask inimage=mos1S001-obj-im.fits
inmask=mos1S001-mask-im.fits
outmask=mos1S001-stinky-cheese.fits
reglist=mos1S001-bkg_region-sky.fits
.

This sequence reproduces the actions of cheese for the user-modified source list extern_emllist.fits. The output cheese mask, mos1S001-stinky-cheese.fits, can replace the cheese output mos1S001-cheese.fits and used in standard ESAS processing or used as an explicitly added mask during image creation.


6.5 Creation of Model Particle Background Spectra and Images

The next step in the process is to run the tasks mos-spectra and pn-spectra. Depending on how they are called, they will produce intermediate files necessary to create model background spectra or both spectra and images. Both spectra and images can be produced for user-defined regions or the whole field of view. The calls to mos-spectra and pn-spectra are considerably more complicated than those of mos-filter and pn-filter, e.g.:

mos-spectra prefix=1S003 caldb=/CALDB
region=regm1.txt mask=1 elow=400
ehigh=1250 ccd1=1 ccd2=1 ccd3=1
ccd4=1 ccd5=0 ccd6=1 ccd7=1

mos-spectra prefix=2S004 caldb=/CALDB
region=regm1.txt mask=1 elow=400
ehigh=1250 ccd1=1 ccd2=1 ccd3=1
ccd4=1 ccd5=1 ccd6=1 ccd7=1

pn-spectra prefix=S005 caldb=/CALDB
region=regpn.txt mask=1 elow=400
ehigh=1250 quad1=1 quad2=1 quad3=1
quad4=1


In these calls, prefix=1S003, prefix=2S004, and prefix=S005 are the MOS1, MOS2, and pn prefixes as defined above, caldb=/CALDB is the CCF directory containing the FWC5 data, region=regm1.txt is an ascii file containing region descriptors in detector coordinates6 for the region of interest. The mask parameter does nothing (mask=0) or uses the filtered source exclusion regions produced by cheese (mask=1 for the total band) or cheese-bands (mask=1, 2, 3 for the total, soft, and hard bands). If the selection is to exclude point sources then cheese or cheese-bands must have previously been run. elow=400 and ehigh=1250 are the limits of the energy band (in eV) for the creation of the images, and the seven (MOS) or four (pn) ccd# or quad# include (ccd#=1 or quad#=1) or exclude (ccd#=0 or quad#=0) the seven MOS CCDs or four pn quadrants. For example, for data obtained later in the mission after MOS1 CCD#6 was lost to a micrometeorite strike, processing from that CCD must be excluded, i.e., set ccd6=0.

mos-spectra and pn-spectra also create spectra, RMFs, ARFs, event images, and exposure maps for the regions defined by region or for the full FOV. If only spectra are required, then the energy band limits can be set to elow=0 ehigh=0 and no image intermediate files will be produced. An empty or missing reg*.txt file will produce spectra and images for the entire field of view.

Figure 9: Plots showing the selection of data used for the augmentation of the corner spectra. Red points indicate the full set of data while black points indicate which data were selected. Note that CCD#5 is close to the region indicating anomalous data (grouping of points just slightly down and to the right of the green point), and so suggests further diagnostic monitoring, e.g., a smoothed soft-band image can be made and examined for enhanced emission from the CCD area.
\begin{figure*}\centerline{\psfig{figure=A1795-mos1-aug.ps,width=16.0cm,angle=-90.0}}\end{figure*}

6.5.1 Region Descriptors

The region descriptors in the regm1.txt, regm2.txt, and regpn.txt files are most easily determined using the xmmselect task in SAS. Using the xmmselect GUI, produce an image of the sky in detector coordinates (i.e., click the square boxes for DETX and DETY and then click Image, and then Run in the pop-up evselect GUI). In the image displayed in the ds9 window, define the desired region, and then click the 2D region button in the xmmselect GUI which will transfer the region descriptor to the Selection expression window. The region descriptor can then be copied to the reg*.txt file where the symbols ``&&'' must be added to the start of the string, for example:

&&((DETX,DETY) IN circle(300,500,1200))

where the numbers 300 and 500 are the DETX and DETY coordinates of the center of the extraction region and 1200 is the radius of the circular region. All numbers are in units of $0.05''$ so the specified region is $60''$ in radius. This process needs to be done separately for all instruments as the detector coordinates for a given sky region are different in each detector. To create an annulus extraction region, for instance for a $30''-60''$ degree annulus, the region expression is:

&&((DETX,DETY) IN circle(300,500,1200))
&&!((DETX,DETY) IN circle(300,500,600))

where the ``!'' sign is for the Boolean ``not''.

6.5.2 Point Source Masking

The use of point source masking is accomplished in two ways, by using mask images or source region lists produced by running the perl script cheese or cheese-bands (see § 6.4). If images are of interest then a simple masking of the data can be done by using the ``Swiss Cheese'' images. If the desire is to remove the source contributions to spectra then the source region lists must be used in the mos-spectra or pn-spectra calls, which is done using a calling parameter of the tasks. If point sources are removed from the spectra in the calls to mos-spectra and pn-spectra they are also removed from the images, and during the image creation process (see below) the images must also be masked using the Swiss-cheese images.

6.5.3 Creation of the QPB Spectra and Images

The tasks mos_back and pn_back take the intermediate files produced by mos-spectra and pn-spectra and turn them into model QPB spectra and images in detector coordinates. They must be run separately for each call of mos-spectra and pn-spectra with different region selections (spectral analysis) or different band selections (image analysis) The following are examples of their calls:

mos_back prefix=1S003 caldb=/CALDB diag=0
elow=400 ehigh=1250 ccd1=1 ccd2=1
ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mos_back prefix=2S004 caldb=/CALDB diag=0
elow=400 ehigh=1250 ccd1=1 ccd2=1
ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

pn_back prefix=S005 caldb=/CALDB diag=0
elow=400 ehigh=1250 quad1=1 quad2=1
quad3=1 quad4=1


where prefix is as defined above, caldb=/CALDB is the directory containing the QPB data, diag=0 is the diagnostic output control, elow and ehigh are the limits of the energy band for the creation of the images and must be the same as used in the mos-spectra or pn-spectra calls. The seven ccd#'s for mos_back and four quad#'s for pn_back must be the same as used in the mos-spectra and pn-spectra calls. Again, the prefix, energy limits, and CCD selections must be the same as those used in the mos-spectra and pn-spectra calls. Note that multiple bands can be run without overwriting vital files. However, as mentioned above, if multiple regions from the same exposures are extracted (e.g., for spectral analysis purposes such as investigating the radial profile of a cluster of galaxies) renaming of certain files is required (see § 6.6).

Figure 10: Upper Panel: Observed spectrum (red) and model QPB spectrum (green) for the full field of view for the MOS1 observation of the Abell 1795 cluster observation with ObsID 0097820101. Note the discrepancy at high energies where the model QPB is still low compared to the observed spectrum. This is another indication of residual SP contamination as first suggested by the low-level variations in the light curve for the nominally low intensities. Note the emission lines including the strong Fe line at $\sim6.5$ keV in the observed spectrum of Abel 1795. The smooth part of the model QPB at $\sim1.5$ keV is the ``bridge'' where the Al K$\alpha$ and Si K$\alpha$ fluorescent instrumental lines affect the data. Lower Panel: The complete filter wheel closed spectrum from the MOS1 instrument showing the very strong Al K$\alpha$ and Si K$\alpha$ fluorescent instrumental lines ($\sim1.49$ keV and $\sim1.75$ keV, respectively) on top of the continuum. Other fluorescent lines are visible at higher energies as well as a strong low-energy tail due to detector noise.
\begin{figure}\centerline{\psfig{figure=A1795-mos-spec.ps,width=8.0cm,angle=0.0}}\end{figure}

For each detector, mos_back and pn_back create up to five diagnostic files (various settings of the diag parameter) with names of the form mos1S001-*.qpb. Of these, the -aug.qdp file contains rate-hardness plots for the unexposed pixel data for each CCD with unexposed pixels (see Figure 9). These plots should be checked to ensure that rate and hardness for each CCD of the current observation does not fall in the ``anomalous state tail''. If this condition is not met for a CCD, it should be removed and mos-spectra re-run.

Figure 11: Upper Panel: Observed spectrum (red) and model QPB spectrum (green) for the full field of view for the pn observation of the 2A 0335+096 cluster with ObsID 0147800201. Note that besides the strong Fe emission line at $\sim6.5$ keV there are strong instrumental Cu lines in the observed spectrum. The smooth parts of the model QPB at $\sim1.5$ keV and 8 keV are the bridges where the Al K$\alpha$ and Cu (note that the pn is not affected by a Si K$\alpha$ line) fluorescent instrumental lines affect the data. Lower Panel: The complete filter wheel closed spectrum from the pn instrument showing the very strong Al K$\alpha$ and Cu fluorescent instrumental lines ($\sim1.49$ keV and $\sim8$ keV, respectively) on top of the continuum. Other fluorescent lines are visible at higher energies as well as a strong low-energy tail due to detector noise.
\begin{figure}\centerline{\psfig{figure=2A0335096-pn-spec.ps,width=8.0cm,angle=0.0}}\end{figure}

Figure 10 (upper panel) displays the observed spectrum and model QPB spectrum from the MOS1 observation of Abell 1795 from the full field of view. The observed spectrum clearly dominates over the background over all of the energy range where the MOS has significant response (i.e., $<8.0$ keV). In spite of the fact that the Abell 1795 cluster is relatively hot and bright, the excess of the observed spectrum over the model QPB spectrum at energies above $\sim10$ keV is not cosmic in origin. The excess is most likely due to residual SP contamination, as suggested by the low-level variation in the accepted time intervals of the light curve (the green part of the curves in Figure 4).

Figure 12: Output MOS1 images from mos-spectra of the observed counts (upper panel) and model exposure (lower panel) in sky coordinates. The images are for the $0.35-1.25$ keV band.
\begin{figure}\centerline{\psfig{figure=A1795-cou-exp.ps,width=8.0cm,angle=0.0}}\end{figure}

Figure 10 (lower panel) displays the FWC spectrum from the MOS1 instrument due to the QPB. The most striking features are the low-energy tail, the strong Al K$\alpha$ and Si K$\alpha$ fluorescent lines near 1.6 keV, and several other fluorescent lines at higher energies. The Al and Si lines are the only problematic parts of the spectrum. Because of the normal small residual gain variations of the instruments and the strength particularly of the Al line, the FWC data do not provide a usable template for the background at this energy. The small gain variations can produce very striking residuals in spectral fits where the surface brightness of the object of interest is typically smaller than the strength of the fluorescent lines. This has not been observed to be a problem for the higher energy lines. To circumvent this problem, a smooth ``bridge'' is fit to the data on either side of the Al K$\alpha$ and Si K$\alpha$ lines and the continuum component interpolated. This ``bridge'' is the smooth part of the model QPB shown in Figure 10. As discussed below in § 8, the Al K$\alpha$ and Si K$\alpha$ lines must then modeled as separate Gaussians in spectral fits.

Figure 11 (upper panel) displays the observed spectrum and model QPB spectrum from the pn observation of the cluster 2A 0335+096. Similar to Figure 10, The cluster spectrum dominates at low energies. However, unlike the MOS spectrum, the pn spectrum has very strong instrumental Cu lines near 8 keV and is missing the Si K$\alpha$ line at 1.75 keV. With such strong CU lines it may be reasonable to simply mask those data from the spectral analysis. In practice, we recommend that fits of pn data be restricted to the energy range $0.4<E<11.0$ keV as the low energy tail is exceptionally strong (data up to 0.55 keV can occasionally be rendered useless in observations that are otherwise acceptable). Similar to MOS spectral fits, the Al K$\alpha$ and Cu lines in the $7.2-10.0$ keV range must be explicitly fit. Doing so, spectral data for hard sources can be used up to $\sim11$ keV

As noted above, if a non-zero energy range is provided as input, mos-spectra and pn-spectra will create count images and model exposure maps for the specified energy band. Figure 12 shows the images for the Abell 1795 cluster in the $0.35-1.25$ keV band.

6.5.4 Special handling of MOS1 CCD#4 after Revolution 2382

During Revolution 2383 MOS1 CCD#3 was damaged by a micrometeorite strike and is no longer functional. Collateral damage affected CCD#4 exacerbating the tendency excess low energy events toward the right side (higher DETX values) of the CCD (e.g., Figure 13). To avoid excluding the CCD entirely, a new parameter was added to the mos-spectra task to allow for the exclusion of data with DETX values greater than a user-input value (cflim).

Figure 13: MOS1 count image after Revolution 2382 when CCD#3 was lost to a micrometeorite hit showing the enhanced background on CCD#4 (upper right).
\begin{figure}\centerline{\psfig{figure=mos1-ccd4-im.ps,width=8.0cm,angle=0.0}}\end{figure}

The easiest way to determine the spatial extent of the enhancement, if any, is to use the xmmselect GUI to create a histogram of the number of events as a function of DETX for MOS1 CCD#4. With xmmselect invoked for the emchain event list (e.g., mos1S001-ori.fits) click on the circular button for DETX, add the selection criteria:

(CCDNR == 4)&&(PI in [100:1300])

and click on the ``Histogram'' button. In the evselect GUI click on the ``Histogram'' menu and 1) set the histogram bin size to 10, 2) check the withhistoranges box, 3) set histogrammin=0 and histogrammax=13200, and 4) click on the ``Run'' button. The histogram plot that is produced (e.g., Figure 14) can be used to determine the DETX cutoff for good data (in this case $\sim9750$). The call to the mos-spectra task is then:

mos-spectra prefix=1S003 caldb=/CALDB
region=regm1.txt mask=1 elow=400
ehigh=1250 ccd1=1 ccd2=1 ccd3=1 ccd4=1
ccd5=0 ccd6=1 ccd7=1 cflim=9750

Figure 14: MOS1 CCD#4 DETX histogram after Revolution 2382 showing the enhanced background at larger values of DETX.
\begin{figure}\centerline{\psfig{figure=mos1-ccd4.ps,width=8.0cm,angle=-90.0}}\end{figure}


6.6 Spectral Analysis

If spectral analysis is the goal for the processing, and thus only spectra, RMFs and ARFs, and background spectra are desired (and if so the energy band range should be set to ``elow=0 ehigh=0'' for the tasks above), mos_back and pn_back are as far through the processing as one needs to go for a single exposure and region selection. The processing must be repeated for all instruments individually, as well as for any selections for different regions on the sky and for different exposures of the same instrument. Before rerunning mos-spectra and pn-spectra for a different region on a given instrument (MOS1, MOS2, or pn), mos_back or pn_back should also be run and the important output files should be renamed so they are not overwritten. This includes the source and background spectra as well as the RMF and ARF files. For example, the process of completing one spectral set is as follows:

mos-spectra prefix=1S003 caldb=/CALDB
region=regm1.txt mask=1 elow=400
ehigh=1250 ccd1=1 ccd2=1 ccd3=1
ccd1=4 ccd1=5 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/CALDB diag=0
elow=400 ehigh=1250 ccd1=1 ccd2=1
ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mv mos1S003-obj.pi mos1S003-obj-reg1.pi
mv mos1S003-back.pi mos1S003-back-reg1.pi
mv mos1S003.rmf mos1S003-reg1.rmf
mv mos1S003.arf mos1S003-reg1.arf
mv mos1S003-obj-im-sp-det.fits
mos1S003-sp-reg1.fits


pn-spectra prefix=S005 caldb=/CALDB
region=regpn.txt mask=1 elow=400
ehigh=1250 ccd1=1 ccd2=1 ccd3=1
ccd4=1
pn_back prefix=S005 caldb=/CALDB diag=0
elow=400 ehigh=1250 ccd1=1 ccd2=1
ccd3=1 ccd4=1
mv pnS005-obj.pi pnS005-obj-reg1.pi
mv pnS005-back.pi pnS005-back-reg1.pi
mv pnS005.rmf pnS005-reg1.rmf
mv pnS005.arf pnS005-reg1.arf
mv pnS005-obj-im-sp-det.fits
pnS005-sp-reg1.fits
mv pnS005-obj-os.pi pnS005-obj-os-reg1.pi


Note that the task pn_back produces an OOT subtracted spectrum with the file name prefix-obj-os.pi which should be used for spectral analysis. The spectra, however, are therefore count rates rather than counts that makes the use of Cstat statistics problematic.

Figure 15: Fitted MOS1 (black), MOS2 (red), pn (green), and RASS (blue, see Section 8.4 below) spectra from the entire field of view of the Abell 1795 observation. The upper panel shows the fit with the model background subtracted (the poorness of the fit is due to fitting one emission temperature to a multithermal spectrum). The lower panel shows the same fit but the data do not have the particle background subtracted, thus the deviation at higher energies. The diagonal lines in both plots show the contribution of the fitted residual SP background.
\begin{figure}\centerline{\psfig{figure=A1795-spec-fit.ps,width=8.0cm,angle=0.0}}\end{figure}

In most cases the data are going to be too sparse, particularly at higher energies, to be usefully fit without binning. Binning can be done most conveniently by using the Ftool grppha. In the binning process with grppha the background spectrum, RMF, and ARF files can also be associated with the source spectrum simplifying data entry into the spectral fitting program. The following commands will group the data with a minimum of 50 counts per channel and place the output spectrum in a file with the -grp qualifier added to the file name.

grppha
mos1S003-obj-reg.pi
mos1S003-obj-reg-grp.pi
chkey BACKFILE mos1S003-back-reg.pi
chkey RESPFILE mos1S003-reg.rmf
chkey ANCRFILE mos1S003-reg.arf
group min 50
exit

grppha
pnS005-obj-os-reg.pi
pnS005-obj-os-reg-grp.pi
chkey BACKFILE pnS005-back-reg.pi
chkey RESPFILE pnS005-reg.rmf
chkey ANCRFILE pnS005-reg.arf
group min 50
exit

Figure 16: Various components of the MOS1 spectral fit shown in Figure 15. The black points and curve show the background subtracted and fitted data. The red points show the observed spectrum without the particle background subtracted. The light blue curve shows the fitted cluster spectrum, the dark blue curve shows the fitted cosmic background spectrum. The green curve shows the fitted Al K$\alpha$ and Si K$\alpha$ instrumental lines. The violet (it may appear red depending on your printer) curve shows the fitted SP component.
\begin{figure}\centerline{\psfig{figure=A1795-spec-fit-comp.ps,width=8.0cm,angle=-90.0}}\end{figure}

Figure 15 shows the fitted MOS1, MOS2, and pn spectra from the entire field of view of the Abell 1795 observation. The difference between the two panels shows the effect of subtracting the model QPB. At lower energies the source clearly dominates over the background but at $E\sim4$ keV the falling flux and falling instrumental effective area coupled with the relatively flat QPB allows the latter to dominate. Note, however, that Abell 1795 is a relatively bright object and thus the QPB will be relatively more significant at lower energies for many other observations. The particle background even in this observation will also be much more important when the outer annuli of the cluster are considered in § 8.

Figure 16 shows the contributions of the various spectral components to the observed spectrum of Abell 1795 (demonstrated for the MOS1 detector). For a source as bright and extended as Abell 1795, the object spectrum dominates all other components except at the highest energies. However, it is clear that observations of fainter sources such as the cosmic background will be very significantly affected by the particle background and possible residual SP contamination over the entire energy band.

7 IMAGE PRODUCTION


7.1 Particle Background

If selected by entering a non-zero energy range as input, mos_back also produces particle background images in detector coordinates for the specified energy band. Figure 17 (upper panel) shows the MOS1 particle background image for the Abell-1795 observation for the $0.4-1.25$ keV band in detector coordinates. The distribution is relatively flat although there is one noticeable feature. The upper left region is brighter because of the exposure scaling for MOS1 CCD#5 (note that with higher resolution than these images there is a relatively bright column on the upper right CCD, CCD#4). In general, images in detector coordinates are not particularly useful so the task rot-im-det-sky is run to recast the data into sky coordinates with the same projection and pixel size as the event and exposure images produced by mos-spectra.

rot-im-det-sky prefix=1S003 elow=400
ehigh=1250 mode=1


The parameters are prefix=1S003 as defined above, the lower (elow=400) and upper (elow=1250) limits of the energy band, and an image for additional masking if desired (e.g., mask=mask.fits), but including no file name in the call (the standard usage) defaults to using only the standard masking (mosprefix-mask-im.fits). rot-im-det-sky can rotate the particle background image mode=1, soft proton background image (mode=2, see Section 7.2), and solar wind charge exchange background image (mode=3, see Section 7.3). Figure 17 (lower panel) shows the MOS1 image after casting into sky coordinates which requires a reflection, an offset, and a rotation.

Figure 17: Images of the model particle background in detector coordinates (upper panel, the output of mos_back) and in sky coordinates (lower panel, output of rot-im-det-sky). The differences in the general colors of the events in the different CCDs are due to differences in the FWC data exposure times. For a CCD with less FWC exposure there are fewer sample events, and therefore each event must have a greater weighting.
\begin{figure}\centerline{\psfig{figure=part-im.ps,width=8.0cm,angle=0.0}}\end{figure}


7.2 Soft Proton Background

Many, if not most, observations have some residual SP contamination after light curve screening. To determine the level of the residual contamination, if any, and to remove it first requires spectral fitting of the data. In the spectral fitting process, a power law (or broken power law) which is not folded through the instrumental effective areas is added to the model. For Xspec V12 and higher a separate model and diagonal RMF file must be included in the fit. Diagonal RMF files for the two MOS and pn instruments are provided with the CCF data (see Section 8).

For moderately SP affected data the SP spectral parameters are usually robustly fit. For a simple power law the fitted index is typically in the range 0.5-1.0 but can vary between 0.1 and 1.4. However, in certain circumstances the index can blow up to relatively large or small (even negative) numbers. In these circumstances it is probably reasonable to freeze the index at a reasonable value (e.g., 0.1 for small or negative indices and 1.4 for large indices). The SP index for the PN is likely to be different from that of the MOS detectors so in general they should not be linked, nor should any of the normalizations between different instruments be linked. This is a bit of an art form and it is not possible at this time to make any definitive rules. In addition, use of a broken power law spectrum with a break at 3.0 keV can be warranted. For broken power law fits the indices share the lower reasonable limit but may range to 2.5 or higher for the upper range.

After the spectral parameters for the SP contamination have been derived, the task proton can be run. If there is no additional normalization applied to the Xspec model, the SP spectral parameters (normalization: counts keV$^{-1}$, power law index: the negative photon index) input into proton are just the fitted Xspec values. proton produces an image in detector coordinates. The following is an example of a call of proton and rot-im-det-sky for the MOS:

proton prefix=1S003 caldb=/CALDB/
specname=mos1S003-obj-grp.pi ccd1=1
ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1
ccd7=1 elow=400 ehigh=1250 pindex=0.75
pnorm=0.099 spectrumcontrol=1

rot-im-det-sky prefix=1S003 elow=400
ehigh=1250 mode=2

and for the pn:

proton prefix=S005 caldb=/CALDB/
specname=pnS005-obj-grp.pi ccd1=1
ccd2=1 ccd3=1 ccd4=1 elow=400
ehigh=1250 pindex=1.29114
pnorm=0.2417706 spectrumcontrol=1

rot-im-det-sky prefix=S005 elow=400
ehigh=1250 mode=2

where prefix, /CALDB, ccd#, elow, and ehigh are as defined above and must be the same values as used in mos-spectra, pn-spectra, mos_back, and pn_back. specname=mos1S003-obj-grp.pi provides a file for the extraction of the EXPOSURE keyword, and should be the spectrum used in the spectral fits where the magnitude of the residual SP contamination was determined. spectrumcontrol=1 controls the spectrum mode (spectrumcontrol=1 for a power-law spectrum and spectrumcontrol=2 for a broken power-law spectrum). pindex=0.75 is the power-law index and pnorm=0.099 is the power-law normalization taken directly from the Xspec fit. Figure 18 (upper panel) shows the MOS1 SP background image for the Abell-1795 observation for the $0.4-1.25$ keV band in detector coordinates. rot_im_det_sky is run to convert the image from detector to sky coordinates (shown in Figure 18, lower panel).

In cases where there is strong emission from the extended source, as there can be for clusters of galaxies, the fitted parameters for the SP component can be significantly over or under estimated. In such cases it can be helpful to fit a spectrum extracted from the lower surface brightness regions in the field. For clusters of galaxies an outer annulus in the FOV can serve this purpose. However, in this case the fitted normalization must be scaled from the limited region to the full FOV, which can be done by the routine sp_partial:

sp_partial caldb=/CALDB/ detector=1
fullimage=mos1S003-sp-full.fits
fullspec=mos1S003-obj-full.pi
regionimage=mos1S003-sp-ann.fits
regionspec=mos1S003-obj-ann.pi
rnorm=0.03


where caldb=/CALDB is again the SAS CCF directory containing the SP calibration data, detector=1 specifies the MOS1 instrument, (2 or 3 for the MOS2 or pn instruments, respectively), fullimage=mos1S003-sp-full.fits is the SP image template for the full FOV, fullspec=mos1S003-obj-all.pi is the spectrum for the full FOV, regionimage=mos1S003-sp-ann.fits is the SP template image for the restricted region, regionspec=mos1S003-obj-ann.pi is the spectrum for the restricted region, and rnorm=0.03 is the fitted SP normalization for the restricted region. In the proton call use the fitted spectral index from the restricted region and the scaled value for the normalization.

As for the particle background maps, after proton has been run, rot-im-det-sky must be run to recast the SP image from detector coordinates to sky coordinates (using the calling parameters listed above except using mode=2).

Figure 18: Images of the model SP background in detector coordinates (upper panel, the output of proton) and in sky coordinates (lower panel, output of rot-im-det-sky). Note that values are both negative and positive due to the method for creating the instrument maps. On average the values are positive and the count images are sparse requiring averaging on angular scales where the SP values provide good information.
\begin{figure}\centerline{\psfig{figure=prot-im.ps,width=8.0cm,angle=0.0}}\end{figure}


7.3 Solar Wind Charge Exchange Background

Solar wind charge exchange (SWCX, see Section 8.3) emission, more so than the soft proton background, probably affects all observations. Also like the SP background, the level of the background is not known a priori and must be modeled from the data. For sources like the soft X-ray background which cover the entire instrumental FOV, this can be very problematic as there is no method to distinguish a SXRB X-ray from a SWCX X-ray. Again like the SP background, an estimate of the level of SWCX background can be derived from spectral fitting and then subtracted from images. In cases of diffuse emission (e.g., most clusters of galaxies) which does not cover the entire FOV a more robust estimate can be made by explicitly fitting SWCX lines in the on- and off-emission spectra.

The solar wind charge exchange (SWCX) component is treated in a similar manner as the soft proton background. Scale factors are determined during the spectral fitting process for a user-determined number of emission lines that are then used to create model count images. The tricky part of the process is the fact that, as noted above, the SWCX emission lines include many that are used as diagnostics for astrophysical plasmas, e.g., the O VII and O VIII lines.

To model the SWCX component, Gaussian lines at the characteristic energies (see Table 1 for most common lines in the EPIC energy range) with zero width are added to the spectral fit. In the fit, the line energies should be fixed until a reasonable fit is obtained and then allowed to float.



Table 1: Select SWCX Emission Lines.
Line Energy (keV)
C VI 0.37
C VI 0.46
O VII 0.57
O VIII 0.65
O VIII 0.81
Ne IX 0.92
Ne IX 1.02
Mg XI 1.35


In addition to these there can be Fe L lines contributing around 0.8 keV.

Figure 19: Images of the model SWCX background in detector coordinates (upper panel, the output of swcx) and in sky coordinates (lower panel, output of rot-im-det-sky). The images are very similar morphologically to the exposure maps as they are produced by simply scaling exposure maps calculated for the SWCX energies. The fine structure in the sky image is due to the transforming where occasionally two original pixels get cast into a single transformed pixel, and sometimes none do. However, for any reasonable pixel binning or smoothing this effect is washed out.
\begin{figure}\centerline{\psfig{figure=swcx-im.ps,width=8.0cm,angle=0.0}}\end{figure}

As for modeling the soft proton background, the Xspec normalizations are used in the calculating the model SWCX count image with the task swcx:

swcx prefix=1S003 caldb=/CALDB/ ccd1=1
ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1
ccd7=1 elow=400 ehigh=1250
linelist='0.560 0.650'
gnormlist='4.38E-07 3.63E-07'
objrmf=mos1S003.rmf objarf=mos2S004.arf
objspec=mos2S004-obj.pi

rot-im-det-sky prefix=1S003 elow=400
ehigh=1250 mode=3

and for the pn:

swcx prefix=S005 caldb=/CALDB/ ccd1=1
ccd2=1 ccd3=1 ccd4=1 elow=400 ehigh=1250
linelist='0.56 0.65'
gnormlist='4.38E-07 3.63E-07'
objrmf=mos1S003.rmf objarf=mos2S004.arf
objspec=mos2S004-obj.pi

rot-im-det-sky prefix=S005 elow=400
ehigh=1250 mode=3

where prefix, /CALDB, ccd#, elow, and ehigh are as defined above and must be the same values as used in mos-spectra, pn-spectra, mos_back, and pn_back. linelist='0.56 0.65' sets the energies for the SWCX lines which are being modeled and subtracted. gnormlist='4.38E-07 3.63E-07' are the fitted Xspec normalizations for the SWCX lines. objrmf=mos1S003.rmf, objarf=mos1S003.arf, and objspec=mos1S003-obj.pi are the RMF, ARF, and spectrum for the fit, which are required to include the pulse-height smearing of the lines. Figure 19 (upper panel) shows the MOS1 SWCX background image for the Abell 1795 observation for the $0.4-1.25$ keV band in detector coordinates. As for the particle background and SP maps, rot_im_det_sky is run to convert the image from detector to sky coordinates. Images of the model MOS1 SWCX background in detector and sky coordinates are displayed in Figure 19.

Figure 20: MOS1 count image showing the stray-light arcs produced by a bright point source outside of the FOV.
\begin{figure}\centerline{\psfig{figure=stray.ps,width=8.0cm,angle=0.0}}\end{figure}

7.4 Stray Light

The XMM-Newton mirrors have a small sensitivity to stray light originating just out of the field of view (0.4-1.4 degrees) due to unbaffled single reflections (two reflections are necessary for X-ray imaging). In most cases the effect has little significance, however, if a bright source is located just outside of the FOV then the effect can be spectacular. This can be seen in the LMC data where LMC X-1 produces spectacular arcs in neighboring pointings. There is nothing that can be done to model and subtract this additional background component, and excision of the affected region is the only option. Extended sources, like the SNR N132D in the LMC can complicate the identification of stray light as the clear arcs due to a point source become blurred and merge into a bright emission region. Figure 20 shows the effect from a point source for a single exposure and instrument. As demonstrated in Figure 21, the effect of stray light can considerably stronger in the hard band when the source is hard but the surrounding diffuse emission is relatively soft.

Figure 21: Images of the LMC X-1 region in the $2.0-7.2$ keV band (upper) and $0.4-1.25$ keV band (lower). The stray light from LMC X-1 is relatively much stronger in the hard band.
\begin{figure}\centerline{\psfig{figure=lmc-comp.ps,width=8.0cm,angle=0.0}}\end{figure}

7.5 Image Creation

After rot-im-det-sky has been run for the QPB, and either or both of the SP and SWCX backgrounds when necessary, all of the primary components for a background-subtracted and exposure-corrected image are ready. As noted above, the perl scripts mos-spectra and pn-spectra created count and exposure images for the requested band and instrument.

Before a final image is produced, it is reasonable to combine the MOS1, MOS2, and pn data if more than one data set exists. This can be done using the task comb, which simply adds the individual components from the three instruments with proper scalings for different filters and different instruments, and even from multiple exposures from the same ObsID. For example:

comb caldb=/CALDB/ elowlist=400
ehighlist=1250 mask=1
withpartcontrol=1 withsoftcontrol=1
prefixlist="1S003 2S004 S005"
alpha=1.7


where caldb=/CALDB/ is the SAS CCF directory containing the ESAS calibration data, elowlist=400 is a list of the energy band lower limits, ehighlist=1250 is a list of the energy band upper limits, withsoftcontrol=1 controls whether SP images are processed, withpartcontrol=1 controls whether QPB images are processed, withswcxcontrol=1 controls whether SWCX images are processed, mask=1 controls the masking, and prefixlist="1S003 2S004 S005" is a list of the prefixes (exposures) to be combined. The task comb scales the data sets to the response of the MOS2 medium filter by using a look-up table to scale the exposure. The look-up table was created using PIMMS assuming an $E^{-\alpha}$ power law spectrum with $2\times10^{20}$ H I cm$^{-2}$ absorption. The assumed value for $\alpha$ is set by the parameter alpha=1.7 Combining MOS and pn data for objects with radically different spectral parameters (different from the assumed spectrum) may produce artifacts in the final image. The artifacts are most easily seen in the CCD gaps where the surface brightness in the gap, which will be covered by a different instrument (pn or MOS), will be brighter or fainter than the adjacent regions. Varying the input parameter alpha may alleviate this effect (which in our experience has been relatively rare).

Figure 22: EPIC (MOS plus pn) background-subtracted and exposure-corrected image of Abell 1795 in the $0.4-1.25$ keV band. The image shows the results with a logarithmic scaling if point sources are removed. The size of the removed regions depends both on the PSF at the location of the source as well as the strength of the source.
\begin{figure}\centerline{\psfig{figure=a1795-400-1250.ps,width=8.0cm,angle=0.0}}\end{figure}

Typically there are too few counts in an image, even after combining multiple exposures, to produce a useful image without any smoothing or binning. The XMM-ESAS package provides an adaptive filter task, adapt, which will produce a reasonable background-subtracted and exposure-corrected image (a pretty picture).

adapt smoothingcounts=50 detector=0
thresholdmasking=0.02 binning=2
elow=400 ehigh=1250 withmaskcontrol=no
withpartcontrol=yes withsoftcontrol=yes
withswcxcontrol=no


In the call smoothingcounts=50 is the smoothing kernel, thresholdmasking=0.02 sets the threshold for excluding low exposure regions of the image, detector=0 designates the detector (detector=0 designates that adapt should use the output from comb and detector=1, detector=2, and detector=3 are for the MOS1, MOS2 and pn data alone), the binning=2 is for binning the image, the elow=400 and ehigh=1250 defines the energy range in eV as defined above, withpartcontrol controls the subtraction of the model QPB image, withsoftcontrol controls the subtraction of the model SP image, withswcxcontrol controls the subtraction of the model SWCX image, and withmaskcontrol controls additional masking (if an additional mask is to be used the file name must be included as an additional parameter). Figure 22 displays the resultant background-subtracted and exposure-corrected image without (upper panel) and with (lower panel) point-source exclusion. If individual exposures are being smoothed the prefix (e.g., prefix=1S003) as defined above must be entered. The algorithm uses a conical weighting for the smoothing, and a image is created providing the conical FWHM in arc minutes (Figure 23).

Figure 23: Smoothing FWHM for the Abell 1795 image (Figure 22) in the $0.4-1.25$ keV band. The color table is in units of arc minutes.
\begin{figure}\centerline{\psfig{figure=a1795-s-size-im.ps,width=8.0cm,angle=0.0}}\end{figure}

7.6 Image Analysis

At this point the user is left nearly to their own devices. For scientific analysis the data should be binned and not smoothed. A very simple task, bin-image, is provided to create images with integer binnings by binning pixels in each direction. The output files are count rate:

$R=\alpha (c-b-p-s)/e$

and count rate uncertainties:

$\sigma_R=\alpha \sqrt{c}/e$

where $\alpha$ is a scale factor to convert to units of counts s$^{-1}$ deg$^{-2}$, and is equal to the reciprocal of the fundamental analysis pixel size of $2.5''\times2.5''$ ( $=2.0736\times10^6$). $c$ is the number of counts, $b$ is the number of model particle background counts, $p$ is the number of model SP counts, and $s$ is the number of model SWCX counts). The assumption is that the counting statistics of the observation dominates the uncertainty in the model background counts. In practice this probably underestimates the uncertainty which would make any analysis results more conservative. The parameters are the same as those for adapt.

bin_image thresholdmasking=0.02
detector=0 binning=2 elow=400 ehigh=1250
withpartcontrol=yes withsoftcontrol=yes
withswcxcontrol=no


8 SPECTRAL FITS

Spectral fitting gets very complicated very quickly (e.g., see Figure 16). There are typically six or seven spectral components that should be fit to data, even before the spectrum of the object of interest (if that is not the cosmic background) is added. These components are split between instrumental and cosmic origins. Some of the components can vary with time, observation direction on the sky, position on the detector, location of the satellite in its orbit, and location of the Earth in its orbit.

8.1 Instrumental Background

After the model particle background is subtracted from the observed spectrum, there are still instrumental backgrounds. Since the Al K$\alpha$ and Si K$\alpha$ lines for the MOS and the Al K$\alpha$ and CU K$\alpha$ lines for the pn are excised from the QPB spectra, the lines must be fit explicitly to the data7. This is done easily by the addition of two Gaussians in the spectral model with energies of $E\sim1.49$ keV and $E\sim1.75$ keV with zero width for the MOS. The intensities of these two lines vary over the individual detectors but they seem to be in relatively good agreement between the two MOS instruments. The pn unfortunately requires six lines at $E\sim1.49$ keV, $E\sim7.49$ keV, $E\sim7.11$ keV, $E\sim8.05$ keV, $E\sim8.62$ keV, and $E\sim8.90$ keV. The normalization of the pn Si line should be fixed at zero. Another instrumental background is any residual SP contamination that may be present. While the temporal filtering of the perl scripts mos-filter and pn-filter can remove much of the SP contamination, they may not, and probably do not, remove all of it. This component can be modeled as a power law or broken power law which is not folded through the instrumental effective area, the ARF. For Xspec V12 and higher this is accomplished by adding a separate model with a diagonal unitary matrix. This is demonstrated in the XMM-ESAS examples in the Xspec *.xcm files. The diagonal matrices are supplied with the ESAS CalDB files.

8.2 Cosmic Background

The cosmic background, even if not the object of the observation, must be modeled explicitly as it is a significant background in all directions and all energies, and it varies significantly both in intensity and spectral shape over the sky. The cosmic background can usually be modeled by four or fewer components. First, a cool ($E\sim0.1$ keV), unabsorbed thermal component representing emission from the Local Hot Bubble or heliosphere. Second, a cool ($E\sim0.1$ keV), absorbed thermal component representing emission from the cooler halo. This component may have intrinsically a zero intensity or may be effectively absorbed if the Galactic column is greater than a few times $10^{20}$ H I cm$^{-2}$. In either case the component can be deleted from the fitted model. Third, a higher temperature ($E\sim0.25-0.7$ keV), absorbed thermal component representing emission from the hotter halo and/or intergalactic medium. For an observation near the Galactic plane, this component may also end up representing distributed thermal emission through the Galactic disk. Fourth, an absorbed power law with $\alpha\sim1.46$ representing the unresolved background of cosmological sources. In many cases in the literature this last component is referred to as the cosmic X-ray background. however, to the cognoscente these are just point sources that we haven't been able to remove and the true cosmic diffuse X-ray background is primarily found at energies less than a couple keV, is truly diffuse, and is Galactic, Galactic halo, local group, or cosmic web in origin.


8.3 Solar Wind Charge Exchange Background

A component that can be very problematic originates in the solar system and in the near-Earth environment. Solar wind charge exchange (SWCX) occurs when highly ionized ions in the solar wind collide with exospheric hydrogen near Earth or interstellar material passing through the solar system and pick up an electron. The acquired electron is typically in a highly excited state which then radiatively decays. Prominent SWCX emission lines include those from C VI, O VII, O VIII, Ne IX, and Mg XI that are some of the same lines that are important diagnostics of astrophysical plasmas. If an observation is long enough, some evidence for SWCX contamination can possibly be found by comparing the $0.5-0.7$ keV and $2.0-8.0$ keV light curves (see Carter & Sembay 2008). If the lower-energy light curve varies while the high-energy light curve doesn't, the data may be affected. Another SWCX diagnostic is the presence of very strong O VIII and Mg XI lines in the cosmic diffuse background component. Additional observations of a region may be the only way to determine the presence and minimum extent of SWCX contamination.


8.4 Models and Xspec

An Xspec Version 12 (and higher) model for fitting the Abell 1795 data in the $0.4-11.0$ keV range is:

model gauss + gauss + gauss + gauss + gauss +
gauss + gauss + gauss + con*con*
(apec + (apec + apec + pow)wabs +
apec*wabs)
model 2:myback1 bknpow
model 3:myback2 bknpow
model 4:myback3 bknpow


with a total of 20 model components. The model 2:myback1 bknpow, model 3:myback2 bknpow, and model 4:myback3 bknpow components represent the SP contamination, the first two gauss components represent the Al K$\alpha$ and Si K$\alpha$ instrumental lines, and the last six gauss components represent the pn Cu K$\alpha$ instrumental lines. The two con components represent the relative normalization between the three detectors (which should be 1.0 for a perfect inter-instrument calibration but in practice will lie in the range of $0.9-1.1$ depending on which instrument is fixed to 1.0) and the solid angle of the individual region (in square arc minutes, derived from the task proton_scale). The five components, apec + (apec + apec + pow)*wabs, represent the cosmic background. The final two model components, apec*wabs, represent (finally) the cluster emission from the region.

Figure 24: Extraction annuli (in white) overlaid on the MOS2 sky coordinate image of Abell 1795. Also shown are the regions (in green with a red slash) excluded because of point sources.
\begin{figure}\centerline{\psfig{figure=A1795-regions.ps,width=8.0cm,angle=0.0}}\end{figure}

With so many components the fitting process can get out of hand quickly. However, the situation will get significantly more complicated when multiple regions are considered, for example when determining the temperature radial profile of the cluster of galaxies Abell 1795 in ten annuli with the three EPIC instruments as well as a RASS spectrum. Figure 24 shows the extraction annuli as well as the point sources which are excluded from the analysis.

With three instruments and 58 parameters per spectrum, there are a total of 174 parameters. However, we are not done yet. In order to constrain the cosmic background contribution to the observed spectra, the RASS spectrum derived from the HEASARC X-ray Background Tool is added to the mix adding another 58 parameters. For this case the RASS spectrum is extracted from a $1^\circ-2^\circ$ annulus surrounding the cluster with the assumption that the annulus spectrum represents reasonably well the cosmic background in the direction of the cluster. The tool also provides an appropriate response file (RMF combined with an ARF) and the spectrum is normalized to the flux in 1 arcmin$^{2}$ pixels as well as the average Galactic H I column density.

The broken power law components representing the SP contamination are declared as separate models and are assigned separate response matrices. These response files (RSPs) must be diagonal and are provided in the ESAS CCF distribution (mos1-diag.rsp.gz, mos2-diag.rsp.gz, and pn-diag.rsp.gz). There must be an assignment for each fitted spectrum, e.g. (for three cluster spectra). So, the preparation for setting up a spectral fit (before setting initial parameters) is:

data 1:1 mos1S003-obj-0-30-grp.pi
data 2:2 mos2S004-obj-0-30-grp.pi
data 3:3 pnS005-obj-0-30-grp.pi
data 4:4 rass.pi
ignore 1:0.0-0.3,11.0-**
ignore 2:0.0-0.3,11.0-**
ignore 3:0.0-0.4,11.0-**
ignore bad
response 2:1 mos1-diag.rsp.gz
response 3:2 mos2-diag.rsp.gz
response 4:3 pn-diag.rsp.gz
model gauss + gauss + gauss + gauss + gauss +
gauss + gauss + con*con*
(apec + (apec + apec + pow)wabs +
apec*wabs)
model 2:myback1 bknpow
model 3:myback2 bknpow
model 4:myback3 bknpow

With so many parameters, the aim is to link or freeze as many as possible in order to reduce the number of free parameters, at least for the initial fit. To start with, while the normalizations for the MOS Al K$\alpha$ and Si K$\alpha$ lines vary with detector and location for an individual detector, the energies and line widths will not (at least not significantly). This also holds for the pn Al K$\alpha$ line and Cu lines. Since the cosmic background is most likely flat over the field of view of the EPIC instruments, and with the constant factor included in the model to scale for solid angle, then the cosmic background components will have the same temperatures and normalizations for all spectra. for the initial fit, the parameters of the cosmic background model(see § 8.5 below), except for the normalizations, can be ``frozen'' at appropriate values. The task proton_scale reads in individual spectra and returns the solid angle in arcmin$^{-2}$, along with some other diagnostic information that will be discussed below. For example:

proton_scale caldb=/CALDB mode=1 detector=1
maskfile=mos1S003-sp-full.fits
specfile=mos1S003-obj-full.pi


where caldb=/CALDB is the SAS CCF directory containing the ESAS calibration data, mode=1 selects the individual exposure mode, maskfile=mos1S003-sp-full.fits is the masking template (an image), and specfile=mos1S003-obj-full.pi is the spectrum to be fit.

The cluster emission component and absorption should be the same for the same regions from the three EPIC instruments, and so can be linked. While the residual SP contamination may not have a constant spectrum over the field of view, as a first approximation it can be assumed to be so for the MOS detectors. Thus the spectral parameters (the spectral indices for the broken power law) for the MOS detectors can be linked (the pn spectral parameters should not be linked to those of the MOS detectors). After the initial fit appropriate parameters can be ``thawed'' to improved the fit and derive final values. The fits for the full-field Abell 1795 spectra are shown in Figures 15, 16. The entire processing script, resultant data files, and model fitting Xspec *.xcm files are available8.


8.4.1 Xspec Fits of Multiple Regions

Quite often analysis will require the simultaneous fits of spectra from multiple regions, such as cluster radial annuli (e.g., Figure 24). In the Abell 1795 radial profile there are 10 regions for a total of 30 EPIC spectra plus the one RASS spectrum. With 58 parameters per spectrum and 31 spectra, that makes a total of 1798 parameters. With so many parameters, the aim again is to link or freeze as many as possible in order to reduce the number of free parameters. As with the full-field spectra, while the normalizations for the MOS Al K$\alpha$ and Si K$\alpha$ lines and the pn Al K$\alpha$ and Cu lines will vary with annulus, the energies and widths will not and therefore can be linked. The cosmic background parameters can also be linked for all spectra providing the region solid angle scale factors have all been set correctly. The cluster emission component and absorption should be the same for the same annuli from the three EPIC instruments, and so can be linked. While the residual SP contamination may not have a constant spectrum over the field of view, as a first approximation it can be assumed to be so. Thus the spectral parameters (the spectral indices and break energy for the broken power laws) can be linked (the MOS detectors together). However, the distribution over the CCDs is not uniform and the tool proton_scale can be used to generate appropriate scale factors. These scale factors should all be fixed to their appropriate values. When running proton_scale, three numbers are printed out. The last of these (``Scaled Ave Flux'') is the normalization for the soft proton events for that region and instrument. Pick one of your regions and then scale all the others to it. The scaling is just the ratio of that region's normalization to the normalization of the chosen region. The scale factors for the SP contribution should be used to link all of the regions to one active parameter (in Xspec, newpar B = A * F where the B is the parameter number to be linked, the A is the parameter number of the active parameter, and F is the scaling between the two parameters). Normalizations for the SP contamination, Gaussian lines, and cluster emission should be frozen at 0 for the RASS data and the solid angle normalization should be frozen to 1 (the units of the RASS spectrum provided by the X-ray background tool is in units of arcmin${-2}$. proton_scale can be run in two modes, either on individual spectra with command line input or on groups where the spectra are identified in an ascii file.

Figure 25: Fitted MOS1 and MOS2 spectra from ten annuli covering the field of view of the Abell 1795 observation. The upper panel shows the fit with the model background subtracted and the lower panel shows ratio between the data and the fit.
\begin{figure}\centerline{\psfig{figure=A1795-xmm.ps,width=8.0cm,angle=-90.0}}\end{figure}

With these linkages the number of parameters that are fit are already reduced from $\sim1000$ to about 80, but we are not done yet. The Galactic absorption in the cosmic background component can be frozen to the Galactic column (also provided by the HEASARC X-ray Background Tool) and the extragalactic power law index can be frozen to the canonical value ( $\alpha\sim1.46$). If the solid angle scale factor has been set in units of square arc minutes, the extragalactic power law normalization can be set to its canonical value as well ( $8.88\times10^{-7}$ in Xspec units, equivalent to a normalization of 10.5 photons keV cm$^{-2}$ s$^{-1}$ sr$^{-1}$). However, when point sources have been removed the normalization should be adjusted. The XMM-ESAS package provides the task point-source which will calculate the scale factor using several different models and user-selected parameters. The redshift for the cluster in the various annuli should also be the same so it can be linked. The number of free parameters for the initial fit attempt is still too large for an easy convergence so a few more parameters can be temporarily frozen. The temperatures of the cosmic components, the energies and widths of the Gaussian instrumental components, and the redshift of the cluster if it is known. This can reduce the number of free parameters to about 55.

After an initial fit some of the frozen parameters should be thawed. These include the energies and widths of the instrumental Gaussians (note, however, that if the source emission is bright relative to the Gaussians the width should remain frozen). It may also become clear that other parameters can be linked, but this is where scientific intuition comes into play. In this case, there are insufficient statistics to significantly constrain the fitted abundances in the outer annuli of the cluster so they can be linked to those of inner annuli successively until significance is achieved. Figure 25 shows the best fit for the ten extracted annuli from the Abell 1795 observation. Even after Xspec has converged in fitting the data, it may have only found a local minimum. This will often become apparent when the parameter confidence interval is being determined (e.g., using the Xspec tool steppar). So the fitting process will need to be redone to reflect the better fit.

Figure 26: Fitted MOS1 and MOS2 spectra from ten annuli covering the field of view of the Abell 1795 observation with the addition of the RASS spectrum. The upper spectral fit is the same as for Figure 25 and shows how the XMM-Newton data by themselves may not constrain the lower temperature components of the model cosmic background. The lower spectral fit shows the results after the fitting process includes the RASS data.
\begin{figure}\centerline{\psfig{figure=A1795-all.ps,width=8.0cm,angle=0.0}}\end{figure}


8.5 Constraining the Cosmic Background

The RASS spectrum constraint can significantly improve the reliability of the fits. The upper panel of Figure 26 shows how the initial fit of Figure 25 with only the XMM-Newton data is a poor representation as it significantly under predicts the cosmic background at lower energies for the RASS data. To do so, and to produce the apparently good fit of Figure 25, power has been shuffled between model components. Using the RASS data to constrain the fit forces the power to be shifted to (hopefully) the proper components, as is shown in the lower panel of Figure 26.

Figure 27: Radial profiles of the fitted temperatures for the annuli of the Abell 1795 cluster. Green points are from the fits to the data without adding the RASS data as a constraint. Red points show the fitted values when the RASS data are simultaneously fit. The annuli used are the same but were given shifted radii for clarity. The blue points are from refitting the data applying the crosstalk ARFs to account for flux from one region of the sky which due to the finite PSF appear in a different region of the detector.
\begin{figure}\centerline{\psfig{figure=A1795-radial.ps,width=8.0cm,angle=-90.0}}\end{figure}

Figure 27 shows how the application of the RASS constraint can affect the fitted parameters. It shows the fitted values for the temperature radial profile of Abell 1795. As expected near the center there is very little difference since the cluster emission so dominates the background. However, at large radii where the cluster emission isn't so bright, the fitted values for the temperature start to vary significantly.

The final background component that can play a significant role in spectral analysis is the solar wind charge exchange flux. As noted above, this is particularly problematic as in the XMM-Newton energy range it is primarily comprised of emission lines that are typically of astrophysical interest, e.g., O VII, O VIII, Ne IX, and Mg XI. Also as noted above, occasionally the presence of SWCX emission can be seen by comparing the $0.5-0.7$ keV and $2.0-8.0$ keV light curves and searching for variations in the former that are not seen in the latter. However, intervals as long as 30 ks have been observed where the SWCX contamination is significant and yet the light curve has remained relatively constant. Another symptom of the contamination is the detection of very strong O VIII and Mg XI lines. However, as there are astrophysical objects that also show enhanced emission in these lines some care must be taken with the interpretation of the results. In some cases it may be advantageous to include additional Gaussian lines for the O VII, O VII, and perhaps other lines.

8.6 Crosstalk

Because of the finite PSF of the XMM-Newton mirrors and their broad wings a significant flux that originates from one area of the sky is detected in a different area of the detector. If the source is uniform over the field then this effect isn't a major consideration, however if there are strong gradients in the emission and spectral parameters over the field then the effect can be significant. This is the case for many cooling flow clusters. SAS now includes a modification of the task arfgen to account for this ``crosstalk''. The blue points in Figure 27 show the effect of the application of this modification to the determination of the temperature radial profile of Abell 1795. The effect is as should be expected with the central temperature being colder and the other inner annuli being hotter when crosstalk is included (the effect of the PSF spreading of the on-average cooler photons has been removed).

Figure 28: Radial profiles of the fitted temperatures for the annuli of the Abell 2205 cluster. Green points are from the fits to the data without accounting for the finite PSF. The red points are from refitting the data applying the crosstalk ARFs to account for flux from one region of the sky which due to the finite PSF appear in a different region of the detector.
\begin{figure}\centerline{\psfig{figure=A2204-radial.ps,width=8.0cm,angle=-90.0}}\end{figure}

Figure 28 shows similar results for the cluster of galaxies Abell 478 where the effect is much stronger.

Like with the model SP component, the crosstalk contribution must be input as a separate model but its components will be linked to existing parameters. In the example below, the crosstalk model represents the contribution of the spectrum which originates in the $0.5'-1.0'$ annulus on the sky to the central $0.5'$ region of the cluster on the detector. The lines below associate the model parameters of the cluster emission from the annulus with the spectrum and RMF of the central region and the cross talk ARF. Specifically they link the spectral parameters of the cluster annulus thermal emission crosstalk.

resp  4:1 mos1S001-0-30.rmf                                           
arf   4:1 mos1S001-30-60-0-30.arf          
model  4:mycross1 con*apec*wabs
newpar mycross1:1 =  64
newpar mycross1:2 =  80
newpar mycross1:3 =  81
newpar mycross1:4 =  82
newpar mycross1:5 =  83
newpar mycross1:6 =  84

Figure 29: Radial profiles of the fitted temperatures for the annuli of the Abell 1795 cluster. Note that these results are from the CCF of 11 September 2008 and SAS V8 that are responsible for the lower values for the fitted temperatures than seen elsewhere. The green data are from the fits performed without accounting for the finite PSF. The blue data are from applying the crosstalk ARFs to account for flux from one region of the sky which due to the finite PSF appear in a different region of the detector. The red points are from applying the cross-talk arf calculation to the individual annuli.
\begin{figure}\centerline{\psfig{figure=A1795-compcross.ps,width=8.0cm,angle=-90.0}}\end{figure}

The arfgen crosstalk calculations can also be used to improve the ARF calculations for individual regions. Run in its nominal mode using the extended source parameter turns off the encircled-energy calculation that for small regions can generate a significant over estimate of the effective area. Figure 29 shows the effect of using the arfgen cross-talk mode to calculate the ARFs for the individual annuli. (When the annuli are larger in area the effect is minor so for this test only the first two annuli were recalculated.) The effect is to enhance the cross-talk correction, which for a cooling-flow cluster is to lower the fitted temperature of the inner region and increase the fitted temperatures of the inner annuli. Care must be taken in choosing the bin sizes of the detector maps. If the binning is too coarse the ARF will be underestimated, which is a known feature of the method for calculating the cross-talk ARFs and not a bug. Figure 30 shows ARFs calculated for the innermost region using different bin sizes. A bin size of $1.5''$ produces close to the limiting value for the ARF, as does a bin size of $2.5''$. In general the bin size should be chosen so that the receiving region should have at least 300 pixels.

Figure 30: Calculated ARFs for the Abell 1795 cluster. The top curve is the ARF calculated using the standard arfgen method while the rest of the ARFs were calculated using the cross-talk mode of arfgen using different binnings for the detector maps. From the bottom the bin sizes were $7.5''$, $5.0''$, $3.75''$, $2.5''$, $1.5''$, and $1.0''$.
\begin{figure}\centerline{\psfig{figure=A1795-binning.ps,width=8.0cm,angle=-90.0}}\end{figure}

9 MOSAICS

The XMM-ESAS software package offers users an opportunity to mosaic multiple observations of a region regardless of their pointing directions and orientations. The programs produce intermediate merged files of the observed counts, exposure, model particle background count images, and model SP contamination images. The merging programs must be run after all contributing observations have been processed to the point where individual images can be produced (i.e., you can't merge what you haven't created).

For the example below of the mosaicked image of the galaxy M101, the directory structure is as follows:

/M101/merge
/M101/0104260101/odf
/M101/0104260101/proc
/M101/0164560701/odf
/M101/0164560701/proc
/M101/0212480201/odf
/M101/0212480201/proc

All three observations of M101 are significantly contaminated by SP flaring, 0164560701, however, is a truly pathological case where even after light-curve filtering there remains a considerable amount of residual SP contamination. We use all three observations as an illustrative example. Figure 31 displays the light curves with their accepted time intervals (an output of mos-filter) for the three observations.

Figure 31: Light curves of the three M101 observations.
\begin{figure}\centerline{\psfig{figure=m101-lc.ps,width=8.0cm,angle=0.0}}\end{figure}

The merging processing will take place in the /M101/merge directory. Within the merge directory is an ASCII file listing the paths and prefixes of the individual exposures to be merged which is named dir.dat:

../0104260101/proc/mos1S001
../0104260101/proc/mos2S006
../0104260101/proc/pnS003
../0164560701/proc/mos1S001
../0164560701/proc/mos2S002
../0164560701/proc/pnS003
../0212480201/proc/mos1S001
../0212480201/proc/mos2S002
../0212480201/proc/pnS003

The following shows the simple set of commands to mosaic the exposures processed for the $0.4-1.3$ keV band to create the image in the top panel of Figure 32:

merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=1
elow=400 ehigh=750 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=2
elow=400 ehigh=750 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=3
elow=400 ehigh=750 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=4
elow=400 ehigh=750 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=1
elow=750 ehigh=1300 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=2
elow=750 ehigh=1300 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=3
elow=750 ehigh=1300 maskcontrol=0
xdim=1100 ydim=1100
merge_comp_xmm caldb=/CALDB dirfile=dir.dat
coord=2 crvaln1=210.85 crvaln2=54.35
pixelsize=0.03 component=4
elow=750 ehigh=1300 maskcontrol=0
xdim=1100 ydim=1100

In the above example, the individual components for an image of the $0.40-1.3$ keV (elow=400 to ehigh=1300) band are cast into a mosaic using the task merge_comp_xmm. As the processing of the individual observations was done in two bands which span the energy range, $0.4-0.75$ keV and $0.75-1.3$ keV, the data must also be mosaicked in the two bands and then combined by the adaptive smoothing or simple binning routines. dirfile=dir.dat is the file name containing the exposure paths, coord=2 selects the coordinate system to be used, in this case the equatorial system, and crvaln1=210.85 and crvaln2=54.35 are the central coordinates of the mosaic projection. pixelsize=0.03 gives the scale size of the projection in units of arc minutes. The cast arrays are $1100\times1100$ pixels in size so a choice of 0.03 arc minutes produces an image $33'$ on a side. component=1 selects the component to be mosaicked. maskcontrol=0 controls the masking, and in this case uses no masking.

Figure 32: Merged images of M101 in the $0.4-1.3$ keV band (top) and $2.0-7.2$ keV band (bottom). While the low-energy band looks quite reasonable, the high-energy band shows the effect of uneven residual SP contamination.
\begin{figure}\centerline{\psfig{figure=m101-im.ps,width=8.0cm,angle=0.0}}\end{figure}

The data are then smoothed by the task adapt_merge, an adaptive filter similar to that used for individual observations.

adapt_merge smoothingcounts=50
thresholdmasking=0.02
elowlist='400 750' ehighlist='750 1300'
binning=2 withpartcontrol=yes
withsoftcontrol=yes withmaskcontrol=no


smoothingcounts=50 is the number of events used for the kernel. thresholdmasking=0.02 is the fraction of the average value of the mask that is used as a threshold for including data in the images. In general usage the mask will be the exposure map and this parameter allows regions with low exposure and therefore poor statistics to be excluded. nbands=1 is the number of bands to be combined and elowlist=400 and ehighlist=1300 are lists (of one band in this case) of the low and high energy limits, respectively, for the energy bands. binning=2 is the binning parameter. In this case the $1100\times1100$ pixel mosaics are binned into a $550\times550$ pixel final image before smoothing. withpartcontrol=yes, and withsoftcontrol=yes control whether the QPB and SP backgrounds are subtracted. withmaskcontrol=no controls whether another mask image in used (in which case maskfile=mask.fits would be the mask file name). Finally, fill controls infilling. If fill is not equal to zero the program will loop through the data, find pixels with no data (a blank pixel), and if the blank pixel has at least three adjacent non-blank pixels the blank pixel is set to the average of all of the adjacent non-blank pixels. The parameter controls how many of these passes will be made. This is purely a cosmetic process to make prettier pictures. However the smoothed images shouldn't be used for scientific analysis anyway.

Figure 33: Merged exposure map of the M101 observations in the $0.35-1.25$ keV band.
\begin{figure}\centerline{\psfig{figure=m101-exp.ps,width=8.0cm,angle=0.0}}\end{figure}

The mosaics show the effects of both uneven residual SP contamination and significantly different exposure times over the field. The different residual SP contamination is most easily seen at the right-hand edge of the hard band image. Because there is typically many fewer cosmic background events at higher energies, the particle background is relatively much brighter, and the typical hardness of the SP background, the hard band is much more sensitive to residual uncertainties in the SP background determination. Note also that the higher-intensity crescent in the hard band also has a smoother appearance in both bands. This is an artifact of the adaptive filtering algorithm when the exposure time (see Figure 33), and therefore number of counts, is relatively non-uniform.

Figure 34 shows the spectacular MOS mosaic of the Coma Cluster in the $0.8-1.25$ keV band. 28 observations from both MOS instruments are included in the mosaic.

Figure 34: Merged image of the Coma Cluster in the $0.8-1.25$ keV band.
\begin{figure}\centerline{\psfig{figure=coma-800-1250.ps,width=8.0cm,angle=0.0}}\end{figure}

10 MOSAIC MODE OBSERVATIONS

The tasks to allow the processing of mosaic-mode observations are still in the development process, but are functional to the extent that reasonable results can be obtained. There is a significant amount of hands-on work, however, and the required steps are bound to change with time.

The fist step is to process the data in the same manner as for a simple observation through mos-filter and pn-filter (as listed above). The second step is to run the task atthkgen:

atthkgen atthkset=atthk.fits timestep=1

The next step is to run the task emosaic_prep to separate the mosaic observation into its subpointings. However, for this task to properly execute the SAS environment variable SAS_ODF must point explicitly to the *.SAS file produced by the task odfingest.

setenv SAS_ODF
../odf/2154_0672401301_SCX00000SUM.SAS

emosaic_prep must be run twice, one time for the normal pn data and one time for the OOT pn event data. The MOS files produced in the first pass must be deleted, but they will be recreated on the second pass.

emosaic_prep mos1evtfile=mos1S001-clean.fits
mos2evtfile=mos2S002-clean.fits
pnevtfile=pnS003-clean.fits
atthkfile=atthk.fits
rm -f prep_mosaic*/mos*_P*.ds
emosaic_prep mos1evtfile=mos1S001-clean.fits
mos2evtfile=mos2S002-clean.fits
pnevtfile=pnS003-clean-oot.fits
atthkfile=atthk.fits


The results of running emosaic_prep are a series of directories (e.g., prep_mosaic_001, prep_mosaic_002, etc.) containing event files with events from only a single sub-pointing. However, the event files are not yet usable in the ESAS tasks as the pointing direction keywords still contain the original pointing direction. There are two tasks which together will update the fits headers. The first task, esprep_mosaic_time will extract the subpointing directions and write them into an ASCII file.

esprep_mosaic_time
atsfile=../odf/2178_0677730101_SCX00000ATS.FIT
sasfile=../odf/2178_0677730101_SCX00000SUM.SAS


The task esas_mosaic will then loop through the subpointing directories and use the task esprep_mosaic to fix the headers of the event files.

esas-mosaic sublist=mosaic-times.txt
m1prefix=1S001 m2prefix=2S002
pnprefix=S003


The second caveat listed above (§ 4.1) notes that while this process has worked on all cases tested, there is no guarantee that it will work in all cases. If your results look odd, they probably are - please contact the developers. esprep_mosaic can also be run on individual subpointing exposures using the command:

esprep_mosaic eventsin=mos1S001-clean_P001.ds
eventsout=mos1S001-clean.fits
pa=26.375 raobj=266.652
decobj=-12.475 clobber=1


where pa, raobj, and decobj are the position angle, right ascension, and declination of the subpointing. Note that esprep_mosaic must be run separately for each detector. Also, the output file names should be consistent with the ESAS nomenclature.

Once esprep_mosaic has been run on all of the event files in all of the sub-pointing directories, the rest of the processing is identical to that for individual observations and the mosaicking of individual observations (see Figure 35).

Figure 35: Merged image of the mosaic-mode observation of the Fermi Bubble region in the $0.4-1.25$ keV band.
\begin{figure}\centerline{\psfig{figure=mosaic-mode-im.ps,width=8.0cm,angle=0.0}}\end{figure}

11 REFERENCES

20ptArnaud, M. Neumann, D. M., Aghanim, N., Gastaud, R., Majerowicz, S., & Hughes, J. P. 2001, A&A, 365, L80

20ptCarter, J. A., & Sembay, S. 2008, A&A, 489, 837

20ptEhle, M., et al. 2005, XMM-Newton Users' Handbook (Madrid: ESA)

20ptKoutroumpa, D., Collier, M. R.; Kuntz, K. D.; Lallement, R.; & Snowden, S. L. 2009, ApJ, 697, 1214

20ptKuntz, K. D., & Snowden, S. L. 2008, A&A, 478, 575

20ptNevalainen, J., Markevitch, M.,& Lumb, D. 2005, ApJ, 629, 172

20ptRead, A., & Ponman, T. 2003, A&A, 409, 395

20ptSnowden, S. L., Collier, M. R., Cravens, T., Kuntz, K. D.; Lepri, S. T., Robertson, I., & Tomas, L. 2009, ApJ, 691, 372

20ptSnowden, S. L., Collier, M. R., & Kuntz, K. D. 2004, ApJ, 610, 1182

20ptSnowden, S. L., Mushotzky, R. F., Kuntz, K. D., and Davis, D. S. 2008, A&A, 478,615

20ptStrüder, L., et al. 2001, A&A 365, L18

20ptTurner, M. J. L., et al. 2001, A&A 365, L27

20ptVikhlinin, A., Markevitch, M., Murray, S. S., Jones, C., Forman, W., & Van Speybroeck, L. 2005, ApJ, 628, 655


A. TASK DESCRIPTIONS

Appendix A provides detailed information on how to run the individual tasks of the XMM-ESAS package. prefix is used to indicate a general identifier of output files. It is the unique exposure identifier for the data set, e.g., 1S001 or 2U002 for the MOS instruments, where it is preceded in file names by the letters mos, e.g., mos1S001 or mos2U002. For the pn the prefix is of the form, e.g., S003 or U003 preceded by the letters pn, e.g., pnS003 or pnU003.

Since the ESAS tasks are now part of SAS, SAS must be initialized, with $SAS_ODF and $SAS_CCF pointing to the appropriate locations. The ODF data must be on disk and unzipped and the current location should be the working directory.

What follows is an alphabetical list of the tasks that will be described in the remainder of this appendix. The tasks are labeled as being either Perl scripts or FORTRAN routines. The Perl scripts can be extracted, modified, and run if the user has a compulsion to fiddle with the task. If a bug is found in the original version, please let the authors know about it. FORTRAN routines can't be updated without recompiling, which is beyond the scope of what most users will want to do (recompiling requires NAG FORTRAN and a lot of picky details).

A..1 ADAPT

Description:

adapt adaptively smooths background subtracted and exposure corrected images for individual exposures or all exposures of a single ObsID merged using the task comb. For each unmasked pixel, the program will average neighboring pixels within a circle of increasing radius until a selected number of counts (weighted by a triangular weighting function) is reached. The original pixel is then given the weighted average surface brightness for the pixels within the circle. Images can also be binned before smoothing.

Requirements:

20ptThe current location should be the working directory.

20ptAll of the files to be used for all of the instruments must be previously created. These include event images, exposure images, background images (QPB, SP, and SWCX), and mask images. The task comb must have been successfully run for the exposures for the data from multiple exposures to be used.

Calling Parameters:

20ptsmoothingcounts - The weighted number of counts to accumulate for the smoothing (e.g., 50).

20ptthresholdmasking - The scale factor for excluding regions from the smoothing (e.g., 0.02) based on a mask image. In the default mode the average exposure is calculated and then any pixel with exposure less than fraction*average value is excluded.

20ptdetector - 1 for a specific MOS instrument and exposure, 2 for a pn exposure, and 0 for the combined image (i.e., the output of comp). If detector=1 or detector=2 are chosen the prefix must be input using the prefix parameter.

20ptprefix - Exposure identifier if a single exposure is to be smoothed.

20ptbinning - Integer binning control in the form of the numbers of pixels to be binned (e.g., binning=2 will bin the image by $2\times2$ pixels).

20ptelow - The low energy limit for the band in eV (e.g., 400).

20ptehigh - The high energy limit for the band in eV (e.g., 1250).

20ptwithpartcontrol - Particle background control, 1 subtracts the model QPB image, 0 to not.

20ptwithsoftcontrol - Soft proton background control, enter 1 to subtract the SP background image, 0 to not.

20ptwithswcxcontrol - Solar wind charge exchange background control, enter 1 to subtract the SWCX background image, 0 to not.

20ptwithmaskcontrol - Controls the use of a mask image, enter 1 to mask, 0 to not.

20ptmaskfile - The file name for an image to provide additional masking as controlled by withmaskcontrol. The mask images must be the same size and projection as the other images.

20ptclobber - Allows pre-existing files to be overwritten, enter 1 to clobber, 0 to not (default is to clobber).

Output:

20ptadapt-elow-ehigh.fits - The smoothed image for the selected energy band (elow and ehigh) of the selected region in sky coordinates.

20ptradial-filt-elow-ehigh.qdp - A QDP plot file of the radial profile of the data for the selected energy band (elow and ehigh) of the selected region.

20ptsize-elow-ehigh.fits - An image of the smoothing FWHM.

20ptsize-elow-ehigh.qdp - A histogram of the smoothing FWHM.

Examples:

adapt smoothingcounts=50 thresholdmasking=0.02 detector=1 prefix=1S003 binning=2
elow=400 ehigh=1250 withsoftcontrol=1 withswcxcontrol=1
withmaskcontrol=1 maskfile=mos1S003-cheese.fits

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2
elow=0 ehigh=1250 withpartcontrol=1 withsoftcontrol=1 withmaskcontrol=0 clobber=1

A..2 ADAPT_MERGE

Description:

adapt_merge adaptively smooths background subtracted and exposure corrected mosaicked images. For each unmasked pixel, the program will average neighboring pixels within a circle of increasing radius until a selected number of counts from the count image is reached. The original pixel is then given the average surface brightness for the pixels within the circle. Images can also be binned before smoothing.

Requirements:

20ptThe current location should be the working directory with the mosaicked images.

20ptmerge-comp-xmm must have been successfully run for the components to be used.

Calling Parameters:

20ptsmoothingcounts - The number of counts to accumulate for the smoothing (e.g., 50).

20ptthresholdmasking - The scale factor for excluding regions from the smoothing (e.g., 0.02) based on a mask image. In the default mode the average exposure is calculated and then any pixel with exposure less than fraction*average value is excluded.

20ptelowlist - List of the low energy band limits in eV (e.g., ``400 750'').

20ptehighlist - List of the high energy band limits in eV (e.g., 1250).

20ptbinning - Integer binning control with 1 for no binning, 2 for binning by 2, etc.

20ptwithpartcontrol - Particle background control, 1 subtracts the model QPB image, 0 to not.

20ptwithsoftcontrol - Soft proton background control, enter 1 to subtract the SP background image, 0 to not.

20ptwithswcxcontrol - Solar wind charge exchange background control, enter 1 to subtract the SP background image, 0 to not.

20ptwithmaskcontrol - Controls the use of a mask image, enter 1 to mask, 0 to not.

20ptmaskfile - The file name for an image to provide additional masking as controlled by withmaskcontrol. The mask images must be the same size and projection as the other images.

20ptfill - Number of passes to fill in empty pixels. If a zero pixel has three or more non-zero neighbors, the pixel will be average value of those neighbors. Not functional - under development

20ptclobber - Allows pre-existing files to be overwritten, enter 1 to clobber, 0 to not (default is to clobber).

Output:

20ptadapt-elow-ehigh.fits - The smoothed image for the selected energy band (elow and ehigh) of the selected region in sky coordinates.

20ptradial-filt-elow-ehigh.qdp - A QDP plot file of the radial profile of the data for the selected energy band (elow and ehigh) of the selected region.

20ptsize-elow-ehigh.fits - An image of the smoothing FWHM.

20ptsize-elow-ehigh.qdp - A histogram of the smoothing FWHM.

Example:

20ptadapt smoothingcounts=50 thresholdmasking=0.02 elowlist="400 750"
ehighlist="750 1250" binning=2 withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no withmaskcontrol=no

A..3 BIN_IMAGE

Description:

bin_image produces binned count rate and count-rate uncertainty images of single observations. It can use either individual exposures or the output of the program comp that can merge all of the exposures associated with a single ObsID. For each unmasked and binned pixel, the program will determine the average count rate and the count rate uncertainty. The assumption is that the uncertainty is dominated by the counting statistics and that the systematics of the background modeling can be ignored.

Requirements:

20ptThe current location should be the working directory.

20ptAll of the files to be used for all of the instruments must be previously created. These include event images, exposure images, background images (QPB and SP), and mask images. The task comb must have been successfully run for the exposures for the data from multiple exposures to be used.

Calling Parameters:

20ptthresholdmasking - The scale factor for excluding regions from the smoothing (e.g., 0.02) based on a mask image. In the default mode the average exposure is calculated and then any pixel with exposure less than fraction*average value is excluded.

20ptdetector - 1 for a specific MOS instrument and exposure, 2 for a pn exposure, and 0 for the combined image (i.e., the output of comp). If detector=1 or detector=2 are chosen the prefix must be input using the prefix parameter.

20ptprefix - Exposure identifier if a single exposure is to be binned.

20ptelow - The low energy limit for the band in eV (e.g., 400).

20ptehigh - The high energy limit for the band in eV (e.g., 1250).

20ptbinning - Binning control with 1 for no binning, 2 for binning by 2, and 4 for binning by, you guessed it, 4.

20ptwithpartcontrol - Particle background control, 1 subtracts the model QPB image, 0 to not.

20ptwithsoftcontrol - Soft proton background control, enter 1 to subtract the SP background image, 0 to not.

20ptwithswcxcontrol - Solar wind charge exchange background control, enter 1 to subtract the SWCX background image, 0 to not.

20ptwithmaskcontrol - Controls the use of a mask image, enter 1 to mask, 0 to not.

20ptmaskfile - The file name for an image to provide additional masking as controlled by withmaskcontrol. The mask images must be the same size and projection as the other images.

20ptclobber - Allows pre-existing files to be overwritten, enter 1 to clobber, 0 to not (default is to clobber).

Output:

20ptrate-elow-ehigh.fits - The binned count rate image for the selected energy band (elow and ehigh) of the selected region in sky coordinates.

20ptsigma-elow-ehigh.fits - The binned count rate uncertainty image for the selected energy band (elow and ehigh) of the selected region in sky coordinates.

Examples:

20ptbin-image thresholdmasking=0.02 detector=1 prefix=1S003 binning=2 elow=400 ehigh=1250 withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=1 withmaskcontrol=1 mos1S003-cheese.fits

20ptbin-image thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 withpartcontrol=1 withsoftcontrol=0

A..4 BIN_IMAGE_MERGE

Description:

bin_image_merge produces binned count rate and count-rate uncertainty images of mosaicked fields using the output of the task merge_comp_xmm. For each unmasked and binned pixel, the program will determine the average count rate and the count rate uncertainty. The assumption is that the uncertainty is dominated by the counting statistics and that the systematics of the background modeling can be ignored. Binning by any reasonable integer can be selected.

Requirements:

20ptThe current location should be the directory containing the mosaicked images.

20ptAll of the files to be used for all of the instruments must be previously created. These include the mosaicked event images, exposure images, background images (QPB and SP) created by the task merge_comp_xmm.

Calling Parameters:

20ptthresholdmasking - The scale factor for excluding regions from the smoothing (e.g., 0.02) based on a mask image. In the default mode the average exposure is calculated and then any pixel with exposure less than fraction*average value is excluded.

20ptelowlist - The low energy limits for the bands in eV (e.g., 400 750).

20ptehighlist - The high energy limit for the bands in eV (e.g., 750 1250).

20ptbinning - Binning control with 1 for no binning.

20ptwithpartcontrol - Particle background control, 1 subtracts the model QPB image, 0 to not.

20ptwithsoftcontrol - Soft proton background control, enter 1 to subtract the SP background image, 0 to not.

20ptwithswcxcontrol - SWCX background control, enter 1 to subtract the SWCX background image, 0 to not.

20ptwithmaskcontrol - Masking control, enter 1 to mask the image, 0 to not.

20ptmaskfile - The file name for an image to provide additional masking as controlled by withmaskcontrol. The mask images must be the same size and projection as the other images.

20ptclobber - Allows pre-existing files to be overwritten, enter 1 to clobber, 0 to not (default is to clobber).

Output:

20ptrate-elow-ehigh.fits - The binned count rate image for the combined energy bands (or single band) (elow and ehigh) of the mosaicked data.

20ptsig-elow-ehigh.fits - The binned count rate uncertainty image for the combined energy bands (or single band) (elow and ehigh) of the mosaicked data.

Examples:

20ptbin_image_merge thresholdmasking=0.02 nbands=2 elowlist='400 750' ehighlist='750 1250' binning=1 withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0

20ptbin_image_merge thresholdmasking=0.02 nbands=2 elowlist='400 750' ehighlist='750 1250' binning=1 withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=1 maskfile=mos1S003-cheese.fits

A..5 CHEESE

Description:

cheese runs source detection on full-field images and creates cheese masks from the output. cheese produces the event, exposure, and mask images that are required in a user-selected energy band. Running cheese is not required if only the spectral files with all counts including point sources are required, or if excluding point sources is not of interest.

Requirements:

20ptSAS must be initialized, with $SAS_ODF and $SAS_CCF pointing to the appropriate locations.

20ptThe current location should be the working directory.

20ptmos-filter and pn-filter must have been successfully run.

Calling Parameters:

20ptprefixm - List of MOS detector and exposure identifiers (e.g., 1S001) for the

20ptprefixp - List of pn exposure identifiers (e.g., S003) for the

20ptverb - SAS verbosity parameter.

20ptscale - This is the energy fraction (e.g., 0.5) which sets the exclusion radius of point sources.

20ptrate - This is the flux threshold (in units of $1.0\times10^{-14}$ cgs for the exclusion of point sources (e.g., 1.0).

20ptdist - Minimum separation in arc seconds between masked sources.

20ptclobber - 1 allows the program to overwrite old files, 0 to not.

20ptelow - Low-energy limit for the band in eV (e.g., 400).

20ptehigh - High-energy limit for the band in eV (e.g., 72000).

Output:

20ptatthk.fits - SAS attitude file.

20ptboxlist.fits - The output from the first pass of eboxdetect.

20ptboxlist-f.fits - The output from the second pass of eboxdetect.

20ptemllist.fits - The output from the emldetect.

20ptWhere MOS data are processed:

20ptmosprefix-bkg_region-det.fits - The background region file made from the filtered source list mode=2. Note that this list excludes the sources and is in detector coordinates.

20ptmosprefix-bkg_region-sky.fits - The background region file made from the filtered source list mode=2. Note that this list excludes the sources and is in sky coordinates.

20ptmosprefix-cheese.fits - The cheese mask image for the prefix exposure.

Where pn data are processed:

20ptpnprefix-bkg_region-det.fits - The background region file made from the filtered source list mode=2. Note that this list excludes the sources and is in detector coordinates.

20ptpnprefix-bkg_region-sky.fits - The background region file made from the filtered source list mode=2. Note that this list excludes the sources and is in sky coordinates.

20ptpnprefix-cheese.fits - The cheese mask image for the prefix exposure.

Examples:

20ptcheese prefixm="1S003 2S004" prefixp=S005 scale=0.5 rate=1.0 dist=40.0 clobber=1 elow=300 ehigh=8000

A..6 CHEESE-BANDS

Description:

cheese-bands runs source detection on full-field images and creates cheese masks from the output for two energy bands. cheese-bands produces the event, exposure, and mask images that are required in two user-selected energy bands. Running cheese-bands is not required if only the spectral files with all counts including point sources are required, or if excluding point sources is not of interest.

Requirements:

20ptSAS must be initialized, with $SAS_ODF and $SAS_CCF pointing to the appropriate locations.

20ptThe current location should be the working directory.

20ptmos-filter and pn-filter must have been successfully run.

Calling Parameters:

20ptprefixm - List of MOS detector and exposure identifiers (e.g., 1S001) for the

20ptprefixp - List of pn exposure identifiers (e.g., S003) for the

20ptverb - SAS verbosity parameter.

20ptscale - This is the energy fraction (e.g., 0.5) which sets the exclusion radius of point sources.

20ptratet - This is the flux threshold (in units of $1.0\times10^{-14}$ cgs for the exclusion of point sources in the total (combined) band (e.g., 1.0).

20ptrates - This is the flux threshold (in units of $1.0\times10^{-14}$ cgs for the exclusion of point sources in the soft band (e.g., 1.0).

20ptrateh - This is the flux threshold (in units of $1.0\times10^{-14}$ cgs for the exclusion of point sources in the hard band (e.g., 1.0).

20ptdist - Minimum separation in arc seconds between masked sources.

20ptclobber - 1 allows the program to overwrite old files, 0 to not.

20ptelowlist - Low-energy limits for the bands in eV (e.g., 400 2000).

20ptehighlist - High-energy limits for the bands in eV (e.g., 1250 7200).

Output:

20ptatthk.fits - SAS attitude file.

20ptboxlist.fits - The output from the first pass of eboxdetect.

20ptboxlist-f.fits - The output from the second pass of eboxdetect.

20ptemllist.fits - The output from the emldetect.

20ptWhere MOS data are processed:

20ptmosprefix-bkg_region-det.fits - The combined band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptmosprefix-bkg_region-det-s.fits - The soft band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptmosprefix-bkg_region-det-h.fits - The hard band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptmosprefix-bkg_region-sky.fits - The combined band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptmosprefix-bkg_region-sky.fits-s - The soft band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptmosprefix-bkg_region-sky.fits-h - The hard band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptmosprefix-cheese.fits - The combined band cheese mask image for the prefix exposure.

20ptmosprefix-cheese-s.fits - The soft band cheese mask image for the prefix exposure.

20ptmosprefix-cheese-h.fits - The hard band cheese mask image for the prefix exposure.

Where pn data are processed:

20ptpnprefix-bkg_region-det.fits - The combined band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptpnprefix-bkg_region-det-s.fits - The soft band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptpnprefix-bkg_region-det-h.fits - The hard band background region file made from the filtered source list. Note that this list excludes the sources and is in detector coordinates.

20ptpnprefix-bkg_region-sky.fits - The combined band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptpnprefix-bkg_region-sky-s.fits - The soft band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptpnprefix-bkg_region-sky-h.fits - The hard band background region file made from the filtered source list. Note that this list excludes the sources and is in sky coordinates.

20ptpnprefix-cheese.fits - The combined band cheese mask image for the prefix exposure.

20ptpnprefix-cheese-s.fits - The soft band cheese mask image for the prefix exposure.

20ptpnprefix-cheese-h.fits - The hard band cheese mask image for the prefix exposure.

Examples:

20ptcheese-bands prefixm="1S003 2S004" prefixp=S005 scale=0.5 ratet=1.0 rates=1.0 rateh=1.0 dist=40.0 clobber=1 elowlist='400 2000' ehighlist='1250 7200'

A..7 CLEAN

Description:

clean removes a fair number of intermediate files that can be deleted when all of the processing is complete.

Requirements:

20ptNone.

Calling Parameters:

clean

20ptNo additional parameters.

Output:

20ptNone.

Example:

clean

A..8 COMB

Description:

comb combines the various MOS1, MOS2, and pn images from a single observation, as well as images from multiple exposures into single count, exposure, model QPB, and SP background images.

comb compensates for the inclusion of observations with different filters in the mosaic. It uses the results of PIMMS with the assumption of a power-law spectrum with photon indices (alpha) of 2.4, 1.7, and 1.0, and absorption of $N_{H}=2{\times}10^{20}$ H I cm$^{-2}$. The user enters a value for alpha between 1.0 and 2.4 where 1.0 will select the hard spectrum, 1.7 selects the medium spectrum, and 2.4 selects the soft spectrum. Intermediate values will produce a linear scaling between the two nearest spectra. The exposure image is then scaled by the ratio of the model count rates for the MOS2 medium filter versus the thin or thick, making the resultant image appropriate for the MOS2 medium filter.

Requirements:

20ptThe current location should be the working directory.

20ptTo merge event and exposure images, mos-spectra and/or pn-spectra must have been successfully run for all exposures.

20ptIf particle background images are to be merged mos_back and/or pn_back and rot-im-det-sky must have been successfully run for all exposures.

20ptTo include SP images the soft proton spectrum must have been fit and the tasks proton and rot-im-det-sky successfully run.

20ptTo include SWCX images the SWCX Gaussian spectra must have been fit and the tasks swcx and rot-im-det-sky successfully run.

20ptInclusion of the QPB, SP, and SWCX images are selected in the command.

Calling Parameters:

20ptcaldb - CCF directory including the ESAS calibration files.

20ptwithpartcontrol - Particle background flag, 1 to include, 0 to not.

20ptwithsoftcontrol - Soft proton background flag, 1 to include, 0 to not.

20ptwithswcxcontrol - Solar wind charge exchange background flag, 1 to include, 0 to not.

20ptelowlist - List of the low energy limits for the energy bands to be merged in eV (e.g., elowlist=400).

20ptehighlist - List of the high energy limits for the energy bands to be merged in eV (e.g., ehighlist="750 1250).

20ptmask - The masking control. 0: No additional masking, 1: uses the mask produced by the cheese or 1, 11, 12: cheese-bands (total, soft, hard bands) tasks, 2: uses the normal mask images produced by eexpmap, and 3, 31, 32: uses the masks created from the task make_mask_merge for the combined, soft, or hard bands. normal mask images produced by eexpmap modified by make-mask.

20ptprefixlist - Detector and exposure identifiers (e.g., prefixlist="1S001 2S002 S003") as discussed at the start of the Appendix.

20ptalpha - Assumed power law spectral index for scaling exposure maps to account for different filters.

20ptclobber - 1 allows the program to overwrite old files, 0 to not. Output:

20ptmos-obj-im-elow-ehigh.fits - The combined count image for the prefix exposure, selected energy band (elow and ehigh), and the selected region in sky coordinates.

20ptmos-exp-imelow-ehigh.fits - The combined exposure image for the prefix exposure, selected energy band (elow and ehigh), and the selected region in sky coordinates.

20ptmos-back-im-sky-elow-ehigh.fits - The combined model particle background image for the prefix exposure, selected energy band (elow and ehigh), and the selected region in sky coordinates.

20ptmos-prot-im-sky-elow-ehigh.fits - The combined model soft proton background image for the prefix exposure, selected energy band (elow and ehigh), and the selected region in sky coordinates.

Example:

20ptcomb caldb=/CALDB/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 elowlist=400 ehighlist=1250 mask=1 prefixlist="1S003 2S004 S005" alpha=1.7

20ptcomb caldb=/CALDB/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 elowlist='400 750' ehighlist='750 1250' mask=1 prefixlist="1S003 2S004 S005" alpha=1.7

A..9 CONV_REG

Description:

conv_reg converts region information in sky coordinates (RA,Dec) into region information in detector coordinates (DETX,DETY). conv_reg will use as input data for individual regions, ASCII lists, or an input region file with RA, and Dec. Currently only circular and elliptical regions are supported.

Requirements:

20ptThe current location should be the working directory.

20ptThe processing must have progressed through mos-filter and pn-filter where the prefix-clean.fits files are created.

20ptA region information with entries in celestial coordinates with RA and Dec in decimal degrees, the radius in circular regions in arc minutes or the semi-major and semi-minor axes in arc minutes for elliptical regions, and the rotation angle in decimal degrees for elliptical regions.

Calling Parameters:

20ptmode - mode=1 uses an input region file. mode=2 uses an input ASCII file with ordered groups of SHAPE, RA, DEC, R (for elliptical regions the semi-major and semi-minor axes are stored in R), and ROTANG (ROTANG is not included for circular regions. mode=3 uses direct input of parameters.

20ptdetector - EMOS1, EMOS2, or PN

20ptimagefile - Sky coordinate image produced by ESAS (e.g., mos1S001-obj-image-sky.fits

20ptIn addition, only for mode=1: inputfile - Region file with columns X,Y replaced with RA,Dec.
outputfile - Output region file

20ptIn addition, only for mode=2: outputfile - ASCII file with shape, detx, dety, radius, and rotation angle.
inputfile - Input ASCII file with shape, RA, Dec, radius (for elliptical regions the semi-major and semi-minor axes are included), and the rotation angle (not included for circular regions). For example:

 
ELLIPSE  84.7 -68.35 4.0 2.0 25.0
!ELLIPSE 84.5 -68.45 5.0 3.0 25.0
ellipse  84.3 -68.55 6.0 4.0 25.0
!ellipse 84.1 -68.65 7.0 5.0 25.0
CIRCLE   84.7 -68.65 4.0
!CIRCLE  84.5 -68.55 5.0
circle   84.3 -68.45 6.0
!circle  84.1 -68.35 7.0

20ptIn addition, only for mode=3: shape, ra, dec, radius or semimajor and semiminor, and rotangle (elliptical regions only).

Output:

20ptmode=1 - User named region fits file

20ptmode=2 - User named file containing region data

20ptmode=3 - Screen output with region data

Example:

20ptconv_reg mode=1 detector=EMOS1 inputfile=test-in-sky-radec-mos1.fits outputfile=test-out-mos1.fits imagefile=mos1S001-obj-image-sky.fits

20ptconv_reg mode=2 detector=EMOS1 inputfile=input.txt outputfile=tempout.txt imagefile=mos1S001-obj-image-sky.fits

20ptconv_reg mode=3 detector=EMOS1 imagefile=mos1S001-obj-image-sky.fits shape=CIRCLE ra=84.7 dec=-68.35 radius=5.0

A..10 CONV-REGION

Description:

conv-region uses an input region FITS file with entries in sky coordinate to produce region files in detector coordinates for all instruments from all ObsIDs in a list. Also created are ASCII files suitable for use in the XMM-ESAS tasks mos-spectra and pn-spectra. Currently only circular regions are supported.

Requirements:

20ptThe current location should be the working directory.

20ptThe processing must have progressed through mos-filter and pn-filter where the prefix-clean.fits files are created.

20ptA region file with entries in celestial coordinates with RA and Dec in decimal degrees and the circular region radius in arc seconds.

Calling Parameters:

20ptobsidlist - An ASCII list of ordered pairs of working directory and ODF directory for all ObsIDs to be processed.

20pttargfile - A region fits file with circular regions in celestial coordinates with RA and Dec in decimal degrees and the circular region radius in arc seconds. NOTE #1: Regions to be selected must be grouped at the start of the list while regions to be excluded must be grouped at the end of the list. NOTE #2: Only circular regions are supported at this time.

Output:

20ptreg-det.txt - ASCII file suitable for use as the region parameter in the task calls of mos-spectra and pn-spectra. det is the detector (mos1, mos2, pn)

20ptprefix-det-targ-n.fits - The output region fits files in detector coordinates where prefix is as defined above and n is the number of the region. One file is created for each entry in the original region list.

Example:

20ptconv-region obsidlist=obsid-list.txt targfile=region-sky.fits

A..11 ESAS_MOSAIC

Description:

esas_mosaic is a driving routine to organize the output of esprep_mosaic_times and call esprep_mosaic to correct the header information of the subpointing data separated by the task emosaic_prep.

Requirements:

20ptThe current location should be the working directory of the mosaic-mode data.

20ptProcessing should be complete through emosaic_prep and esprep_mosaic_times.

Calling Parameters:

20ptsublist - File name of output from esprep_mosaic_times.

20ptm1prefix - ESAS prefix for the MOS1 data.

20ptm2prefix - ESAS prefix for the MOS2 data.

20ptpnprefix - ESAS prefix for the pn data.

Output:

20ptRevised event files with ESAS compatible headers for the mosaic-mode subpointings.

Example:

20ptesas-mosaic sublist=mosaic-times.txt m1prefix=1S001 m2prefix=2S002 pnprefix=S003

A..12 ESPREP_MOSAIC

Description:

esprep_mosaic modifies the output event files produced by the task emosaic_prep for the individual sub-pointings of mosaic-mode observations so they can be used by the ESAS package. For each event file it will update the observation point FITS keywords to be appropriate for the sub-pointing and transform the X,Y sky coordinates to be appropriate.

esprep_mosaic is called by esas_mosaic which reads the output file from esprep_mosaic_times to access the individual subpointing direction and roll angle.

Requirements:

20ptThe current location should be the working directory of the files to be converted.

20ptSAS and ESAS tasks through emosaic_prep must have been successfully run for the observation.

Calling Parameters:

20pteventsin - The input event list (output from emosaic_prep.

20pteventsout - The output event file.

20ptraobj - The right ascension (in decimal degrees) of the sub-pointing pointing direction.

20ptdecobj - The declination (in decimal degrees) of the sub-pointing pointing direction.

20ptpa - The rotation angle (in decimal degrees) of the sub-pointing pointing direction.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptUser-selected file name - Converted event file.

Example:

20ptesprep_mosaic eventsin=mos1S001-clean_P001.ds eventsout=mos1S001-clean.fits raobj=122.8765 decobj=-47.12345 clobber=1

A..13 ESPREP_MOSAIC_TIMES

Description:

esprep_mosaic_times extracts the subpointing directions and rotation angles for mosaic-mode observations for use in the task esprep_mosaic.

Requirements:

20ptThe current location should be the working directory of the mosaic-mode observation.

Calling Parameters:

20ptatsfile - File name and path to the *ATS.FIT file in the ODF directory.

20ptsasfile - File name and path to the *SUM.SAS file (the output of odfingest, usually found in the ODF directory).

Output:

20ptmosaic-times.txt - List of pointing directions and roll angles for the subpointings.

Example:

20ptesprep_mosaic_time atsfile=../odf/2178_0677730101_SCX00000ATS.FIT
sasfile=../odf/2178_0677730101_SCX00000SUM.SAS

A..14 MAKE_MASK

Description:

make_mask is called by cheese to create a cheese mask from the filtered source list. make-mask can also be called independently once the emldetect source list in sky coordinates has been created. With earlier SAS versions this occasionally necessary as the list sometimes contained excessively large source exclusion radii which had be edited.

Requirements:

20ptThe current location should be the working directory.

20ptESAS tasks through cheese must have been successfully run for the exposure.

Calling Parameters:

20ptinimage - The event image for the exposure.

20ptinmask - The exposure mask.

20ptoutmask - The output file name for the cheese mask.

20ptreglist - The filtered source region list in sky coordinates.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptoutmask - The output file name is an input parameter to the program, however as make-mask will typically be called by cheese the name will be mosprefix-cheese.fits or pnprefix-cheese.fits as above where prefix is the standard definition (e.g., 1S001 for the MOS or S003 for the pn).

Example:

20ptmake_mask inimage=mos1S001-obj-im.fits inmask=mos1S001-mask-im.fits outmask=mos1S001-cheese.fits reglist=mos1S001-bkg_region.fits clobber=1

A..15 MAKE_MASK_MERGE

Description:

make_mask_merge can be run to create a cheese mask for individual observations using a merged source list created by the task merge_source_list from multiple observations. This is useful when mosaicking multiple observations where the sensitivity for point-source detection differs (e.g., where there are significant variations in the observation exposures or location of the source on the detectors).

make_mask_merge will make cheese masks in the one band of cheese and in the three bands of cheese-bands (soft, hard, and combined). In the latter case the source flux threshold for each band is set separately.

Requirements:

20ptThe current location should be the working directory of an individual observation.

20ptmerge-source-list must have been successfully run for the exposure.

20ptThe processing of the individual observations must be complete.

Calling Parameters:

20ptsrclist: Source list (merged-source-list.fits)

20ptprefix: Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptinmask: input mask file name

20ptflimtot: combined band source flux threshold ($10^{-14}$ cgs)

20ptflimsoft: soft band source flux threshold ($10^{-14}$ cgs)

20ptflimhard: hard band source flux threshold ($10^{-14}$ cgs)

20ptscale: scale factor for W90 radius

20ptseper: minimum allowed source separation in arc seconds

20ptmaxlikelim: minimum maximum likelihood source detection parameter

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptmos or pnprefix-msl-cheese.fits - The output file name for the cheese mask for the total band (from cheese or cheese-bands).

20ptmos or pnprefix-msl-cheese-s.fits - The output file name for the cheese mask for the soft band (from cheese-bands).

20ptmos or pnprefix-msl-cheese-h.fits - The output file name for the cheese mask for the hard band(from cheese-bands.

Example:

20ptmake_mask_merge srclist=merged-source-list.fits prefix=1S002 inmask=mos1S001-mask-im-750-1250.fits flimtot=0.5 flimsoft=0.5 flimhard=0.5 scale=0.9 seper=40 maxlikelim=15.0

A..16 MERGE_COMP_XMM

Description:

merge_comp_xmm combines the images produced for individual observations (ObsIDs) into larger field mosaics. This includes the event and exposure images (output from mos-spectra), QPB background images (output from mos_back processed by rot_im_det_sky), the SP images (output from proton also processed by rot_im_det-sky) and the SWCX images (output from swcx also processed by rot_im_det-sky). Data type to be mosaicked, image size, pixel size, coordinate system, and central coordinates are all user selected.

merge_comp_xmm when mosaicking the exposure images compensates for the inclusion of observations with different instruments and filters. It uses the results of PIMMS with the assumption of a power-law spectrum with photon indices (alpha) of 2.4, 1.7, and 1.0, and absorption of $N_{H}=2{\times}10^{20}$ H I cm$^{-2}$. The user enters a value for alpha between 1.0 and 2.4 where 1.0 will select the hard spectrum, 1.7 selects the medium spectrum, and 2.4 selects the soft spectrum. Intermediate values will produce a linear scaling between the two nearest spectra. The exposure image is then scaled by the ratio of the model count rates for the MOS2 medium filter versus the thin or thick, making the resultant image appropriate for the MOS2 medium filter.

Requirements:

20ptWith no surprise, the component to be mosaicked must already have been produced for all ObsIDS to be included.

Calling Parameters:

20ptcaldb - CCF directory containing the ESAS calibration files.

20ptdirfile - File containing the list of exposures, including the directory string, for data to be merged. For instance, if the merging processing is being done in the directory /DATA/merge and the individual observations are located in the parallel directories /DATA/obs1/proc and /DATA/obs2/proc, the file dirlist could have entries such as:

/DATA/obs1/proc/mos1S001
/DATA/obs1/proc/mos2S002
/DATA/obs1/proc/pnS003
/DATA/obs2/proc/mos1S001
/DATA/obs2/proc/mos2S002
/DATA/obs2/proc/pnS003

or more simply using the relative path:

../obs1/proc/mos1S001
../obs1/proc/mos2S002
../obs1/proc/pnS003
../obs2/proc/mos1S001
../obs2/proc/mos2S002
../obs2/proc/pnS003

20ptcoord - Selects which coordinate system should be used, 1: ecliptic, 2: equatorial, 3: galactic.

20ptcrvaln1 - Central longitude of the projection.

20ptcrvaln2 - Central latitude of the projection.

20ptpixelsize - Pixel size of the projection in arc minutes.

20ptcomponent - Component to be cast, 1: count image, 2: exposure, 3: QPB counts, 4: SP counts, 5: SWCX counts.

20ptelow - The low energy for the band in eV (e.g., 400).

20ptehigh - The high energy for the band in eV (e.g., 1250).

20ptmaskcontrol - Mask control, 0: no masking, 1: point source masking using the output from cheese or 3, 31, 32: for masking from cheese-bands for the total, soft, or hard bands, 2: good area masking using the masks produced by mos-spectra, 3, 31, 32: mask from merged source list output from make_mask_merge for the total, soft, or hard bands.

20ptalpha - Assumed power law spectral index ( $2.4>\alpha>1.0$) for scaling the exposure maps to account for different filters.

20ptxdim - Out image size in X dimension.

20ptydim - Out image size in X dimension.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

For the different values of comp, the output files are:

20ptcomponent=1: obj-im-ehigh-ehigh.fits - The count image

20ptcomponent=2: exp-im-ehigh-ehigh.fits - The exposure image

20ptcomponent=3: back-im-ehigh-ehigh.fits - The QPB count image

20ptcomponent=4: prot-im-ehigh-ehigh.fits - The SP count image

20ptcomponent=5: swcx-im-ehigh-ehigh.fits - The SWCX count image

Example:

20ptmerge_comp_xmm caldb=/CALDB dirfile=dir.dat coord=2 crvaln1=210.82 crvaln2=54.34 pixelsize=0.05 component=1 elow=400 ehigh=1250 maskcontrol=2 alpha=1.7

A..17 MERGE_SOURCE_LIST

Description:

merge_source_list creates a master list of sources detected from a list of observations which have been processed to the point of creating an emldetect source list. Sources are compared and those within 2" of each other have the one with the lower flux thrown out. merge_source_list will process source lists with only a total band as created by it cheese or with two bands, hard and soft, along with a total band as created by it cheese-bands.

The output fits file can then be used on the individual observation (obsID) level to make self-consistent cheese masks for the mosaicking of observations.

Requirements:

20ptThe individual observations which will have their emldetect source lists merged must be processed through cheese or cheese-bands.

Calling Parameters:

20ptdirfile - File containing the list of observations for data to be merged. For instance, if the merging processing is being done in the directory /DATA/merge and the individual observations are located in the parallel directories /DATA/obs1/proc and /DATA/obs2/proc, the file dirlist.dat should have the entries:

/DATA/obs1/proc/
/DATA/obs2/proc/

20ptmaxlikelim - Minimum maximum-likelihood detection significance four sources in the merged source list.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptmerged-source-list.fits - The merged source list fits file.

Example:

20ptmerge_source_list dirfile=dir.dat maxlikelim=15.0

A..18 MOS_BACK

Description:

mos_back creates model particle background spectra and images (if selected with a non-zero energy range) for the selected region from the intermediate files produced from mos-spectra. The resultant image is in detector coordinates. The resultant image is in detector coordinates which is transformed into sky coordinates by the perl script rot-im-det-sky. mos_back creates a QDP plot file which shows the source and model background spectra for the observation. Any enhancement of the data over the particle background model at higher energies probably indicates residual soft proton contamination, unless there are really hard and bright sources in the field.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra must have been successfully run at least once for the exposures to be used.

Calling Parameters:

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptcaldb - The CCF directory where the ESAS calibration data are located (QPB).

20ptdiag - Controls the amount of diagnostic output (0 low, 1 medium, 2 high).

20ptelow - The low energy limit for the energy band in eV (e.g., 400).

20ptehigh - The high energy limit for the energy band in eV (e.g., 1250). If elow and ehigh are set to 0, the image processing will be eliminated and only spectral files will be produced.

20ptccd1-ccd7 - Flags to include (ccd#=1) or exclude (ccd#=0) individual CCDs. This feature can be used when certain CCDs are in their anomalous states or for MOS1 CCD #6 after damage by the micrometeorite strike.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptmosprefix-aug.qdp - A QDP plot file showing the selected region of hardness/count rate distributions for the various CCDs.

20ptmosprefix-back-im-det-elow-ehigh.fits - The model particle background image for the prefix exposure, selected energy band (elow and ehigh), and the selected region. The image is in detector coordinates.

20ptmosprefix-back.pi - The model particle background spectrum for the prefix exposure and the selected region.

20ptmosprefix-spec.qdp - A QDP plot file showing the observed spectrum and the model background spectrum.

20ptAdditional output when diag=2

20ptmosprefix-back.qdp - A QDP plot file showing the normalized model background spectrum.

20ptmosprefix-back-accum.qdp - A QDP plot file showing the accumulating background spectrum. Chip 1 at the bottom increasing upwards.

20ptmosprefix-bridge-fit.qdp - A QDP plot file showing the fit for the Al-Si bridge.

Examples:

20ptmos_back prefix=1S003 caldb=/CALDB diag=0 elow=400 ehigh=1250 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

20ptmos_back prefix=1S003 caldb=/CALDB diag=0 elow=0 ehigh=50 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=0 ccd7=1

A..19 MOS-FILTER

Description:

mos-filter is the initial ESAS script to be run on the data. It operates on all imaging calibrated photon event files produced by a call to emchain. This includes data from the outer CCDs when CCD #1 is operated in timing mode. However, data from CalClosed9exposures are ignored. mos-filter calls the task espfilt to screen for SP flares and removes affected intervals.

Requirements:

20ptThe task emchain must have been run to create calibrated photon event files.

Calling Parameters:

None

Output:

mos-filter will process all of the imaging exposures associated with an ObsID, occasionally producing useless results (e.g., very short exposures, etc.). The case of Abell-1795 is a good example as there are CalClosed exposures for both the MOS1 and MOS2 instruments which are ignored. These exposures (prefixes 1S011 and 2S012) are each about 2 ks and contain no sky data. Note that the ``soft'' images should be examined for CCDs in their anomalous modes and the ``hist'' QDP plots should be examined to determine the utility of the data and to gauge the probability of a residual SP component.

20ptmosprefix-clean.fits - The filtered photon event files

20ptmosprefix-corn.fits - Event list of data from the corners of the detectors

20ptmosprefix-corn-image.fits - Image of the filtered data from the unexposed corners in detector coordinates

20ptmosprefix-gti.fits - Fits file list of good time intervals identified by the task espfilt

20ptmosprefix-gti.txt - Ascii list of good time intervals identified by the task espfilt

20ptmosprefix-hist.qdp - QDP plot file of the light curves showing the filtered intervals and a histogram of the mosprefix-rate.fits showing the filtering selection.

20ptmosprefix-obj-image-det.fits - Image of the filtered data in detector coordinates

20ptmosprefix-obj-image-det-soft.fits - Image of the filtered data in detector coordinates in the $0.2-0.9$ keV band

20ptmosprefix-obj-image-det-unfilt.fits - Image of the unfiltered data in detector coordinates

20ptmosprefix-obj-image-sky.fits - Image of the filtered data in sky coordinates

20ptmosprefix-ori.fits - The photon event files produced by emchain

20ptmosprefix-ratec.fits - Light curve of the data from the corners of the detectors in the $2.5-12.0$ keV band

20ptmosprefix-rate.fits - Light curve of the data within the open area of the detectors in the $2.5-12.0$ keV band

Example:

mos-filter

A..20 MOS-SPECTRA

Description:

mos-spectra processes the cleaned event file output from mos-filter to produce intermediate files for the creation of model particle background spectra and images by the FORTRAN program mos_back. The user can select specific regions of the detector and specific energy bands to create spectra and images. With no additional region specification, mos-spectra will create spectra and images for the entire FOV.

Requirements:

20ptThe current location should be the working directory.

20ptmos-filter must have been successfully run. The light curve plot file should be examined to check whether there are any useful data for an individual exposure.

20ptcheese must have been successfully run for point source exclusion.

20ptThe observation soft images should be checked to determine both if all CCDs were operating in imaging mode or if they are in an anomalous mode. If they are not operating or if they are operating but in an anomalous mode they should be deselected using the ccd1-ccd7 parameters.

Calling Parameters:

20ptprefix - detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptregion - the selection expression for the desired region for the generation of the model background spectrum. If no file with the input name exists, or if the file is empty, then the default is to model the data from the entire field of view. If a specific region is desired, the region expression must be in detector coordinates. For example, a file containing &&((DETX,DETY) IN circle(201,-219,3600)) would extract the central $3'$ of the cluster Abell 1795. Note that the leading ``&&'' are required as the selection expression is added to other constraints.

20ptmask - Flag to mask out point sources. 0 selects no masking while 1 will cause mos-spectra to use the output filtered source region file from cheese.

20ptelow - The low energy limit for the energy band in eV (e.g., 400).

20ptehigh - The high energy limit for the energy band in eV (e.g., 1250). If elow and ehigh are set to 0, the image processing will be eliminated and only spectral files will be produced.

20ptccd1-ccd7 - These are flags to include individual CCDs. If it is desired to exclude one of the CCDs, e.g., CCD #5 (it operates occasionally in an anomalous mode) then a ccd5=0 should be entered.

20ptcaldb - The CCF directory where ESAS calibration data are located.

Output:

20ptatthk.fits - Attitude history file (if not already created by cheese).

20ptmosprefix-*obj.pi - The observation data spectrum from the selected region from the individual CCDs. The CCD number, ``*'' in the file name, runs from 1 to 7 including only the selected CCDs.

20ptmosprefix-*ff.pi - The filter-wheel-closed data spectrum from the selected region from the individual CCDs. The CCD number, ``*'' in the file name, runs from 1 to 7.

20ptmosprefix-im*-elow-ehigh.fits - The image of the filter-wheel-closed data from the selected region from the individual CCDs for the selected band. The CCD number, ``*'' in the file name, runs from 1 to 7 and the band limits, elow and ehigh indicate the energy band.

20ptmosprefix-*oc.pi - The corner spectrum from the observation data from the individual CCDs. The ccd number, ``*'' in the file name, runs from 2 to 7.

20ptmosprefix-*fc.pi - The corner spectrum from the filter-wheel-closed data from the individual CCDs. The CCD number, ``*'' in the file name, runs from 2 to 7.

20ptmosprefix.arf - The ARF file for the mosprefix-obj.pi spectrum.

20ptmosprefix.rmf - The RMF file for the mosprefix-obj.pi spectrum.

20ptmosprefix-exp-im.fits - The exposure image for the observation data in sky coordinates from the field-of-view for all selected CCDs for the full energy band.

20ptmosprefix-exp-im-elow-ehigh.fits - The exposure image for the observation data from the selected region for all selected CCDs for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-exp-im-elow-ehigh-ccd1.fits - The exposure image for the observation data from the selected region for ccd #1 for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-mask-im.fits - The mask image for the observation data from the field-of-view for all selected CCDs for the full energy band.

20ptmosprefix-mask-im-elow-ehigh.fits - The mask image for the observation data from the selected region for all selected CCDs for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-mask-im-elow-ehigh-ccd1.fits - The mask image for the observation data from the selected region for CCD #1 for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-obj.pi - The observation data spectrum from the selected region.

20ptmosprefix-obj-im.fits - The image of the observation data in sky coordinates from the full field-of-view for all selected CCDs for the full energy band.

20ptmosprefix-obj-im-elow-ehigh.fits - The image of the observation data in sky coordinates from the selected region for all selected CCDs for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-obj-im-elow-ehigh-ccd1.fits - The image of the observation data from the selected region for CCD #1 for the selected band. elow and ehigh indicate the band limits.

20ptmosprefix-obj-im-sp-det.fits - Image of the selected region in detector coordinates. This image is used in the task proton_scale.

20ptmosprefix-obj-im-det-elow-ehigh.fits - The image of the observation data in detector coordinates from the selected region for all selected CCDs for the selected band. elow and ehigh indicate the band limits.

Examples:

20ptmos-spectra prefix=1S003 caldb=/CALDB region=regm1.txt mask=1 elow=400 ehigh=1250 ccd1=1 ccd2=1 ccd3=1 ccd1=4 ccd1=5 ccd6=1 ccd7=1

20ptmos-spectra prefix=1S003 caldb=/CALDB region=regm1.txt mask=1 elow=0 ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd1=4 ccd1=0 ccd6=1 ccd7=1

A..21 PN_BACK

Description:

pn_back creates model particle background spectra and images (if selected with a non-zero energy range) for the selected region from the intermediate files produced from pn-spectra. The resultant image is in detector coordinates which is transformed into sky coordinates by the task rot-im-det-sky. pn_back creates several QDP plot files which show the source and model background spectra for the observation and other diagnostic information. Any enhancement of the data over the particle background model at higher energies probably indicates residual soft proton contamination, unless there are really hard and bright sources in the field that haven't been masked.

Requirements:

20ptThe current location should be the working directory.

20ptpn-spectra must have been successfully run at least once for the exposures to be used.

Calling Parameters:

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptcaldb - The CCF directory containing the ESAS calibration files.

20ptdiag - Controls the amount of diagnostic output (0 low, 1 medium, 2 high).

20ptelow - The low energy limit for the energy band in eV (e.g., 400).

20ptehigh - The high energy limit for the energy band in eV (e.g., 1250). If elow and ehigh are set to 0, the image processing will be eliminated and only spectral files will be produced.

20ptquad1-quad4 - These are flags to include (1) or exclude (0) quadrants of the pn for processing.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptOutput files when diag = 0

20ptpnprefix-back-im-det-elow-ehigh.fits - The model particle background image for the prefix exposure, selected energy band (elow and ehigh), and the selected region. The image is in detector coordinates.

20ptpnprefix-back.pi - The model particle background spectrum for the prefix exposure and the selected region.

20ptpnprefix-obj-os.pi - Out of time subtracted spectrum for the selected region.

20ptpnprefix-spec.qdp - A QDP plot file showing the observed spectrum and the model background spectrum.

20ptpnprefix-aug-spec.qdp - A QDP plot file showing the augmented spectra for the four quadrants.

20ptpnprefix-aug.qdp - A QDP plot file showing the selected region of hardness/count rate distributions for the four quadrants.

Examples:

20ptpn_back prefix=S005 caldb=/CALDB diag=0 elow=400 ehigh=1250 quad=1 quad=1 quad3=1 quad4=1

A..22 PN-FILTER

Description:

pn-filter is the first ESAS task in the processing of pn data and plays an analogous role to the MOS task mos-filter. Primarily it runs the task espfilt to filter SP flares from the data. It will process all FullFrame and FullFrameExtended pn imaging data except for CalClosed data. The task pnchain must have been run for all useful exposures in both standard and out-of-time modes.

Requirements:

20ptThe current location should be the working directory

20ptThe task epchain must have been run on all useful exposures in both standard and out-of-time modes.

Calling Parameters:

20ptNone

Output:

pn-filter will process all of the imaging exposures associated with an ObsID, occasionally producing useless results (e.g., very short exposures).

20ptpnprefix-clean.fits - The filtered photon event files

20ptpnprefix-clean-oot.fits - The filtered OOT photon event files

20ptpnprefix-gti.txt - Ascii list of good time intervals identified by the SAS task espfilt

20ptpnprefix-gti-oot.txt - Ascii list of good OOT time intervals identified by the SAS task espfilt

20ptpnprefix-gti.fits - Fits file list of good time intervals identified by the SAS task espfilt

20ptpnprefix-gti-oot.fits - Fits file list of OOT good time intervals identified by the SAS task espfilt

20ptpnprefix-hist.qdp - QDP plot file of the light curves showing the filtered intervals and a histogram of the

20ptpnprefix-hist-oot.qdp - QDP plot file of the OOT light curves showing the filtered intervals and a histogram of the pnprefix-rate.fits showing the filtering selection.

20ptpnprefix-obj-image-det.fits - Image of the filtered data in detector coordinates

20ptpnprefix-obj-image-det-oot.fits - Image of the filtered OOT data in detector coordinates

20ptpnprefix-obj-image-det-unfilt.fits - Image of the unfiltered data in detector coordinates

20ptpnprefix-obj-image-det-unfilt-oot.fits - Image of the unfiltered OOT data in detector coordinates

20ptpnprefix-obj-image-sky.fits - Image of the filtered data in sky coordinates

20ptpnprefix-obj-image-sky-oot.fits - Image of the filtered OOT data in sky coordinates

20ptpnprefix-ratec.fits - Light curve of the data from the corners of the detectors in the $2.5-12.0$ keV band

20ptpnprefix-ratec-oot.fits - Light curve of the OOT data from the corners of the detectors in the $2.5-12.0$ keV band

20ptpnprefix-rate.fits - Light curve of the data within the open area of the detectors in the $2.5-12.0$ keV band

20ptpnprefix-rate-oot.fits - Light curve of the OOT data within the open area of the detectors in the $2.5-12.0$ keV band

20ptpnprefix-ori.fits - The photon event files produced by epchain

20ptpnprefix-oot.fits - The OOT photon event files produced by epchain

Example:

pn-filter

A..23 PN-SPECTRA

Description:

pn-spectra processes the cleaned event file output from pn-filter to produce intermediate files for the creation of model particle background spectra and images by pn_back. The user can select specific regions of the detector and specific energy bands to create spectra and images. With no additional region specification, pn-spectra will create spectra and images for the entire FOV.

Requirements:

20ptpn-filter must have been successfully run. The light curve plot file should be examined to check whether there are any useful data for an individual exposure.

20ptcheese or cheese-bands must have been successfully run for point source exclusion.

20ptThe observation image should be checked to determine if all quadrants were operating in imaging mode. If not, they should be selected against using the q1-q4 parameters.

Calling Parameters:

20ptprefix - detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptcaldb - The CCF directory containing the ESAS calibration files.

20ptregion - The selection expression for the desired region for the generation of the model background spectrum. If no file with the input name exists, or if the file is empty, then the default is to model the data from the entire field of view. If a specific region is desired, the region expression must be in detector coordinates. For example, a file containing &&((DETX,DETY) IN circle(201,-219,3600)) would extract the central $3'$ of the cluster Abell 1795. Note that the leading `` &&'' are required as the selection expression is added to other constraints.

20ptmask - Flag to mask out point sources. 0 selects no masking while 1 will cause pn-spectra to use the output filtered source region file from cheese.

20ptelow - The low energy limit for the energy band in eV (e.g., 400).

20ptehigh - The high energy limit for the energy band in eV (e.g., 1250). If elow and ehigh are set to 0, the image processing will be eliminated and only spectral files will be produced.

20ptpattern - Pattern selection for accepted events (usually 4).

20ptquad1-quad4 - These are flags to include (1) or exclude (0) individual quadrants (e.g., 1 1 1 1 to include all of the quadrants).

Output:

20ptatthk.fits - Attitude history file (if not already created by cheese or mos-spectra).

20ptpnprefix.arf - The ARF file for the pnprefix-obj.pi spectrum.

20ptpnprefix.rmf - The RMF file for the pnprefix-obj.pi spectrum.

20ptpnprefix-obj.pi and pnprefix-obj-oot.pi - The observation data spectrum from the selected region (normal and OOT processing).

20ptpnprefix-*obj.pi and pnprefix-*obj-oot.pi - The observation data (normal and OOT processing) spectrum from the selected region from the individual CCDs. The quadrant number, ``*'' in the file name, runs from 1 to 4 including only the selected quadrants.

20ptpnprefix-*ff.pi and pnprefix-*ff-oot.pi - The filter-wheel-closed data (normal and OOT processing) spectrum from the selected region from the individual quadrants. The quadrant number, ``*'' in the file name, runs from 1 to 4.

20ptpnprefix-*oc.pi and pnprefix-*oc-oot.pi - The corner spectrum from the observation data (normal and OOT processing) from the individual quadrants. The quadrant number, ``*'' in the file name, runs from 1 to 4.

20ptpnprefix-*fc.pi and pnprefix-*fc-oot.pi - The corner spectrum from the filter-wheel-closed data (normal and OOT processing), ``*'' in the file name, runs from 1 to 4.

20ptpnprefix-im*-elow-ehigh.fits and pnprefix-im*-elow-ehigh-oot.fits - The image of the filter-wheel-closed data (normal and OOT processing) from the selected region from the individual quadrants for the selected band. The quadrant number, ``*'' in the file name, runs from 1 to 4 and the band limits, elow and ehigh indicate the energy band.

20ptpnprefix-obj-im.fits and pnprefix-obj-im-oot.fits - The image of the observation data (normal and OOT processing) in sky coordinates from the full field-of-view for all selected quadrants for the full energy band.

20ptpnprefix-mask-im.fits - The mask image for the observation data from the field-of-view for all selected quadrants for the full energy band.

20ptpnprefix-exp-im.fits - The exposure image for the observation data in sky coordinates from the field-of-view for all selected quadrants for the full energy band.

20ptpnprefix-obj-im-elow-ehigh.fits and pnprefix-obj-im-elow-ehigh-oot.fits - The image of the observation data (normal and OOT processing) in sky coordinates from the selected region for all selected quadrants for the selected band. elow and ehigh indicate the band limits.

20ptpnprefix-obj-im-det-elow-ehigh.fits and pnprefix-obj-im-det-elow-ehigh-oot.fits - The image of the observation data (normal and OOT processing) in detector coordinates from the selected region for all selected quadrants for the selected band. elow and ehigh indicate the band limits.

20ptpnprefix-mask-im-elow-ehigh.fits - The mask image for the observation data from the selected region for all selected CCDs for the selected band. elow and ehigh indicate the band limits.

20ptpnprefix-mask-im-det-elow-ehigh.fits - The mask image for the observation data from the selected region for all selected CCDs for the selected band in detector coordinates. elow and ehigh indicate the band limits.

20ptpnprefix-exp-im-elow-ehigh.fits - The exposure image for the observation data from the selected region for all selected quadrants for the selected band. elow and ehigh indicate the band limits.

20ptpnprefix-exp-im-elow-ehigh.fits - The exposure image for the observation data from the selected region for all selected quadrants for the selected band in detector coordinates. elow and ehigh indicate the band limits.

20ptpnprefix-obj-im-sp-det.fits - Image of the selected region in detector coordinates. This image is used in the task proton_scale.

Examples:

20ptpn-spectra prefix=S005 caldb=/CALDB region=regpn.txt mask=1 elow=400 ehigh=1250 quad1=1 quad2=1 quad3=1 quad4=1

A..24 PROTON

Description:

proton uses the spectral fitting results from Xspec and model soft proton detector maps to create model soft proton contamination maps for a given observation.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra and mos_back must have been successfully run for the exposure to be used. The spectra produced by these tasks must be fit to determine the spectral parameters of the soft proton contamination. Currently the spectrum must be modeled as a power law or a broken power law not folded through the instrumental effective areas. In Xspec V11 this is accomplished by including pow/b or bknpow/b in the fitted model. For Xspec V12 this requires adding an additional model and response where the response is a diagonal matrix which is included in the XMM-ESAS calibration files.

20ptThe input spectral parameters are simply the fitted values from Xspec (assuming that no additional normalization has been applied to the component).

Calling Parameters:

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptcaldb - CCF Directory containing the ESAS calibration files.

20ptspecname - File name of spectrum file used in the spectral fit to determine the residual SP contamination.

20ptccd1-ccd7 - These are flags to include or exclude individual CCDs for the MOS detectors, and ccd1-ccd4 to include or exclude the quadrants of the pn.

20ptelow - The low energy limit for the energy band in eV (e.g., elow=400).

20ptehigh - The high energy limit for the energy band in eV (e.g., ehigh=1250).

20ptspectrumcontrol - 1 for a power law model, 2 for a broken power law.

20ptspectrumcontrol=1

20ptpindex - The fitted power law index.

20ptpnorm - The fitted scale factor for the power law.

20ptspectrumcontrol=2

20ptbindl - The fitted lower power law index.

20ptbbreak - The break energy, typically fixed to the default value of 3.0.

20ptbindh - The fitted upper power law index.

20ptbnorm - The fitted scale factor for the power law.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptprefix-prot-im-det-elow-ehigh.fits - The model soft proton background image count image in detector coordinates.

Example:

20ptproton prefix=1S003 caldb=/CALDB/ specname=mos1S003-obj-grp.pi ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1 elow=400 ehigh=1250 pindex=0.75 pnorm=0.099 spectrumcontrol=1

20ptproton prefix=S003 caldb=/CALDB/ specname=pn1S003-obj-grp.pi ccd1=1 ccd2=1 ccd3=1 ccd4=1 elow=400 ehigh=1250 bindl=0.85 bindh=1.42 bnorm=0.025 spectrumcontrol=2

A..25 PROTON_SCALE

Description:

proton_scale extracts the BACKSCAL keyword and average soft proton intensity from the detector map for a specified region. These values are necessary in the spectral fitting process of multiple regions which are linked.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra must have been successfully run for the exposure to be used.

Calling Parameters:

20ptcaldb - SAS CCF directory containing ESAS calibration files.

20ptdetector - Detector number (1 for MOS1, 2 for MOS2, and 3 for the pn).

20ptmode - Set mode for single or list input.
1: do a single region
2: do multiple regions with the required input provided in a text file.
For mode=1
maskfile - File name for the mask file. This is the, e.g., mosprefix-obj-im-sp-det.fits file
produced for the region by mos-spectra.
specfile - File name for the spectral file for the region.
For mode=2
spfile - ASCII text file with the input for multiple regions. The file should contain, on separate lines,
the mask file name (maskfile) and spectrum file name (specfile) for each region. For example:

pnS005-sp-0-15.fits
pnS005-obj-os-0-15-grp.pi
pnS005-sp-15-60.fits
pnS005-obj-os-15-60-grp.pi
pnS005-sp-120-150.fits
pnS005-obj-os-120-150-grp.pi

Output:

20ptScreen output only -
mode=1: BACKSCAL keyword value converted to units of arcmin$^{-2}$ and the average soft proton flux.
mode=2: Ordered pairs of the BACKSCAL keyword value converted to units of arcmin$^{-2}$ and the relative
soft proton value normalized to that of the first region.

Example:

20ptproton_scale caldb=/CALDB mode=1 detector=1 maskfile=mos1S003-sp-full.fits specfile=mos1S003-obj-full.pi

20ptproton_scale caldb=/CALDB mode=2 detector=1 spfile=spspec-pn.txt

A..26 ROT_DET_SKY

Description:

rot_det_sky uses information from the previously created count image in sky coordinates to rotate the detector coordinate model QPB images produced by mos_back and pn_back, model SP background images produced by proton, and model SWCX background images produced by swcx into images in sky coordinates. rot-det-sky is called by the perl script rot-im-det-sky which obtains the DETX,DETY and X,Y reference coordinates.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra and mos_back must have been successfully run for the recasting of the particle background.

20ptproton must have been successfully run for the recasting of the soft proton background.

Calling Parameters:

20ptmode - Selection on particle (1) or soft proton (2) backgrounds.

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptelow - The low energy limit for the energy band in eV (e.g., 400).

20ptehigh - The high energy limit for the energy band in eV (e.g., 1250).

20ptdetx - The DETX reference pixel location.

20ptdety - The DETY reference pixel location.

20ptskyx - The X location of the reference pixel.

20ptskyy - The Y location of the reference pixel.

20ptmaskfile - The file name for an image to provide additional masking if desired. If not present then there will be no additional masking. The mask images must be the same size and projection of the other images.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptprefix-back-im-sky-elow-ehigh.fits - The model QPB count image in sky coordinates.

20ptprefix-prot-im-sky-elow-ehigh.fits - The model SP background count image in sky coordinates.

20ptprefix-swcx-im-sky-elow-ehigh.fits - The model SWCX background count image in sky coordinates.

Example:

rot_det_sky mode=1 prefix=1S003 elow=400 ehigh=1250 detx=-1406.2 dety=-1368.2 skyx=450.91 skyy=450.91

A..27 ROT-IM-DET-SKY

Description:

rot-im-det-sky controls the recasting of images from detector coordinates into sky coordinates. It is used to reproject the model QPB, model SP, and model SWCX images. It extracts the central pixel values and coordinates from a template image and uses a call to esky2det to determine the detector coordinates for that location. rot-im-det-sky the calls the FORTRAN program rot_det_sky to do the reprojection.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra and mos_back must have been successfully run for the reprojection of the QPB images.

20ptproton must have been successfully run for the reprojection of the SP background images.

20ptswcx must have been successfully run for the reprojection of the SWCX background images.

Calling Parameters:

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptmask - The file name for an image to provide additional masking if desired. If left blank then there will be no additional masking. The mask images must be the same size and projection of the other images.

20ptelow - The low energy for the band in eV (e.g., 400).

20ptehigh - The high energy for the band in eV (e.g., 1250).

20ptmode - 1 for the QPB, 2 for the SP background, 3 for the SWCX background.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptmode = 1 - prefix-back-im-sky-elow-ehigh.fits - The model particle background count image in sky coordinates.

20ptmode = 2 - prefix-prot-im-sky-elow-ehigh.fits - The model soft proton background count image in sky coordinates.

Examples:

rot-im-det-sky prefix=1S003 elow=400 ehigh=1250 mode=1

A..28 SP_PARTIAL

Description:

sp_partial uses information from the spectral fit of a limited region of the detector and from the full field-of-view to scale the fitted SP normalization of the limited region to be appropriate for the full FOV. This is useful for the case where bright diffuse emission or the effects of very bright point sources in part of the FOV may be affecting the SP spectral fit, for example many clusters of galaxies or LMC X-1.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra or pn-spectra will need to have been run twice, once for the full field of view, once for a limited source-free region. This requires a number of files to be renamed or else they will be overwritten (the spectra and soft proton template files, see the image example).

Calling Parameters:

20ptcaldb - SAS CCF directory containing the ESAS calibration files.

20ptdetector - Detector number (1 for MOS1, 2 for MOS2, and 3 for the pn).

20ptfullimage - File name for the mask file of the full FOV. This is the mosprefix-obj-im-sp-det.fits file produced for the region by mos-spectra.

20ptfullspec - File name for the spectral file for the full FOV.

20ptregionimage - File name for the mask file of the limited region. This is the mosprefix-obj-im-sp-det.fits file produced for the limited region by mos-spectra.

20ptregionspec - File name for the spectral file for the limited region.

20ptrnorm - The fitted SP normalization from the limited region.

Output:

20ptScaled value for the SP normalization.

Example:

sp_partial caldb=/CALDB detector=1 fullimage=mos1S003-sp-full.fits fullspec=mos1S003-obj-full.pi regionimage=mos1S003-sp-ann.fits regionspec=mos1S003-obj-ann.pi rnorm=0.029

A..29 SWCX

Description:

swcx uses the spectral fitting results from Xspec and model solar wind charge exchange (SWCX) detector maps (simply narrow band exposure maps created on a grid of energies) to create model SWCX contamination maps for a given observation. swcx includes the line-broadening effect of the response matrix (RMF).

Note that the SWCX lines are typically those found in the thermal spectra such as O VII and O VIII. Because of this, great care must be used in the determination of the SWCX contribution so that power isn't shifted to or from the cosmic plasma. This can best be accomplished where the object of interest does not fill the entire field of view or where there are multiple observations of the field. In the latter case the SWCX contribution can at least be reduced to the minimum level of contamination among the multiple observations by fitting their spectra simultaneously.

Requirements:

20ptThe current location should be the working directory.

20ptmos-spectra and mos_back and/or pn-spectra and pn_back must have been successfully run for the exposure to be used. The spectra produced by these tasks must be fit to determine the spectral parameters of the SWCX contamination. The spectrum should be modeled as a Gaussian of narrow or zero width (depending on whether the line is actually a complex of lines, e.g., O VII).

Calling Parameters:

20ptprefix - Detector and exposure identifier (e.g., 1S001) as discussed at the start of the Appendix.

20ptcaldb - CCF Directory containing the ESAS calibration files.

20ptccd1-ccd7 - These are flags to include or exclude individual CCDs for the MOS detectors, and ccd1-ccd4 to include or exclude the quadrants of the pn.

20ptelow - The low energy limit for the energy band in eV (e.g., elow=400).

20ptehigh - The high energy limit for the energy band in eV (e.g., ehigh=1250).

20ptlinelist - list of SWCX lines to cast, for example $E\sim0.56$ keV for O VII, $E\sim0.65$ keV for O VIII, $E\sim0.81$ keV for O VIII, $E\sim0.91$ keV for Ne IX, and $E\sim1.34$ keV for Mg XI.

20ptgnormlist - list of fitted Gaussian scale factors from Xspec in the same order as linelist.

20ptobjarf - ARF for the exposure.

20ptobjspec - Spectral file for the exposure.

20ptclobber - Allows files to be overwritten (0-no, 1-yes).

Output:

20ptprefix-swcx-im-det-elow-ehigh.fits - The model SWCX background image count image in detector coordinates.

Example:

20ptswcx prefix=1S003 caldb=/caldb/ ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1 elow=400 ehigh=1300 linelist='0.56 0.65' gnormlist='1.52199E-07 2.45281E-07' objarf=mos1S003-full.arf objspec=mos1S003-obj-full.pi


B. CALIBRATION FILES




CalDB File$^a$ Description
mos1-diag.rsp.gz Diagonal response matrix for soft proton spectral fitting
mos1-flare.fits.gz Soft proton flare images (detector maps)
mos1-fwc.fits.gz Filter wheel closed event list
mos1-fwc-anom.fits.gz Filter wheel closed anomalous event list (only for development)
mos1-qpb.fits.gz Quiescent particle background augmentation data
mos1-sp-tot.fits.gz Soft proton event image
   
mos2-diag.rsp.gz Diagonal response matrix for soft proton spectral fitting
mos2-flare.fits.gz Soft proton flare images (detector maps)
mos2-fwc.fits.gz Filter wheel closed event list
mos2-fwc-anom.fits.gz Filter wheel closed anomalous event list (only for development)
mos2-qpb.fits.gz Quiescent particle background augmentation data
mos2-sp-tot.fits.gz Soft proton event image
   
pn-diag.rsp.gz Diagonal response matrix for soft proton spectral fitting
pn-flare.fits.gz Soft proton flare images (detector maps)
pn-fwc-filt.fits.gz Filter wheel closed event list
pn-fwc-filt-oot.fits.gz Filter wheel closed out-of-time event list
pn-qpb.fits.gz Quiescent particle background augmentation data
pn-sp-tot.fits.gz Soft proton event image
   
scale-factors-s.fits.gz Soft spectral scale factor image for merging detector/filter data
scale-factors-m.fits.gz Medium spectral scale factor image for merging detector/filter data
scale-factors-h.fits.gz Hard spectral scale factor image for merging detector/filter data
   
swcx-im.fits.gz SWCX line exposure images (SWCX detector maps)

$^a$It is our intention that these files, except for the diagonal matrices used for spectral analysis, be included in the CCF. This should be accomplished by SAS V13.5 (2013 fall) or V14 (2014 spring).


C. EXAMPLES

As part of the release there are four examples. The first two use the Abell 1795 data from ObsID 0097820101 and demonstrate image processing and complicated spectral processing. They are found in the files testimage-V13.tar.gz and testspec-V13.tar.gz. Within the tar files are the scripts runit-image and runit-spec which produce most of the files within the directories. As a test of the software and setup, the scripts can be run after suitable modifications. Please note that the ROSAT spectral files and response matrices (obtained from the HEASARC X-ray background tool) are included in the example tar files along with the EPIC diagonal matrices and Xspec ``xcm'' files.

The third example (contained in testmerge-V13.tar.gz) demonstrates the mosaicking of multiple non-coaligned observations using the data from the face-on galaxy M101. The script runit-merge assumes that the individual observations have been processed in a manner similar to the runit-image script except for different band ranges. It also requires the specific directory structure described in § C.3.

The fourth and final example (contained in testmosaic-V13.tar.gz) demonstrates the initial and extra steps needed to process mosaic-mode observations of the Fermi Bubble observation. The resultant sub-pointing event files can then be processed in a manner similar to the previous scripts.

C..1 Imaging

For runit-image the primary products are the images shown in Figure 22 and spectral files used for the fits shown in Figure 15 (i.e., the object and background spectra, RMFs, and ARFs). There are also three Xspec *xcm files for use with Xspec V12 which demonstrate the fits. The first, savexspec-xmm.xcm, fits only the XMM-Newton MOS data. The second, savexspec-all.xcm, fits the XMM-Newton MOS data along with a RASS spectrum derived from the HEASARC ``X-ray Background Tool,'' which can be found at: http://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xraybg/xraybg.pl. The *xcm files will only work with Xspec V12 and higher.

#########################################################################################
###                     THIS IS THE XMM-ESAS SCRIPT RUNIT-IMAGE                       ###
#########################################################################################
#
#  SAS V13
#
# This script is designed to run at GSFC under cshell.  It assumes that SAS has been set 
# up, but sets several of the SAS parameters for the specific observation of Abell 1795.  
# The required data files are in directories which are inputs to scripts and programs 
# which use them. 
#
# All ODF data are unzipped and in the directory 
#     /path/odf
# This includes the *.SAS file created by the SAS task odfingest
#
# All processing takes place in the directory
#     /path/analysis
#
# Set a few SAS environment variables

cd /path/analysis
setenv SAS_CCF /path/analysis/ccf.cif
setenv SAS_ODF /path/odf
setenv SAS_CCFPATH /XMM/CCF/

# Run the initial programs to set up SAS for this ObsID

cifbuild withccfpath=no analysisdate=now category=XMMCCF calindexset=$SAS_CCF 
     fullpath=yes verbosity=1
odfingest odfdir=$SAS_ODF outdir=$SAS_ODF verbosity=1

# Run epchain and emchain to create calibrated photon event files.  epchain is run  
# twice to create both normal and OOT event files.

epchain withoutoftime=true verbosity=1
epchain verbosity=1
emchain verbosity=1

# pn-filter and mos-filter run the SAS task espfilt (along with a few others).  
# espfilt filters and cleans the event files of obvious soft proton events, and then 
# produces QDP plot files showing the light curves and the accepted time intervals.
# Note that while much of the SP contamination is removed there is likely to be
# some residual contamination left.

pn-filter
mos-filter

# The final screen output of mos-filter should be examined as it indicates which
# CCDs are missing or operating in an anomalous mode.  CCDs affected should be 
# excluded from further processing when needed.  In addition, the soft band images 
# should also be examined for further indications of CCDs operating in anomalous 
# states.

ds9 *soft* &

# In this case the MOS CCDs are all operating nominally and as it is an early 
# observation all CCDs are operating.  For observations later in the mission the 
# absence of MOS1 CCD#6 and even later MOS1 CCD#3 (due to a micrometeorite hits), 
# require them to be deselected.

# Now that we are good to go for further processing with screened photon event files
# we can get rid of a few intermediate files.

rm -f *.FIT

# Besides the event files for the cluster, emchain produces event files for shorter 
# calibration observations.  The cal observations are not useful and are not carried 
# along though the processing.  Continue processing only on mos1S003, mos2S004, and 
# pnS005 data sets.  The QDP plot files (output from the SAS task espfilt) should be 
# examined to get an idea of the extent of any residual contamination.  In this case 
# the asymmetry of the peaks in the count rate histograms and the strong high 
# count-rate tails imply that there is going to be residual soft proton contamination.
# If you are running Xwindows the following commands will do the plotting.
#
# qdp mos1S003-hist.qdp
# /xw

# cheese  and cheese-bands do source detection on the observation images and create 
# Swiss cheese masks which can be used later.  cheese and cheese-bands use the combined 
# source list from emldetect for the source excision so the masking for all instruments 
# and exposures is the same.  cheese-bands adds the additional ability to do the source
# detection and masking in two bands.

cheese prefixm='1S003 2S004' prefixp=S005 scale=0.5 rate=1.0 dist=40.0 clobber=0 
     elow=400 ehigh=7200

# Also inspect the cheese images for any anomalies.  This shouldn't be an issue any more 
# but in SAS V9 occasionally very large diameter regions would be excised.  The XMM-ESAS
# guide discusses this at greater length.  However, other artifacts may also occur in 
# regions of bright diffuse emission (many spurious sources).

ds9 *cheese* &

# mos-spectra and pn-spectra processes the filtered event files to produce background 
# spectra for the entire energy range and selected region and background images for 
# the selected region and selected band for the individual ccds.  The region selection 
# expression is in an input file and should be in detector coordinates.  If the input 
# file does not exist, reg.txt in this case, the default is to process the entire FOV.  
# The input energies are in eV.  Change the caldb directory string to whatever is 
# appropriate.  In this step the processing is to create images in two bands for the 
# instruments.

# First create image and QPB background files for the full FOV - mask=0

mos-spectra prefix=1S003 caldb=/caldb/ region=reg.txt mask=0 
      elow=400 ehigh=1250 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos-spectra prefix=1S003 caldb=/caldb/ region=reg.txt mask=0 
      elow=2000 ehigh=7200 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos-spectra prefix=2S004 caldb=/caldb/ region=reg.txt mask=0 
      elow=400 ehigh=1250 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos-spectra prefix=2S004 caldb=/caldb/ region=reg.txt mask=0 
      elow=2000 ehigh=7200 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn-spectra prefix=S005 caldb=/caldb/ region=reg.txt mask=0 
      elow=400 ehigh=1250 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn-spectra prefix=S005 caldb=/caldb/ region=reg.txt mask=0 
      elow=2000 ehigh=7200 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1


# mos-back and pn-back take the individual ccd or quadrant spectra and images and 
# combines them into complete spectra and images for the selected region.  The 
# resultant image is in detector coordinates.  mos-back creates a QDP plot file 
# which shows the source and model background spectra for the observation.  Any 
# discrepancies at higher energies probably indicate residual soft proton 
# contamination, unless there are really hard and bright sources in the field.  
# In the case of this observation the discrepancy at high energies is consistent 
# with soft protons as a residual contamination was already expected from the light 
# curve histogram.  The QDP files have names like: mos1S003-spec.qdp

mos_back prefix=1S003 caldb=/caldb/ diag=0 elow=400 ehigh=1250 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb/ diag=0 elow=2000 ehigh=7200 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=400 ehigh=1250 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=2000 ehigh=7200 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn_back prefix=S005 caldb=/caldb/ diag=0 elow=400 ehigh=1250 
      quad1=1 quad2=1 quad3=1 quad4=1 
pn_back prefix=S005 caldb=/caldb/ diag=0 elow=2000 ehigh=7200 
      quad1=1 quad2=1 quad3=1 quad4=1

# rot-im-det-sky uses information in a previously created count image in sky coordinates 
# to rotate the detector coordinate background images into images in sky coordinates.

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=1250 mode=1
rot-im-det-sky prefix=1S003 mask=0 elow=2000 ehigh=7200 mode=1
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=1250 mode=1
rot-im-det-sky prefix=2S004 mask=0 elow=2000 ehigh=7200 mode=1
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=1250 mode=1
rot-im-det-sky prefix=S005 mask=0 elow=2000 ehigh=7200 mode=1

# Rename a few files for spectral fitting

mv mos1S003-obj.pi mos1S003-obj-full-ps.pi
mv mos1S003.rmf mos1S003-full-ps.rmf
mv mos1S003.arf mos1S003-full-ps.arf
mv mos1S003-back.pi mos1S003-back-full-ps.pi
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-full-ps.fits
mv mos2S004-obj.pi mos2S004-obj-full-ps.pi
mv mos2S004.rmf mos2S004-full-ps.rmf
mv mos2S004.arf mos2S004-full-ps.arf
mv mos2S004-back.pi mos2S004-back-full-ps.pi
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-full-ps.fits
mv pnS005-obj-os.pi pnS005-obj-os-full-ps.pi
mv pnS005-obj.pi pnS005-obj-full-ps.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-full-ps.pi
mv pnS005.rmf pnS005-full-ps.rmf
mv pnS005.arf pnS005-full-ps.arf
mv pnS005-back.pi pnS005-back-full-ps.pi
mv pnS005-obj-im-sp-det.fits pnS005-sp-full-ps.fits

# Group the spectral data

grppha mos1S003-obj-full-ps.pi mos1S003-obj-full-ps-grp.pi 
      'chkey BACKFILE mos1S003-back-full-ps.pi & chkey RESPFILE mos1S003-full-ps.rmf 
      & chkey ANCRFILE mos1S003-full-ps.arf & group min 100 & exit'
grppha mos2S004-obj-full-ps.pi mos2S004-obj-full-ps-grp.pi 
      'chkey BACKFILE mos2S004-back-full-ps.pi & chkey RESPFILE mos2S004-full-ps.rmf 
      & chkey ANCRFILE mos2S004-full-ps.arf & group min 100 & exit'
grppha pnS005-obj-os-full-ps.pi pnS005-obj-os-full-ps-grp.pi 
      'chkey BACKFILE pnS005-back-full-ps.pi & chkey RESPFILE pnS005-full-ps.rmf 
      & chkey ANCRFILE pnS005-full-ps.arf & group min 100 & exit'

# Fit the spectra to determine the soft proton contamination parameters.  This is aided 
# by getting the RASS spectrum of the region from the HEASARC X-ray background tool 
# along with the appropriate spectral response matrix (rass.pi and pspcc.rsp in the 
# release.)
# An Xspec XCM file for the fit has been included in the example:
#
#      savexspec-full-ps.xcm
#
# xspec
#
# @savexspec-full-nps.xcm
# cpd /xw
# setpl en
# setpl rebin 10 10
# renorm none
# plot ld rat
#
# proton-scale finds the solid angle for the region to include in the spectral fitting.  
# The solid angle which is in units of square arc minutes is added as a constant in the 
# spectral model.  This scales the fitted parameters to per square arc minutes, which 
# is also the units for the ROSAT data.

proton_scale caldb=/caldb/ mode=1 detector=1 
      maskfile=mos1S003-sp-full-ps.fits specfile=mos1S003-obj-full-ps.pi
proton_scale caldb=/caldb/ mode=1 detector=2 
      maskfile=mos2S004-sp-full-ps.fits specfile=mos2S004-obj-full-ps.pi
proton_scale caldb=/caldb/ mode=1 detector=3 
      maskfile=pnS005-sp-full-ps.fits specfile=pnS005-obj-os-full-ps.pi

# proton uses the fitted soft proton parameters to create images of the soft proton 
# contamination in detector coordinates.

proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.33878 
      bindh=0.999681 bnorm=0.240662
proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.33878 
      bindh=0.999681 bnorm=0.240662
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.33878 
      bindh=0.999681 bnorm=0.215986
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.33878 
      bindh=0.999681 bnorm=0.215986
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=2.58291 bindh=6.36106E-02 
      bnorm=0.353369
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=2.58291 bindh=6.36106E-02 
      bnorm=0.353369

# rot-im-det-sky uses information in a previously created count image in sky coordinates 
# to rotate the detector coordinate background images into images in sky coordinates.

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=1S003 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=2000 ehigh=7200 mode=2

# Make quick images of the observation for a first peak - only QPB subtracted

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=400 ehighlist=1250 mask=0 prefixlist="1S003 2S004 S005"
comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=2000 ehighlist=7200 mask=0 prefixlist="1S003 2S004 S005"

# adapt adaptively smooths the images.  

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 
      withpartcontrol=yes withsoftcontrol=no withswcxcontrol=0
adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=2000 ehigh=7200 
      withpartcontrol=yes withsoftcontrol=no withswcxcontrol=0

# Rename and display the smoothed images

mv adapt-400-1250.fits adapt-400-1250-full-ps.fits
mv adapt-2000-7200.fits adapt-2000-7200-full-ps.fits

ds9 adapt-400-1250-full-ps.fits adapt-2000-7200-full-ps.fits &

# Now, redo the processing to create spectra only for the full FOV with 
# point sources removed.  Only spectra are required.
 
mos-spectra prefix=1S003 caldb=/caldb/ region=reg.txt mask=1 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos-spectra prefix=2S004 caldb=/caldb/ region=reg.txt mask=1 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn-spectra prefix=S005 caldb=/caldb/ region=reg.txt mask=1 elow=0 ehigh=0 
      pattern=4 quad1=1 quad2=1 quad3=1 quad4=1

mos_back prefix=1S003 caldb=/caldb/ diag=0 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn_back prefix=S005 caldb=/caldb/ diag=0 elow=0 ehigh=0 
      quad1=1 quad2=1 quad3=1 quad4=1 

# Rename a few files for spectral fitting

mv mos1S003-obj.pi mos1S003-obj-full-nps.pi
mv mos1S003.rmf mos1S003-full-nps.rmf
mv mos1S003.arf mos1S003-full-nps.arf
mv mos1S003-back.pi mos1S003-back-full-nps.pi
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-full-nps.fits
mv mos2S004-obj.pi mos2S004-obj-full-nps.pi
mv mos2S004.rmf mos2S004-full-nps.rmf
mv mos2S004.arf mos2S004-full-nps.arf
mv mos2S004-back.pi mos2S004-back-full-nps.pi
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-full-nps.fits
mv pnS005-obj-os.pi pnS005-obj-os-full-nps.pi
mv pnS005-obj.pi pnS005-obj-full-nps.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-full-nps.pi
mv pnS005.rmf pnS005-full-nps.rmf
mv pnS005.arf pnS005-full-nps.arf
mv pnS005-back.pi pnS005-back-full-nps.pi
mv pnS005-obj-im-sp-det.fits pnS005-sp-full-nps.fits

# Group the spectral data

grppha mos1S003-obj-full-nps.pi mos1S003-obj-full-nps-grp.pi 
      'chkey BACKFILE mos1S003-back-full-nps.pi & chkey RESPFILE mos1S003-full-nps.rmf 
      & chkey ANCRFILE mos1S003-full-nps.arf & group min 100 & exit'
grppha mos2S004-obj-full-nps.pi mos2S004-obj-full-nps-grp.pi 
      'chkey BACKFILE mos2S004-back-full-nps.pi & chkey RESPFILE mos2S004-full-nps.rmf 
      & chkey ANCRFILE mos2S004-full-nps.arf & group min 100 & exit'
grppha pnS005-obj-os-full-nps.pi pnS005-obj-os-full-nps-grp.pi 
      'chkey BACKFILE pnS005-back-full-nps.pi & chkey RESPFILE pnS005-full-nps.rmf 
      & chkey ANCRFILE pnS005-full-nps.arf & group min 100 & exit'

# Fit the spectra to determine the soft proton contamination parameters.  This is aided 
# by getting the RASS spectrum of the region from the HEASARC X-ray background tool 
# along with the appropriate spectral response matrix (rass.pi and pspcc.rsp in the 
# release.)
# An Xspec XCM file for the fit has been included in the example:
#
#      savexspec-full-nps.xcm
#
# proton-scale finds the solid angle for the region to include in the spectral fitting.  
# The solid angle which is in units of square arc minutes is included as a constant in the 
# spectral model.  This scales the fitted parameters to per square arc minutes, which 
# is also the units for the ROSAT data.

proton_scale caldb=/caldb/ mode=1 detector=1 maskfile=mos1S003-sp-full-nps.fits 
      specfile=mos1S003-obj-full-nps.pi
proton_scale caldb=/caldb/ mode=1 detector=2 maskfile=mos2S004-sp-full-nps.fits 
      specfile=mos2S004-obj-full-nps.pi
proton_scale caldb=/caldb/ mode=1 detector=3 maskfile=pnS005-sp-full-nps.fits 
      specfile=pnS005-obj-os-full-nps.pi

# xspec
# @savexspec-full-nps.xcm
# cpd /xw
# setpl en
# setpl rebin 10 10
# renorm none
# plot ld rat

# The fitted parameters are used in both sp_partial and proton.  sp_partial scales the 
# xspec normalizations from the cheesed data to the full field of view.

sp_partial caldb=/caldb/ detector=1 fullimage=mos1S003-sp-full-ps.fits 
      fullspec=mos1S003-obj-full-ps.pi regionimage=mos1S003-sp-full-nps.fits 
      regionspec=mos1S003-obj-full-nps.pi rnorm=0.226083
sp_partial caldb=/caldb/ detector=2 fullimage=mos2S004-sp-full-ps.fits 
      fullspec=mos2S004-obj-full-ps.pi regionimage=mos2S004-sp-full-nps.fits 
      regionspec=mos2S004-obj-full-nps.pi rnorm=0.204129
sp_partial caldb=/caldb/ detector=3 fullimage=pnS005-sp-full-ps.fits 
      fullspec=pnS005-obj-os-full-ps.pi regionimage=pnS005-sp-full-nps.fits 
      regionspec=pnS005-obj-os-full-nps.pi rnorm=0.403978

# proton uses the fitted soft proton parameters (broken power law indices and break 
# energy) and the scaled normalization from sp_partial to create images of the soft proton 
# contamination in detector coordinates.

proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.31034 
      bindh=0.968441 bnorm=0.2270603
proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.31034 
      bindh=0.968441 bnorm=0.2270603
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.31034 
      bindh=0.968441 bnorm=0.2049629
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.31034 
      bindh=0.968441 bnorm=0.2049629
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=2.34676 bindh=0.216806 
      bnorm=0.4059185
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=2.34676 bindh=0.216806 
      bnorm=0.4059185

# rot-im-det-sky uses information in a previously created count image in sky coordinates 
# to rotate the detector coordinate background images into images in sky coordinates.

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=1S003 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=2000 ehigh=7200 mode=2

# comb combines the MOS1, MOS2, and pn images, as well as images from multiple 
# exposures.  Since the spectra and images were created with point sources
# removed comb must be run using the cheese masking.

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=400 ehighlist=1250 mask=1 prefixlist="1S003 2S004 S005"
comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=2000 ehighlist=7200 mask=1 prefixlist="1S003 2S004 S005"

# adapt-900 adaptively smooths the images.  

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 
      withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=0
adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=2000 ehigh=7200 
      withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=0

# Rename and display the smoothed images

mv adapt-400-1250.fits adapt-400-1250-full-nps.fits
mv adapt-2000-7200.fits adapt-2000-7200-full-nps.fits

ds9 adapt-400-1250-full-nps.fits adapt-2000-7200-full-nps.fits &

# Now, redo the processing to limit the spectrum to the outer annulus.  This excludes 
# the bright cluster emission at the center of the observations and will produce a better 
# fit for the SP contamination.  In this case this will reduce slightly the fitted amount 
# of SP contamination.  Create the reg1-ann.txt, reg2-ann.txt, and reg3-ann.txt selection 
# expressions.  Note that the regions should cover the same part of the sky.  Since the 
# pn optical axis is offset from the center of the detector so on-axis sources will not
# fall in the CCD gap, the annulus is smaller than the active areas.
# reg1-ann.txt: &&((DETX,DETY) IN circle(134,-219,14200))&&!((DETX,DETY) IN circle(134,-219,10600))
# reg2-ann.txt: &&((DETX,DETY) IN circle(6,-93,14200))&&!((DETX,DETY) IN circle(6,-93,10600))
# reg3-ann.txt: &&((DETX,DETY) IN circle(59,-10,14200))&&!((DETX,DETY) IN circle(59,-10,10600))

# Run mos-spectra to do the spectral extraction and prepare for the background modeling.  
# Use band limits of 0 0 since we aren't interested in creating an image.

mos-spectra prefix="1S003" caldb=/caldb/ region=regm1.txt mask=1 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos-spectra prefix="2S004" caldb=/caldb/ region=regm2.txt mask=1 elow=0 ehigh=0 
      ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn-spectra prefix=S005 caldb=/caldb/ region=regpn.txt mask=1 elow=0 ehigh=0 
      pattern=4 quad1=1 quad2=1 quad3=1 quad4=1

# Create the background spectrum

mos_back prefix=1S003 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn_back prefix=S005 caldb=/caldb/ diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
      quad3=1 quad4=1 

# Rename the spectral files and create grouped spectra for the annulus

mv mos1S003-obj.pi mos1S003-obj-ann.pi
mv mos1S003-back.pi mos1S003-back-ann.pi
mv mos1S003.rmf mos1S003-ann.rmf
mv mos1S003.arf mos1S003-ann.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-ann.fits
mv mos2S004-obj.pi mos2S004-obj-ann.pi
mv mos2S004-back.pi mos2S004-back-ann.pi
mv mos2S004.rmf mos2S004-ann.rmf
mv mos2S004.arf mos2S004-ann.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-ann.fits
mv pnS005-obj-os.pi pnS005-obj-os-ann.pi
mv pnS005-obj.pi pnS005-obj-ann.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-ann.pi
mv pnS005.rmf pnS005-ann.rmf
mv pnS005.arf pnS005-ann.arf
mv pnS005-back.pi pnS005-back-ann.pi
mv pnS005-obj-im-sp-det.fits pnS005-sp-ann.fits

# Create the grouped spectral files

grppha mos1S003-obj-ann.pi mos1S003-obj-ann-grp.pi 
      'chkey BACKFILE mos1S003-back-ann.pi & chkey RESPFILE mos1S003-ann.rmf 
      & chkey ANCRFILE mos1S003-ann.arf & group min 100 & exit'
grppha mos2S004-obj-ann.pi mos2S004-obj-ann-grp.pi 
      'chkey BACKFILE mos2S004-back-ann.pi & chkey RESPFILE mos2S004-ann.rmf 
      & chkey ANCRFILE mos2S004-ann.arf & group min 100 & exit'
grppha pnS005-obj-os-ann.pi pnS005-obj-os-ann-grp.pi 
      'chkey BACKFILE pnS005-back-ann.pi & chkey RESPFILE pnS005-ann.rmf 
      & chkey ANCRFILE pnS005-ann.arf & group min 100 & exit'

# Find the solid angle for the annulus to include in the spectral fitting

proton_scale caldb=/caldb/ mode=1 detector=1 maskfile=mos1S003-sp-ann.fits 
      specfile=mos1S003-obj-ann.pi
proton_scale caldb=/caldb/ mode=1 detector=2 maskfile=mos2S004-sp-ann.fits 
      specfile=mos2S004-obj-ann.pi
proton_scale caldb=/caldb/ mode=1 detector=3 maskfile=pnS005-sp-ann.fits 
      specfile=pnS005-obj-os-ann.pi

# Fit the spectra to determine the soft proton contamination for the annulus
# Now scale the results for the limited region to the whole FOV
# An Xspec XCM file for the fit has been included in the example:
#
#      savexspec-ann.xcm

#xspec

#@savexspec-ann.xcm

#cpd /xw
#setpl en
#setpl rebin 10 10
#renorm none
#plot ld rat

# Re-run proton using the new fitted values for the indices, break energy and the scaled 
# value for the normalization.


sp_partial caldb=/caldb/ detector=1 fullimage=mos1S003-sp-full-ps.fits 
      fullspec=mos1S003-obj-full-ps.pi regionimage=mos1S003-sp-ann.fits 
      regionspec=mos1S003-obj-ann.pi rnorm=3.33912E-02
sp_partial caldb=/caldb/ detector=2 fullimage=mos2S004-sp-full-ps.fits 
      fullspec=mos2S004-obj-full-ps.pi regionimage=mos2S004-sp-ann.fits 
      regionspec=mos2S004-obj-ann.pi rnorm=3.20506E-02
sp_partial caldb=/caldb/ detector=3 fullimage=pnS005-sp-full-ps.fits 
      fullspec=pnS005-obj-os-full-ps.pi regionimage=pnS005-sp-ann.fits 
      regionspec=pnS005-obj-os-ann.pi rnorm=4.80088E-02

proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.16338 
      bindh=0.563611 bnorm=0.1102348
proton prefix=1S003 caldb=/caldb/ specname=mos1S003-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.16338 
      bindh=0.563611 bnorm=0.1102348
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.16338 
      bindh=0.563611 bnorm=0.1056756
proton prefix=2S004 caldb=/caldb/ specname=mos2S004-obj-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=1 ccd6=1 ccd7=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.16338 
      bindh=0.563611 bnorm=0.1056756
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=400 ehigh=1250 spectrumcontrol=2 bindl=1.85658 bindh=0.100000 
      bnorm=0.1825866
proton prefix=S005 caldb=/caldb/ specname=pnS005-obj-os-full-ps-grp.pi ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 elow=2000 ehigh=7200 spectrumcontrol=2 bindl=1.85658 bindh=0.100000 
      bnorm=0.1825866

# Rerun rot-im-det-sky

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=1S003 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=2S004 mask=0 elow=2000 ehigh=7200 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=1250 mode=2
rot-im-det-sky prefix=S005 mask=0 elow=2000 ehigh=7200 mode=2

# use comb once more to combine exposures, this time with point sources masked using 
# the cheese images.

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=400 ehighlist=1250 mask=1 prefixlist="1S003 2S004 S005"
comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=2000 ehighlist=7200 mask=1 prefixlist="1S003 2S004 S005"

# adapt-900 adaptively smooths the images.  

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=0
adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=2000 ehigh=7200 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=0

# Rename and display the smoothed images

mv adapt-400-1250.fits adapt-400-1250-ann-nps.fits
mv adapt-2000-7200.fits adapt-2000-7200-ann-nps.fits

ds9 adapt-400-1250-ann-nps.fits adapt-2000-7200-ann-nps.fits adapt-400-1250-full-nps.fits 
      adapt-2000-7200-full-nps.fits &

# If necessary (not in this observation) the task swcx can be used to model the 
# contribution of SWCX to the image to be subtracted.  swcx uses the fitted values 
# for SWCX lines fluxes to model their image contributions

swcx prefix=1S003 caldb=/caldb/ ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1 
      elow=400 ehigh=1250 linelist='0.560000 0.650000' gnormlist='4.76278E-07 4.79598E-07' 
      objrmf=mos1S003-full-nps.rmf objarf=mos1S003-full-nps.arf objspec=mos1S003-obj-full-nps.pi
swcx prefix=2S004 caldb=/caldb/ ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1 
      elow=400 ehigh=1250 linelist='0.560000 0.650000' gnormlist='4.76278E-07 4.79598E-07' 
      objrmf=mos1S003-full-nps.rmf objarf=mos2S004-full-nps.arf objspec=mos2S004-obj-full-nps.pi
swcx prefix=S005 caldb=/caldb/ ccd1=1 ccd2=1 ccd3=1 ccd4=1 elow=400 ehigh=1250 
      linelist='0.560000 0.650000' gnormlist='4.76278E-07 4.79598E-07' 
      objrmf=mos1S003-full-nps.rmf objarf=pnS005-full-nps.arf objspec=pnS005-obj-full-nps.pi

# SWCX images are also created in detector coordinates and so must be rotated
# into sky coords.

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=1250 mode=3
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=1250 mode=3
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=1250 mode=3

# use comb once more to combine exposures, this time with point sources masked using 
# the cheese images.

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=1 
      elowlist=400 ehighlist=1250 mask=1 prefixlist="1S003 2S004 S005"
comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=2000 ehighlist=7200 mask=1 prefixlist="1S003 2S004 S005"

# adapt-900 adaptively smooths the images.  

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=yes
adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=2000 ehigh=7200 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no

# Rename and display the smoothed images

mv adapt-400-1250.fits adapt-400-1250-ann-swcx-nps.fits
mv adapt-2000-7200.fits adapt-2000-7200-ann-swcx-nps.fits

ds9 adapt-400-1250-ann-nps.fits adapt-2000-7200-ann-nps.fits adapt-400-1250-ann-swcx-nps.fits 
      adapt-2000-7200-ann-swcx-nps.fits &

# use comb once more to combine exposures, this time without point sources masking.

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=400 ehighlist=1250 mask=0 prefixlist="1S003 2S004 S005"
comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=1 withswcxcontrol=0 
      elowlist=2000 ehighlist=7200 mask=0 prefixlist="1S003 2S004 S005"

# adapt-900 adaptively smooths the images.  

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=1250 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no
adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=2000 ehigh=7200 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=0

# Rename and display the smoothed images

mv adapt-400-1250.fits adapt-400-1250-ann-ps.fits
mv adapt-2000-7200.fits adapt-2000-7200-ann-ps.fits

ds9 adapt-400-1250-ann-nps.fits adapt-2000-7200-ann-nps.fits adapt-400-1250-ann-ps.fits 
      adapt-2000-7200-ann-ps.fits &

# The perl script clean removes most of the files which are in general no longer useful.

clean

# Simple binned images can also be created and displayed.

bin_image thresholdmasking=0.02 detector=0 binning=4 elow=400 ehigh=1250 withmaskcontrol=no 
      withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no
bin_image thresholdmasking=0.02 detector=0 binning=4 elow=2000 ehigh=7200 withmaskcontrol=no 
      withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no

ds9 rate-400-1250.fits sigma-400-1250.fits rate-2000-7200.fits sigma-2000-7200.fits &

C..2 Spectral Analysis

For runit-spec the primary products are all of the spectral files required or the analysis of the radial profile of the cluster producing the fits shown in Figures 25, 26, and 27 (i.e., the object and background spectra, RMFs, and ARFs). As for the spectral fitting part of the imaging example, there are also two Xspec *xcm files for use with Xspec V12 (or above) which demonstrate the fits. Again, the first, savexspec-xmm.xcm, fits only the XMM-Newton MOS data. The second, savespec-all.xcm, fits the XMM-Newton MOS data along with a RASS spectrum derived from the HEASARC ``X-ray Background Tool'' which can be found at: http://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xraybg/xraybg.pl.

The directory contains various other files as well. Included are the region descriptor files used by runit-spec for the extraction of the data from the radial annuli. Diagonal unitary matrices are provided for use with Xspec V12 for the modeling of the residual soft proton contamination. Also included are the ``cross-talk'' ARF files to enable the account for the contribution of an annulus on the sky to a different annulus on the detector. Except for the inner annuli, only the cross-talk between adjacent annuli is considered. The modification to the task arfgen which allows the creation of the cross-talk ARFs will be incorporated in the 2007 summer SAS release.

Note that with such a large number of spectra and parameters, fitting algorithms may have some trouble finding the true best fit rather than just a local minimum in the $\chi^2$ contour.

#################################################################################
###                      THIS IS THE SCRIPT RUNIT-SPEC                        ###
#################################################################################
#
#  SAS V13
#
# The script is designed to run at GSFC under cshell.  It assumes that 
# SAS has been setup, but sets several of the SAS parameters for the
# specific observation of Abell 1795.  A couple of paths need to be 
# added to point to the compiled FORTRAN programs and perl scripts.  
# The required data files are in directories which are inputs to the 
# script and program which use them.

cd /local/data/sendaria5/snowden/clusters/A1795/testspec/
setenv SAS_CCF /local/data/sendaria5/snowden/clusters/A1795/testspec/ccf.cif
setenv SAS_ODF /local/data/sendaria5/snowden/clusters/A1795/odf
setenv SAS_CCFPATH /XMM/sas/CCF/

# Run the initial programs to set up SAS for this ObsID

cifbuild withccfpath=no analysisdate=now category=XMMCCF calindexset=$SAS_CCF 
     fullpath=yes verbosity=1
odfingest odfdir=$SAS_ODF outdir=$SAS_ODF verbosity=1

# Run emchain and epchain (if needed) to create calibrated photon
# event files.  epchain is run a second time to create OOT files.
# mos-filter and pn-filter run the SAS task espfilt (along with a few others).  
# espfilt filters and cleans the event files, and then produces QDP plot files 
# showing the light curves and indicate the accepted time intervals.

epchain
epchain withoutoftime=true verbosity=1
pn-filter

emchain
mos-filter

# Check the *soft*.fits files for MOS CCDs acting up.

ds9 *soft* &

# Get rid of some useless files

rm -f *FIT

# cheese does source detection and produces source exclusion masks
# and selection expression files

cheese prefixm='1S003 2S004' prefixp=S005 scale=0.5 rate=1.0 dist=40.0 clobber=0 
     elow=400 ehigh= 10000'

ds9 *cheese*.fits &

# Create an image with the sources excluded, just to check how it looks
# See the test image case for the details of these calls

mos-spectra prefix=1S003 caldb=/caldb/ region=reg.txt mask=1 elow=400 
     ehigh=7200 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos-spectra prefix=2S004 caldb=/caldb/ region=reg.txt mask=1 elow=400 
     ehigh=7200 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn-spectra prefix=S005 caldb=/caldb/ region=reg.txt mask=1 elow=400 
     ehigh=7200 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1

# Create the particle background spectra and image

mos_back prefix=1S003 caldb=/caldb diag=0 elow=400 ehigh=7200 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb diag=0 elow=400 ehigh=7200 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=400 ehigh=7200 quad1=1 quad2=1 
      quad3=1 quad4=1 

# Mirror and rotate the particle background count image into sky coords

rot-im-det-sky prefix=1S003 mask=0 elow=400 ehigh=7200 mode=1
rot-im-det-sky prefix=2S004 mask=0 elow=400 ehigh=7200 mode=1
rot-im-det-sky prefix=S005 mask=0 elow=400 ehigh=7200 mode=1

# Combine the data from the three instruments

comb caldb=/caldb/ withpartcontrol=1 withsoftcontrol=0 withswcxcontrol=0 
      elowlist=400 ehighlist=7200 mask=1 prefixlist="1S003 2S004 S005"

# Adaptively filter and display the image

adapt smoothingcounts=50 thresholdmasking=0.02 detector=0 binning=2 elow=400 ehigh=7200 
      withmaskcontrol=no withpartcontrol=yes withsoftcontrol=no withswcxcontrol=0

ds9 adapt-400-7200.fits &

# Get rid of some intermediate files

rm -f *-obj-im.fits *obj-im-sp-det.fits *exp-im.fits *mask-im.fits *obj.pi *obj-oot.pi *rmf *arf

# emchain produces four event files for this observation however two
# of them contain no useful data.  Continue processing only on mos1S003
# and mos2S004.  mos-filter also produces a QDP file showing diagnostics
# of the cleaning process with names like: mos1S003-hist.qdp.  This plot
# should be examined to get an idea of the extent of any contamination.
# In this case the asymmetry of the peak in the count rate histogram and
# its strong high count-rate tail implies that there is going to be 
# residual soft proton contamination.
#
# mos-spectra processes the filtered event files to produce 
# background spectra for the entire energy range and selected 
# region and background images for the selected region and selected 
# band for the individual ccds.  The region selection expression is 
# in an input file and should be in detector coordinates.  If the 
# input file does not exist, reg.txt in this case, the default is 
# to process the entire FOV.  The input energies are in eV.
# Change the fwc directory string to whatever is appropriate.
# In this step the processing is to create images in two bands for
# both instruments.  

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-0-30.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-0-30.pi
mv mos1S003-back.pi mos1S003-back-0-30.pi
mv mos1S003.rmf mos1S003-0-30.rmf
mv mos1S003.arf mos1S003-0-30.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-0-30.fits

grppha mos1S003-obj-0-30.pi mos1S003-obj-0-30-grp.pi 'chkey BACKFILE 
      mos1S003-back-0-30.pi & chkey RESPFILE mos1S003-0-30.rmf & chkey ANCRFILE 
      mos1S003-0-30.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-0-30.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-0-30.pi
mv mos2S004-back.pi mos2S004-back-0-30.pi
mv mos2S004.rmf mos2S004-0-30.rmf
mv mos2S004.arf mos2S004-0-30.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-0-30.fits

grppha mos2S004-obj-0-30.pi mos2S004-obj-0-30-grp.pi 'chkey BACKFILE 
      mos2S004-back-0-30.pi & chkey RESPFILE mos2S004-0-30.rmf & chkey ANCRFILE 
      mos2S004-0-30.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-0-30.txt mask=0 elow=0 
      ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
      quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-0-30.pi
mv pnS005-obj.pi pnS005-obj-0-30.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-0-30.pi
mv pnS005-back.pi pnS005-back-0-30.pi
mv pnS005.rmf pnS005-0-30.rmf
mv pnS005.arf pnS005-0-30.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-0-30.fits

grppha pnS005-obj-os-0-30.pi pnS005-obj-os-0-30-grp.pi 'chkey BACKFILE 
      pnS005-back-0-30.pi & chkey RESPFILE pnS005-0-30.rmf & chkey ANCRFILE 
      pnS005-0-30.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-30-60.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 ccd3=1 
      ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-30-60.pi
mv mos1S003-back.pi mos1S003-back-30-60.pi
mv mos1S003.rmf mos1S003-30-60.rmf
mv mos1S003.arf mos1S003-30-60.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-30-60.fits

grppha mos1S003-obj-30-60.pi mos1S003-obj-30-60-grp.pi 'chkey BACKFILE 
      mos1S003-back-30-60.pi & chkey RESPFILE mos1S003-30-60.rmf & chkey ANCRFILE 
      mos1S003-30-60.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-30-60.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-30-60.pi
mv mos2S004-back.pi mos2S004-back-30-60.pi
mv mos2S004.rmf mos2S004-30-60.rmf
mv mos2S004.arf mos2S004-30-60.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-30-60.fits

grppha mos2S004-obj-30-60.pi mos2S004-obj-30-60-grp.pi 'chkey BACKFILE 
      mos2S004-back-30-60.pi & chkey RESPFILE mos2S004-30-60.rmf & chkey ANCRFILE 
      mos2S004-30-60.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-30-60.txt mask=0 elow=0 
      ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
      quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-30-60.pi
mv pnS005-obj.pi pnS005-obj-30-60.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-30-60.pi
mv pnS005-back.pi pnS005-back-30-60.pi
mv pnS005.rmf pnS005-30-60.rmf
mv pnS005.arf pnS005-30-60.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-30-60.fits

grppha pnS005-obj-os-30-60.pi pnS005-obj-os-30-60-grp.pi 'chkey BACKFILE 
      pnS005-back-30-60.pi & chkey RESPFILE pnS005-30-60.rmf & chkey ANCRFILE 
      pnS005-30-60.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-60-120.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-60-120.pi
mv mos1S003-back.pi mos1S003-back-60-120.pi
mv mos1S003.rmf mos1S003-60-120.rmf
mv mos1S003.arf mos1S003-60-120.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-60-120.fits

grppha mos1S003-obj-60-120.pi mos1S003-obj-60-120-grp.pi 'chkey BACKFILE 
      mos1S003-back-60-120.pi & chkey RESPFILE mos1S003-60-120.rmf & chkey ANCRFILE 
      mos1S003-60-120.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-60-120.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-60-120.pi
mv mos2S004-back.pi mos2S004-back-60-120.pi
mv mos2S004.rmf mos2S004-60-120.rmf
mv mos2S004.arf mos2S004-60-120.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-60-120.fits

grppha mos2S004-obj-60-120.pi mos2S004-obj-60-120-grp.pi 'chkey BACKFILE 
      mos2S004-back-60-120.pi & chkey RESPFILE mos2S004-60-120.rmf & chkey ANCRFILE 
      mos2S004-60-120.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-60-120.txt mask=0 elow=0 
      ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
      quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-60-120.pi
mv pnS005-obj.pi pnS005-obj-60-120.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-60-120.pi
mv pnS005-back.pi pnS005-back-60-120.pi
mv pnS005.rmf pnS005-60-120.rmf
mv pnS005.arf pnS005-60-120.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-60-120.fits

grppha pnS005-obj-os-60-120.pi pnS005-obj-os-60-120-grp.pi 'chkey BACKFILE 
     pnS005-back-60-120.pi & chkey RESPFILE pnS005-60-120.rmf & chkey ANCRFILE 
     pnS005-60-120.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-120-180.txt mask=0 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-120-180.pi
mv mos1S003-back.pi mos1S003-back-120-180.pi
mv mos1S003.rmf mos1S003-120-180.rmf
mv mos1S003.arf mos1S003-120-180.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-120-180.fits

grppha mos1S003-obj-120-180.pi mos1S003-obj-120-180-grp.pi 'chkey BACKFILE 
     mos1S003-back-120-180.pi & chkey RESPFILE mos1S003-120-180.rmf & chkey ANCRFILE 
     mos1S003-120-180.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-120-180.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-120-180.pi
mv mos2S004-back.pi mos2S004-back-120-180.pi
mv mos2S004.rmf mos2S004-120-180.rmf
mv mos2S004.arf mos2S004-120-180.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-120-180.fits

grppha mos2S004-obj-120-180.pi mos2S004-obj-120-180-grp.pi 'chkey BACKFILE 
      mos2S004-back-120-180.pi & chkey RESPFILE mos2S004-120-180.rmf & chkey ANCRFILE 
      mos2S004-120-180.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-120-180.txt mask=0 elow=0 
      ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
      quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-120-180.pi
mv pnS005-obj.pi pnS005-obj-120-180.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-120-180.pi
mv pnS005-back.pi pnS005-back-120-180.pi
mv pnS005.rmf pnS005-120-180.rmf
mv pnS005.arf pnS005-120-180.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-120-180.fits

grppha pnS005-obj-os-120-180.pi pnS005-obj-os-120-180-grp.pi 'chkey BACKFILE 
      pnS005-back-120-180.pi & chkey RESPFILE pnS005-120-180.rmf & chkey ANCRFILE 
      pnS005-120-180.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-180-240.txt mask=0 elow=0 
      ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
      ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-180-240.pi
mv mos1S003-back.pi mos1S003-back-180-240.pi
mv mos1S003.rmf mos1S003-180-240.rmf
mv mos1S003.arf mos1S003-180-240.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-180-240.fits

grppha mos1S003-obj-180-240.pi mos1S003-obj-180-240-grp.pi 'chkey BACKFILE 
     mos1S003-back-180-240.pi & chkey RESPFILE mos1S003-180-240.rmf & chkey ANCRFILE 
     mos1S003-180-240.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-180-240.txt mask=0 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-180-240.pi
mv mos2S004-back.pi mos2S004-back-180-240.pi
mv mos2S004.rmf mos2S004-180-240.rmf
mv mos2S004.arf mos2S004-180-240.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-180-240.fits

grppha mos2S004-obj-180-240.pi mos2S004-obj-180-240-grp.pi 'chkey BACKFILE 
     mos2S004-back-180-240.pi & chkey RESPFILE mos2S004-180-240.rmf & chkey ANCRFILE 
     mos2S004-180-240.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-180-240.txt mask=0 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-180-240.pi
mv pnS005-obj.pi pnS005-obj-180-240.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-180-240.pi
mv pnS005-back.pi pnS005-back-180-240.pi
mv pnS005.rmf pnS005-180-240.rmf
mv pnS005.arf pnS005-180-240.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-180-240.fits

grppha pnS005-obj-os-180-240.pi pnS005-obj-os-180-240-grp.pi 'chkey BACKFILE 
     pnS005-back-180-240.pi & chkey RESPFILE pnS005-180-240.rmf & chkey ANCRFILE 
     pnS005-180-240.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-240-300.txt mask=0 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-240-300.pi
mv mos1S003-back.pi mos1S003-back-240-300.pi
mv mos1S003.rmf mos1S003-240-300.rmf
mv mos1S003.arf mos1S003-240-300.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-240-300.fits

grppha mos1S003-obj-240-300.pi mos1S003-obj-240-300-grp.pi 'chkey BACKFILE 
     mos1S003-back-240-300.pi & chkey RESPFILE mos1S003-240-300.rmf & chkey ANCRFILE 
     mos1S003-240-300.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-240-300.txt mask=0 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-240-300.pi
mv mos2S004-back.pi mos2S004-back-240-300.pi
mv mos2S004.rmf mos2S004-240-300.rmf
mv mos2S004.arf mos2S004-240-300.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-240-300.fits

grppha mos2S004-obj-240-300.pi mos2S004-obj-240-300-grp.pi 'chkey BACKFILE 
     mos2S004-back-240-300.pi & chkey RESPFILE mos2S004-240-300.rmf & chkey 
     ANCRFILE mos2S004-240-300.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-240-300.txt mask=0 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-240-300.pi
mv pnS005-obj.pi pnS005-obj-240-300.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-240-300.pi
mv pnS005-back.pi pnS005-back-240-300.pi
mv pnS005.rmf pnS005-240-300.rmf
mv pnS005.arf pnS005-240-300.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-240-300.fits

grppha pnS005-obj-os-240-300.pi pnS005-obj-os-240-300-grp.pi 'chkey BACKFILE 
     pnS005-back-240-300.pi & chkey RESPFILE pnS005-240-300.rmf & chkey ANCRFILE 
     pnS005-240-300.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-300-420.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-300-420.pi
mv mos1S003-back.pi mos1S003-back-300-420.pi
mv mos1S003.rmf mos1S003-300-420.rmf
mv mos1S003.arf mos1S003-300-420.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-300-420.fits

grppha mos1S003-obj-300-420.pi mos1S003-obj-300-420-grp.pi 'chkey BACKFILE 
     mos1S003-back-300-420.pi & chkey RESPFILE mos1S003-300-420.rmf & chkey ANCRFILE 
     mos1S003-300-420.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-300-420.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-300-420.pi
mv mos2S004-back.pi mos2S004-back-300-420.pi
mv mos2S004.rmf mos2S004-300-420.rmf
mv mos2S004.arf mos2S004-300-420.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-300-420.fits

grppha mos2S004-obj-300-420.pi mos2S004-obj-300-420-grp.pi 'chkey BACKFILE 
     mos2S004-back-300-420.pi & chkey RESPFILE mos2S004-300-420.rmf & chkey ANCRFILE 
     mos2S004-300-420.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-300-420.txt mask=1 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-300-420.pi
mv pnS005-obj.pi pnS005-obj-300-420.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-300-420.pi
mv pnS005-back.pi pnS005-back-300-420.pi
mv pnS005.rmf pnS005-300-420.rmf
mv pnS005.arf pnS005-300-420.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-300-420.fits

grppha pnS005-obj-os-300-420.pi pnS005-obj-os-300-420-grp.pi 'chkey BACKFILE 
     pnS005-back-300-420.pi & chkey RESPFILE pnS005-300-420.rmf & chkey ANCRFILE 
     pnS005-300-420.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-420-540.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-420-540.pi
mv mos1S003-back.pi mos1S003-back-420-540.pi
mv mos1S003.rmf mos1S003-420-540.rmf
mv mos1S003.arf mos1S003-420-540.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-420-540.fits

grppha mos1S003-obj-420-540.pi mos1S003-obj-420-540-grp.pi 'chkey BACKFILE 
     mos1S003-back-420-540.pi & chkey RESPFILE mos1S003-420-540.rmf & chkey ANCRFILE 
     mos1S003-420-540.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-420-540.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-420-540.pi
mv mos2S004-back.pi mos2S004-back-420-540.pi
mv mos2S004.rmf mos2S004-420-540.rmf
mv mos2S004.arf mos2S004-420-540.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-420-540.fits

grppha mos2S004-obj-420-540.pi mos2S004-obj-420-540-grp.pi 'chkey BACKFILE 
     mos2S004-back-420-540.pi & chkey RESPFILE mos2S004-420-540.rmf & chkey ANCRFILE 
     mos2S004-420-540.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-420-540.txt mask=1 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-420-540.pi
mv pnS005-obj.pi pnS005-obj-420-540.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-420-540.pi
mv pnS005-back.pi pnS005-back-420-540.pi
mv pnS005.rmf pnS005-420-540.rmf
mv pnS005.arf pnS005-420-540.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-420-540.fits

grppha pnS005-obj-os-420-540.pi pnS005-obj-os-420-540-grp.pi 'chkey BACKFILE 
     pnS005-back-420-540.pi & chkey RESPFILE pnS005-420-540.rmf & chkey ANCRFILE 
     pnS005-420-540.arf & group min 100 & exit'

mos-spectra prefix=1S003 caldb=/caldb/ region=reg1-540-720.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-540-720.pi
mv mos1S003-back.pi mos1S003-back-540-720.pi
mv mos1S003.rmf mos1S003-540-720.rmf
mv mos1S003.arf mos1S003-540-720.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-540-720.fits

grppha mos1S003-obj-540-720.pi mos1S003-obj-540-720-grp.pi 'chkey BACKFILE 
     mos1S003-back-540-720.pi & chkey RESPFILE mos1S003-540-720.rmf & chkey ANCRFILE 
     mos1S003-540-720.arf & group min 100 & exit'

mos-spectra prefix=2S004 caldb=/caldb/ region=reg2-540-720.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-540-720.pi
mv mos2S004-back.pi mos2S004-back-540-720.pi
mv mos1S003.rmf mos1S003-0-30.rmf
mv mos2S004.rmf mos2S004-540-720.rmf
mv mos2S004.arf mos2S004-540-720.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-540-720.fits

grppha mos2S004-obj-540-720.pi mos2S004-obj-540-720-grp.pi 'chkey BACKFILE 
     mos2S004-back-540-720.pi & chkey RESPFILE mos2S004-540-720.rmf & chkey ANCRFILE 
     mos2S004-540-720.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-540-720.txt mask=1 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-540-720.pi
mv pnS005-obj.pi pnS005-obj-540-720.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-540-720.pi
mv pnS005-back.pi pnS005-back-540-720.pi
mv pnS005.rmf pnS005-540-720.rmf
mv pnS005.arf pnS005-540-720.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-540-720.fits

grppha pnS005-obj-os-540-720.pi pnS005-obj-os-540-720-grp.pi 'chkey BACKFILE 
     pnS005-back-540-720.pi & chkey RESPFILE pnS005-540-720.rmf & chkey ANCRFILE 
     pnS005-540-720.arf & group min 100 & exit'

mos-spectra prefix="1S003" caldb=/caldb/ region=reg1-720-840.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1
mos_back prefix=1S003 caldb=/caldb diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=0 ccd6=1 ccd7=1

mv mos1S003-obj.pi mos1S003-obj-720-840.pi
mv mos1S003-back.pi mos1S003-back-720-840.pi
mv mos1S003.rmf mos1S003-720-840.rmf
mv mos1S003.arf mos1S003-720-840.arf
mv mos1S003-obj-im-sp-det.fits mos1S003-sp-720-840.fits

grppha mos1S003-obj-720-840.pi mos1S003-obj-720-840-grp.pi 'chkey BACKFILE 
     mos1S003-back-720-840.pi & chkey RESPFILE mos1S003-720-840.rmf & chkey ANCRFILE 
     mos1S003-720-840.arf & group min 100 & exit'

mos-spectra prefix="2S004" caldb=/caldb/ region=reg2-720-840.txt mask=1 elow=0 
     ehigh=0 ccd1=1 ccd2=1 ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1
mos_back prefix=2S004 caldb=/caldb/ diag=0 elow=0 ehigh=0 ccd1=1 ccd2=1 
     ccd3=1 ccd4=1 ccd5=1 ccd6=1 ccd7=1

mv mos2S004-obj.pi mos2S004-obj-720-840.pi
mv mos2S004-back.pi mos2S004-back-720-840.pi
mv mos2S004.rmf mos2S004-720-840.rmf
mv mos2S004.arf mos2S004-720-840.arf
mv mos2S004-obj-im-sp-det.fits mos2S004-sp-720-840.fits

grppha mos2S004-obj-720-840.pi mos2S004-obj-720-840-grp.pi 'chkey BACKFILE 
     mos2S004-back-720-840.pi & chkey RESPFILE mos2S004-720-840.rmf & chkey ANCRFILE 
     mos2S004-720-840.arf & group min 100 & exit'

pn-spectra prefix=S005 caldb=/caldb/ region=reg3-720-840.txt mask=1 elow=0 
     ehigh=0 pattern=4 quad1=1 quad2=1 quad3=1 quad4=1
pn_back prefix=S005 caldb=/caldb diag=0 elow=0 ehigh=0 quad1=1 quad2=1 
     quad3=1 quad4=1 

mv pnS005-obj-os.pi pnS005-obj-os-720-840.pi
mv pnS005-obj.pi pnS005-obj-720-840.pi
mv pnS005-obj-oot.pi pnS005-obj-oot-720-840.pi
mv pnS005-back.pi pnS005-back-720-840.pi
mv pnS005.rmf pnS005-720-840.rmf
mv pnS005.arf pnS005-720-840.arf
mv pnS005-obj-im-sp-det.fits pnS005-sp-720-840.fits

grppha pnS005-obj-os-720-840.pi pnS005-obj-os-720-840-grp.pi 'chkey BACKFILE 
     pnS005-back-720-840.pi & chkey RESPFILE pnS005-720-840.rmf & chkey ANCRFILE 
     pnS005-720-840.arf & group min 100 & exit'

proton_scale caldb=/caldb/ mode=2 spfile=spregion.txt detector=3 
     maskfile=mos1S003-sp-full.fits specfile=mos1S003-obj-full.pi

#clean

# Create an image in detector coordinates with sufficient pixels to give a reasonable 
# distribution of the events in the source region but not too many that it will
# take a long time on geologic time scales to process.

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=50 ycolumn=DETY yimagebinsize=50 squarepixels=yes 
     imagebinning=binSize withimageset=yes

# Call arfgen to create the cross-talk ARF

arfgen arfset=mos1S003-0-30-0-30.arf spectrumset=mos1S003-obj-0-30.pi 
     crossreg_spectrumset=mos1S003-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-0-30-30-60.arf spectrumset=mos1S003-obj-30-60.pi 
     crossreg_spectrumset=mos1S003-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-0-30-60-120.arf spectrumset=mos1S003-obj-60-120.pi 
     crossreg_spectrumset=mos1S003-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-30-60-30-60.arf spectrumset=mos1S003-obj-30-60.pi 
     crossreg_spectrumset=mos1S003-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-30-60-0-30.arf spectrumset=mos1S003-obj-0-30.pi 
     crossreg_spectrumset=mos1S003-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-30-60-60-120.arf spectrumset=mos1S003-obj-60-120.pi 
     crossreg_spectrumset=mos1S003-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

##

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=50 ycolumn=DETY yimagebinsize=50 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-0-30-0-30.arf spectrumset=mos2S004-obj-0-30.pi 
     crossreg_spectrumset=mos2S004-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-0-30-30-60.arf spectrumset=mos2S004-obj-30-60.pi 
     crossreg_spectrumset=mos2S004-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-0-30-60-120.arf spectrumset=mos2S004-obj-60-120.pi 
     crossreg_spectrumset=mos2S004-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-30-60-30-60.arf spectrumset=mos2S004-obj-30-60.pi 
     crossreg_spectrumset=mos2S004-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-30-60-0-30.arf spectrumset=mos2S004-obj-0-30.pi 
     crossreg_spectrumset=mos2S004-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-30-60-60-120.arf spectrumset=mos2S004-obj-60-120.pi 
     crossreg_spectrumset=mos2S004-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

##

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=50 ycolumn=DETY yimagebinsize=50 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-0-30-0-30.arf spectrumset=pnS005-obj-0-30.pi 
     crossreg_spectrumset=pnS005-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-0-30-30-60.arf spectrumset=pnS005-obj-30-60.pi 
     crossreg_spectrumset=pnS005-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-0-30-60-120.arf spectrumset=pnS005-obj-60-120.pi 
     crossreg_spectrumset=pnS005-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-30-60-30-60.arf spectrumset=pnS005-obj-30-60.pi 
     crossreg_spectrumset=pnS005-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-30-60-0-30.arf spectrumset=pnS005-obj-0-30.pi 
     crossreg_spectrumset=pnS005-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-30-60-60-120.arf spectrumset=pnS005-obj-60-120.pi 
     crossreg_spectrumset=pnS005-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

############### 60-120
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=70 ycolumn=DETY yimagebinsize=70 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-0-30-120-180.arf spectrumset=mos1S003-obj-120-180.pi 
     crossreg_spectrumset=mos1S003-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-30-60-120-180.arf spectrumset=mos1S003-obj-120-180.pi 
     crossreg_spectrumset=mos1S003-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-60-120-60-120.arf spectrumset=mos1S003-obj-60-120.pi 
     crossreg_spectrumset=mos1S003-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-60-120-0-30.arf spectrumset=mos1S003-obj-0-30.pi 
     crossreg_spectrumset=mos1S003-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-60-120-30-60.arf spectrumset=mos1S003-obj-30-60.pi 
     crossreg_spectrumset=mos1S003-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-60-120-120-180.arf spectrumset=mos1S003-obj-120-180.pi 
     crossreg_spectrumset=mos1S003-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=70 ycolumn=DETY yimagebinsize=70 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-0-30-120-180.arf spectrumset=mos2S004-obj-120-180.pi 
     crossreg_spectrumset=mos2S004-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-30-60-120-180.arf spectrumset=mos2S004-obj-120-180.pi 
     crossreg_spectrumset=mos2S004-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-60-120-60-120.arf spectrumset=mos2S004-obj-60-120.pi 
     crossreg_spectrumset=mos2S004-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-60-120-0-30.arf spectrumset=mos2S004-obj-0-30.pi 
     crossreg_spectrumset=mos2S004-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-60-120-30-60.arf spectrumset=mos2S004-obj-30-60.pi 
     crossreg_spectrumset=mos2S004-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-60-120-120-180.arf spectrumset=mos2S004-obj-120-180.pi 
     crossreg_spectrumset=mos2S004-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=70 ycolumn=DETY yimagebinsize=70 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-0-30-120-180.arf spectrumset=pnS005-obj-120-180.pi 
     crossreg_spectrumset=pnS005-obj-0-30.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-30-60-120-180.arf spectrumset=pnS005-obj-120-180.pi 
     crossreg_spectrumset=pnS005-obj-30-60.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-60-120-60-120.arf spectrumset=pnS005-obj-60-120.pi 
     crossreg_spectrumset=pnS005-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-60-120-0-30.arf spectrumset=pnS005-obj-0-30.pi 
     crossreg_spectrumset=pnS005-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-0-30.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-60-120-30-60.arf spectrumset=pnS005-obj-30-60.pi 
     crossreg_spectrumset=pnS005-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-30-60.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-60-120-120-180.arf spectrumset=pnS005-obj-120-180.pi 
     crossreg_spectrumset=pnS005-obj-60-120.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

############### 120-180
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=100 ycolumn=DETY yimagebinsize=100 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-120-180-120-180.arf spectrumset=mos1S003-obj-120-180.pi 
     crossreg_spectrumset=mos1S003-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-120-180-60-120.arf spectrumset=mos1S003-obj-60-120.pi 
     crossreg_spectrumset=mos1S003-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-120-180-180-240.arf spectrumset=mos1S003-obj-180-240.pi 
     crossreg_spectrumset=mos1S003-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=100 ycolumn=DETY yimagebinsize=100 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-120-180-120-180.arf spectrumset=mos2S004-obj-120-180.pi 
     crossreg_spectrumset=mos2S004-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-120-180-60-120.arf spectrumset=mos2S004-obj-60-120.pi 
     crossreg_spectrumset=mos2S004-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-120-180-180-240.arf spectrumset=mos2S004-obj-180-240.pi 
     crossreg_spectrumset=mos2S004-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=100 ycolumn=DETY yimagebinsize=100 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-120-180-120-180.arf spectrumset=pnS005-obj-120-180.pi 
     crossreg_spectrumset=pnS005-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-120-180-60-120.arf spectrumset=pnS005-obj-60-120.pi 
     crossreg_spectrumset=pnS005-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-60-120.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-120-180-180-240.arf spectrumset=pnS005-obj-180-240.pi 
     crossreg_spectrumset=pnS005-obj-120-180.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

############### 180-240
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=150 ycolumn=DETY yimagebinsize=150 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-180-240-180-240.arf spectrumset=mos1S003-obj-180-240.pi 
     crossreg_spectrumset=mos1S003-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-180-240-120-180.arf spectrumset=mos1S003-obj-120-180.pi 
     crossreg_spectrumset=mos1S003-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-180-240-240-300.arf spectrumset=mos1S003-obj-240-300.pi 
     crossreg_spectrumset=mos1S003-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=150 ycolumn=DETY yimagebinsize=150 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-180-240-180-240.arf spectrumset=mos2S004-obj-180-240.pi 
     crossreg_spectrumset=mos2S004-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-180-240-120-180.arf spectrumset=mos2S004-obj-120-180.pi 
     crossreg_spectrumset=mos2S004-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-180-240-240-300.arf spectrumset=mos2S004-obj-240-300.pi 
     crossreg_spectrumset=mos2S004-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=150 ycolumn=DETY yimagebinsize=150 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-180-240-180-240.arf spectrumset=pnS005-obj-180-240.pi 
     crossreg_spectrumset=pnS005-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-180-240-120-180.arf spectrumset=pnS005-obj-120-180.pi 
     crossreg_spectrumset=pnS005-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-120-180.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-180-240-240-300.arf spectrumset=pnS005-obj-240-300.pi 
     crossreg_spectrumset=pnS005-obj-180-240.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

################## 240-300
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=200 ycolumn=DETY yimagebinsize=200 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-240-300-240-300.arf spectrumset=mos1S003-obj-240-300.pi 
     crossreg_spectrumset=mos1S003-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-240-300-180-240.arf spectrumset=mos1S003-obj-180-240.pi 
     crossreg_spectrumset=mos1S003-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-240-300-300-420.arf spectrumset=mos1S003-obj-300-420.pi 
     crossreg_spectrumset=mos1S003-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=200 ycolumn=DETY yimagebinsize=200 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-240-300-240-300.arf spectrumset=mos2S004-obj-240-300.pi 
     crossreg_spectrumset=mos2S004-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-240-300-180-240.arf spectrumset=mos2S004-obj-180-240.pi 
     crossreg_spectrumset=mos2S004-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-240-300-300-420.arf spectrumset=mos2S004-obj-300-420.pi 
     crossreg_spectrumset=mos2S004-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=200 ycolumn=DETY yimagebinsize=200 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-240-300-240-300.arf spectrumset=pnS005-obj-240-300.pi 
     crossreg_spectrumset=pnS005-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-240-300-180-240.arf spectrumset=pnS005-obj-180-240.pi 
     crossreg_spectrumset=pnS005-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-180-240.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-240-300-300-420.arf spectrumset=pnS005-obj-300-420.pi 
     crossreg_spectrumset=pnS005-obj-240-300.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

################## 300-420
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=250 ycolumn=DETY yimagebinsize=250 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-300-420-300-420.arf spectrumset=mos1S003-obj-300-420.pi 
     crossreg_spectrumset=mos1S003-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-300-420-240-300.arf spectrumset=mos1S003-obj-240-300.pi 
     crossreg_spectrumset=mos1S003-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-300-420-420-540.arf spectrumset=mos1S003-obj-420-540.pi 
     crossreg_spectrumset=mos1S003-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=250 ycolumn=DETY yimagebinsize=250 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-300-420-300-420.arf spectrumset=mos2S004-obj-300-420.pi 
     crossreg_spectrumset=mos2S004-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-300-420-240-300.arf spectrumset=mos2S004-obj-240-300.pi 
     crossreg_spectrumset=mos2S004-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-300-420-420-540.arf spectrumset=mos2S004-obj-420-540.pi 
     crossreg_spectrumset=mos2S004-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=250 ycolumn=DETY yimagebinsize=250 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-300-420-300-420.arf spectrumset=pnS005-obj-300-420.pi 
     crossreg_spectrumset=pnS005-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-300-420-240-300.arf spectrumset=pnS005-obj-240-300.pi 
     crossreg_spectrumset=pnS005-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-240-300.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-300-420-420-540.arf spectrumset=pnS005-obj-420-540.pi 
     crossreg_spectrumset=pnS005-obj-300-420.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

################## 420-540
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=300 ycolumn=DETY yimagebinsize=300 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-420-540-420-540.arf spectrumset=mos1S003-obj-420-540.pi 
     crossreg_spectrumset=mos1S003-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-420-540-300-420.arf spectrumset=mos1S003-obj-300-420.pi 
     crossreg_spectrumset=mos1S003-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-420-540-540-720.arf spectrumset=mos1S003-obj-540-720.pi 
     crossreg_spectrumset=mos1S003-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=300 ycolumn=DETY yimagebinsize=300 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-420-540-420-540.arf spectrumset=mos2S004-obj-420-540.pi 
     crossreg_spectrumset=mos2S004-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-420-540-300-420.arf spectrumset=mos2S004-obj-300-420.pi 
     crossreg_spectrumset=mos2S004-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-420-540-540-720.arf spectrumset=mos2S004-obj-540-720.pi 
     crossreg_spectrumset=mos2S004-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=300 ycolumn=DETY yimagebinsize=300 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-420-540-420-540.arf spectrumset=pnS005-obj-420-540.pi 
     crossreg_spectrumset=pnS005-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-420-540-300-420.arf spectrumset=pnS005-obj-300-420.pi 
     crossreg_spectrumset=pnS005-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-300-420.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-420-540-540-720.arf spectrumset=pnS005-obj-540-720.pi 
     crossreg_spectrumset=pnS005-obj-420-540.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

################## 540-720
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=350 ycolumn=DETY yimagebinsize=350 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-540-720-540-720.arf spectrumset=mos1S003-obj-540-720.pi 
     crossreg_spectrumset=mos1S003-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-540-720-420-540.arf spectrumset=mos1S003-obj-420-540.pi 
     crossreg_spectrumset=mos1S003-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-540-720-720-840.arf spectrumset=mos1S003-obj-720-840.pi 
     crossreg_spectrumset=mos1S003-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=350 ycolumn=DETY yimagebinsize=350 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-540-720-540-720.arf spectrumset=mos2S004-obj-540-720.pi 
     crossreg_spectrumset=mos2S004-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-540-720-420-540.arf spectrumset=mos2S004-obj-420-540.pi 
     crossreg_spectrumset=mos2S004-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-540-720-720-840.arf spectrumset=mos2S004-obj-720-840.pi 
     crossreg_spectrumset=mos2S004-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=350 ycolumn=DETY yimagebinsize=350 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-540-720-540-720.arf spectrumset=pnS005-obj-540-720.pi 
     crossreg_spectrumset=pnS005-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-540-720-420-540.arf spectrumset=pnS005-obj-420-540.pi 
     crossreg_spectrumset=pnS005-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-420-540.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-540-720-720-840.arf spectrumset=pnS005-obj-720-840.pi 
     crossreg_spectrumset=pnS005-obj-540-720.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

################## 720-840
# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=mos1S003-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=400 ycolumn=DETY yimagebinsize=400 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos1S003-720-840-720-840.arf spectrumset=mos1S003-obj-720-840.pi 
     crossreg_spectrumset=mos1S003-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

arfgen arfset=mos1S003-720-840-540-720.arf spectrumset=mos1S003-obj-540-720.pi 
     crossreg_spectrumset=mos1S003-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos1S003-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos1S003-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF


evselect table=mos2S004-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=400 ycolumn=DETY yimagebinsize=400 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=mos2S004-720-840-720-840.arf spectrumset=mos2S004-obj-720-840.pi 
     crossreg_spectrumset=mos2S004-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

arfgen arfset=mos2S004-720-840-540-720.arf spectrumset=mos2S004-obj-540-720.pi 
     crossreg_spectrumset=mos2S004-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=mos2S004-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=mos2S004-clean.fits 
     modelootcorr=no

# Create an image in detector coordinates, then call arfgen to create the cross-talk ARF

evselect table=pnS005-clean.fits:EVENTS ignorelegallimits=yes imageset=detmap.ds 
     xcolumn=DETX ximagebinsize=400 ycolumn=DETY yimagebinsize=400 squarepixels=yes 
     imagebinning=binSize withimageset=yes

arfgen arfset=pnS005-720-840-720-840.arf spectrumset=pnS005-obj-720-840.pi 
     crossreg_spectrumset=pnS005-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-720-840.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

arfgen arfset=pnS005-720-840-540-720.arf spectrumset=pnS005-obj-540-720.pi 
     crossreg_spectrumset=pnS005-obj-720-840.pi crossregionarf=yes withrmfset=yes 
     rmfset=pnS005-540-720.rmf extendedsource=yes modelee=no withbadpixcorr=yes 
     detmaptype=dataset detmaparray=detmap.ds badpixlocation=pnS005-clean.fits 
     modelootcorr=no

clean


C..3 Mosaicking

For the M101 mosaic the processing of the three observations, 0104260101, 0164560701, and 0212480201, is the same as for the image production for the Abell 1795 observation, except for more and different band definitions. The script below, runit-merge, just mosaics the various component images (event, exposure, particle background, and soft proton images) for the hard and soft bands using the program merge-comp-xmm and then combines them into smoothed exposure corrected and background subtracted images.

The merging directory must contain an ASCII file called dir.dat containing the paths including the exposure IDs to the exposures to be mosaicked. If the mosaicking takes place in the directory /path/merge and the individual observation images are located in the directories /path/ObdID/proc, then the dir.dat would simply be:

../0104260101/proc/mos1S001
../0104260101/proc/mos2S006
../0164560701/proc/mos1S001
../0164560701/proc/mos2S002
../0212480201/proc/mos1S001
../0212480201/proc/mos2S002

The tar file testmerge-V13.tar.gz contains directories with the processed data from the individual observations and a directory with the merging script and all of the mosaicked images (see Figure 32).

#################################################################################
###                      THIS IS THE SCRIPT RUNIT-MERGE                       ###
#################################################################################

# Merge the various components for the soft band without point source exclusion

merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=400 ehigh=750 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=400 ehigh=750 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=400 ehigh=750 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=400 ehigh=750 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=750 ehigh=1300 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=750 ehigh=1300 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=750 ehigh=1300 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=750 ehigh=1300 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=2000 ehigh=7200 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=2000 ehigh=7200 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=2000 ehigh=7200 maskcontrol=0 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=2000 ehigh=7200 maskcontrol=0 xdim=1100 ydim=1100

# Adaptively smooth the images

adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=400 ehighlist=750 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=750 ehighlist=1300 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist='400 750' ehighlist='750 1300' 
      binning=2 withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=2000 ehighlist=7200 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no

# Rename and display the images

mv adapt-400-750.fits adapt-400-750-ps.fits
mv adapt-750-1300.fits adapt-750-1300-ps.fits
mv adapt-400-1300.fits adapt-400-1300-ps.fits
mv adapt-2000-7200.fits adapt-2000-7200-ps.fits
ds9 adapt-400-750-ps.fits adapt-750-1300-ps.fits adapt-400-1300-ps.fits adapt-2000-7200-ps.fits &
# Merge the various components, this time with point sources excluded

merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=400 ehigh=750 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=400 ehigh=750 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=400 ehigh=750 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=400 ehigh=750 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=750 ehigh=1300 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=750 ehigh=1300 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=750 ehigh=1300 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=750 ehigh=1300 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=2000 ehigh=7200 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=2000 ehigh=7200 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=2000 ehigh=7200 maskcontrol=1 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=2000 ehigh=7200 maskcontrol=1 xdim=1100 ydim=1100

# Adaptively smooth the images

adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=400 ehighlist=750 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=750 ehighlist=1300 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist='400 750' ehighlist='750 1300' 
      binning=2 withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=2000 ehighlist=7200 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no

# Rename and display the images

mv adapt-400-750.fits adapt-400-750-nps.fits
mv adapt-750-1300.fits adapt-750-1300-nps.fits
mv adapt-400-1300.fits adapt-400-1300-nps.fits
mv adapt-2000-7200.fits adapt-2000-7200-nps.fits
ds9 adapt-400-750-nps.fits adapt-750-1300-nps.fits adapt-400-1300-nps.fits adapt-2000-7200-nps.fits &

# Make simple binned images

bin_image_merge thresholdmasking=0.02 elowlist='400 750' ehighlist='750 1300' binning=8 
      withpartcontrol=yes withsoftcontrol=yes withswcxcontrol=no withmaskcontrol=no
bin_image_merge thresholdmasking=0.02 elowlist=400 ehighlist=750 binning=8 withpartcontrol=yes 
      withsoftcontrol=yes withswcxcontrol=no withmaskcontrol=no 
bin_image_merge thresholdmasking=0.02 elowlist=750 ehighlist=1300 binning=8 withpartcontrol=yes 
      withsoftcontrol=yes withswcxcontrol=no withmaskcontrol=no 
bin_image_merge thresholdmasking=0.02 elowlist=2000 ehighlist=7200 binning=8 withpartcontrol=yes 
      withsoftcontrol=yes withswcxcontrol=no withmaskcontrol=no 

# Create a merged source list - the list of directories is in the 
# file dir-only.dat

merge_source_list dirfile=dir-only.dat maxlikelim=15

# Use the merged source list to create individual masks

cd ../0104260101/proc/
make_mask_merge prefix=1S001 inmask=mos1S001-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=2S006 inmask=mos2S006-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=S005 inmask=pnS005-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
cd ../../0164560701/proc/
make_mask_merge prefix=1S001 inmask=mos1S001-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=2S002 inmask=mos2S002-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=S003 inmask=pnS003-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
cd ../../0212480201/proc/
make_mask_merge prefix=1S001 inmask=mos1S001-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=2S002 inmask=mos2S002-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0
make_mask_merge prefix=S003 inmask=pnS003-mask-im-750-1300.fits 
      srclist=../../merge/merged-source-list.fits flimtot=0.5 flimsoft=0.0 flimhard=0.0 
      scale=0.5 seper=20 maxlikelim=15.0

cd ../../merge

# Merge the various components, this time with point sources excluded
# using the merged source list

merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=400 ehigh=750 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=400 ehigh=750 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=400 ehigh=750 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=400 ehigh=750 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=750 ehigh=1300 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=750 ehigh=1300 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=750 ehigh=1300 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=750 ehigh=1300 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=1 elow=2000 ehigh=7200 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=2 elow=2000 ehigh=7200 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=3 elow=2000 ehigh=7200 maskcontrol=3 xdim=1100 ydim=1100
merge_comp_xmm caldb=/caldb/ dirfile=dir.dat coord=2 crvaln1=210.85 crvaln2=54.35 
      pixelsize=0.03 component=4 elow=2000 ehigh=7200 maskcontrol=3 xdim=1100 ydim=1100

# Adaptively smooth the images

adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=400 ehighlist=750 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=750 ehighlist=1300 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist='400 750' ehighlist='750 1300' 
      binning=2 withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no
adapt_merge smoothingcounts=50 thresholdmasking=0.02 elowlist=2000 ehighlist=7200 binning=2 
      withpartcontrol=yes withsoftcontrol=yes withmaskcontrol=no

mv adapt-400-750.fits adapt-400-750-mnps.fits
mv adapt-750-1300.fits adapt-750-1300-mnps.fits
mv adapt-400-1300.fits adapt-400-1300-mnps.fits
mv adapt-2000-7200.fits adapt-2000-7200-mnps.fits
ds9 adapt-400-750-mnps.fits adapt-750-1300-mnps.fits adapt-400-1300-mnps.fits 
      adapt-2000-7200-mnps.fits &

C..4 Mosaic Mode Observations

The Fermi Bubble mosaic mode observation is ObsID 0672401301. The directory structure is assumed to be /path/0672401301 for the ObsID processing. The ODF data are located in /path/0672401301/odf and the subpointing data are found in directories /path/0672401301/prep_mosaic_* where the ``*'' is a three digit integer with leading zeros indicating the number of the subpointing.

The script below goes as far as separating the mosaic-mode subpointings. For further image processing follow the methods outlined in the image processing and merging (mosaicking) sections.

The tar file testmosaic.tar.gz contains directories with the processed data from the individual observations and a directory with the merging script and all of the mosaicked images (see Figure 35).

#################################################################################
###                     THIS IS THE SCRIPT RUNIT-MOSAIC                       ###
#################################################################################

# Set a few SAS environment variables

setenv DATAPATH /path/
cd $DATAPATH/0672401301/
setenv SAS_CCF $DATAPATH/0672401301/ccf.cif
setenv SAS_ODF $DATAPATH/0672401301/odf
setenv SAS_CCFPATH /software/XMM/CCF

cifbuild withccfpath=no analysisdate=now category=XMMCCF calindexset=$SAS_CCF 
      fullpath=yes verbosity=1
odfingest odfdir=$SAS_ODF outdir=$SAS_ODF verbosity=1

# mos-filter and pn-filter run the SAS tasks cifbuild, odfingest, emchain or epchain, 
# and espfilt (along with a few others).  espfilt filters and cleans the event files, 
# and then produces QDP plot files showing the light curves and indicate the accepted 
# time intervals.

epchain withoutoftime=true verbosity=1
epchain verbosity=1
pn-filter
emchain verbosity=1
mos-filter

# Get rid of unused intermediate files

rm -f *FIT

# Derive the attitude file

atthkgen atthkset=atthk.fits timestep=1

# Run emosaic_prep to separate the observation into its subpointings.
# emosaic_prep needs to be run twice, one time for the normal PN events and one
# for the PN OOT events.  The MOS data must be deleted after the first run.

# However, before running emosaic_prep the SAS environment variable needs to
# be set so it points directly at the *.SAS file created by odfingest

setenv SAS_ODF odf/2154_0672401301_SCX00000SUM.SAS

emosaic_prep mos1evtfile='mos1S001-clean.fits' mos2evtfile='mos2S002-clean.fits' 
      pnevtfile='pnS003-clean.fits' atthkfile='atthk.fits'

rm -f prep_mosaic*/mos*-clean*.ds

# Run emosaic_prep the second time

emosaic_prep mos1evtfile='mos1S001-clean.fits' mos2evtfile='mos2S002-clean.fits' 
      pnevtfile='pnS003-clean-oot.fits' atthkfile='atthk.fits'

# esprep_mosaic_time extracts the time intervals for the individual pointings
# which are used in esas-mosaic to correct all the pointing information

esprep_mosaic_time atsfile=../odf/2154_0672401301_SCX00000ATS.FIT 
      sasfile=../odf/2154_0672401301_SCX00000SUM.SAS

# Run esas-mosaic to correct the header information of the subpointings

esas-mosaic sublist=mosaic-times.txt m1prefix=1S001 m2prefix=2S002 pnprefix=S003

About this document ...

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -white -image_type png -nofootnode -numbered_footnotes -t 'XMM ESAS Cookbook' -split 3 -show_section_numbers xmm-esas.tex

The translation was initiated by Michael Arida on 2014-04-15


Footnotes

... (OOT1
OOT events occur when a pn data frame is being clocked out. This takes a small but finite amount of time during which new events can also be recorded by the detector, however, they will not be associated with the correct sky location.
... base2
Trend files contain XMM-Newton geometric (e.g., position and pointing) information, EPIC detector (e.g., operation mode and count rate) information, as well as relevant solar wind parameters. Trend data can be found at: http://heasarc.gsfc.nasa.gov/docs/xmm/xmmhp_trend.html.
... case3
The ``S'' in the 1S001 exposure identifier can be either an S or a U, for scheduled or unscheduled exposures. The distinction can be safely ignored as both good and bad data can show up in both S or U exposures.
... time4
Given the time variability of the spectral shape in the anomalous state, it will be difficult to produce a reliable background even for the anomalous states that have become quite common. However, data above 2 keV are unaffected so images and spectra of higher energy sources can be useful.
... FWC5
Filter wheel closed (FWC) calibration data are derived from observations where the filter wheel is in the closed position blocking the detection of any X-rays from outside the instrument and the penetration of any soft protons. Cosmic rays, however, still penetrate to the detectors so a clean measure of the QPB is allowed.
... coordinates6
The use of detector coordinates, DETX and DETY, is required for the selection expression. While inconvenient, it is forced by the usage of certain SAS tasks. In practice the use of detector coordinates rather than sky coordinates is not a problem because of the very good pointing stability and the lack of a programmed wobble.
... data7
Note that for the pn it may be more reasonable to simply exclude the Cu line region and higher energies for the pn from the analysis, although this will shorten the lever arm for fitting the SP component.
... available8
downloadable from http://heasarc.gsfc.nasa.gov/docs/ xmm/xmmhp_xmmesas.html
... CalClosed9
CalClosed data are collected when the filter wheel is in the position where on-board calibration sources irradiate the detector. CalCosed data are used to check for temporal gain variations, to test for gain variations over the detector, and to calibrate the charge-transfer inefficiency (CTI). They contain no sky data.



next_inactive up previous
Michael Arida 2014-04-15