XMM EPIC analysis example 1. Download the data from HEASARC. Untar the file: you should end up with ODF and PPS directories under a directory with a long number, e.g. 0111790101/ODF & 0111790101/PPS gunzip the files in /ODF Create a directory called e.g. analysis at the same level as ODF and PPS. 2. set the SAS_ODF environment variable to point to the directory containing the ODF data. e.g. setenv SAS_ODF /data4/starquake/yaqoob/xmmanal/ngc7314/0111790101/ODF 3. Make or get calibration index file: Go to directory analysis. (a) Find the calibration index file used to process your data; it will have a name *CALIND* in the PPS directory. e.g. P0111790101OBX000CALIND0000.FTZ Copy this over into /analysis and rename it e.g. pipeline_ccf.cif (b) Make a new calibration index file (ccf.cif) with the latest SAS and CCF files. Following looks for the CCF files in SAS_CCFPATH cifbuild withobservationdate=yes observationdate=2001-05-02T09:28:56 analysisdate=now OR the ODF can be use to get the observation date: cifbuild withobservationdate=no analysisdate=now (c) Compare ccf.cif with the *CALIND* file : cifdiff calindex1set=ccf.cif calindex2set=pipeline_ccf.cif If this comes up with no differences between ccf.cif and pipeline_ccf.cif then you do not need to reprocess. In any case set the SAS_CCF variable to point to your the CCF file you are going to use: setenv SAS_CCF /data4/starquake/yaqoob/xmmanal/ngc7314/0111790101/analysis/ccf.cif 4. run odfingest to set up some essential things. odfingest odfdir=$SAS_ODF outdir=$SAS_ODF 5. Run the MOS processing chain: emchain withbadpixfind=yes 3 output files are created for each MOS: *EVL* : events list (ext 1); 4 exposures, 4 bad pixel extenstions (alternating) *TSR* : extention 1: overall rate (quick look for flares) exts 2-8 : GTIs *GTI* : 1 GTI extension 6. Run the PN processing chain epchain withbadpixfind=yes keepintermediate=none This produces 5 output files; three of them the same as for MOS *OBX*TTSR*: Some attitude HK info *MSK* : Mask image *EVL* : events file; ext 1=events; ext 2 =offsets ext 3=bad pixels; ext 4 = exposure; ext 5 = ? ext 6 = STD GTI; ext 7 = calindex *TSR* : overall rate same as MOS *GTI* : 1 GTI extension Rename the events files to something sensible. e.g. n7314a_mos1_evt.fits n7314a_mos2_evt.fits n7314a_pn_evt.fits 7. Run the perl script xmmclean on the mos and pn event files. Get it from http://lheawww.gsfc.nasa.gov/~kaa/xselect/xmmclean -For PN the action is to choose PATTERN<=4, 200"IMAGE" FROM THE PULL-DOWN MENUS AT THE TOP UNDER "REGION" ** so that your region files will be saved in the right coordinate units. Make a region on an area of blank sky. Save the region file. If you want to exclude make separate circle regions around them; save the region file(s) and append onto the end of the main background region file with a `-' sign in front. Also edit the final region file to get rid of comments after a hash(#) sign: e.g. remove #background, #source strings in the file since it seems to screw things up. You should end up with a region file which looks something like: # Region file format: DS9 version 3.0 global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source image;polygon(697.5,906.5,697.5,906.5,697.5,906.5,697.5,906.5) image;polygon(699.5,905,699.5,905,699.5,905,699.5,905) image;polygon(697.5,904,773.5,895.5,757,838,684.5,812.5) image;polygon(746.44444,859.05556,746.55556,859.05556,746.55556,858.94444,746.44444,858.94444) image;-circle(720.5,887.5,7.5) Read in the region file (making sure other region files are cleared with "clear region all". >filter region Extract and plot image to make sure you have the right region. Extract and save light curve from the background region. With the background region file still in place, choose the time bin size (in this example 128s): >set binsize 128. >extr curve >save curve (enter new file name at prompt). >plot curve If light curve has large flares remove them using time selection with the cursor: >filter time cursor (consult xselect instructions for how to proceed). After this, before doing anything else, rename the "good time intervals" (GTI) file to a new name otherwise it will get over-written (it will have an original name of the form *xxx*.xsl). Read in the GTI file into xselect >filter time file Extract and save new image and lightcurve (follow above). Extract and save a background spectrum: >extr spectrum >save spectrum (answer "yes" to do you want to bin the spectrum question and enter the new file name at the prompt. You will end up with 4096 bin spectrum). 9. Extract source spectrum. Make a source region file (see instructions for making a background region file). Suppose the region file is called src.reg Clear all other region files. Read in the new region file. >filter region file src.reg If the GTI file is not already read in, read it, in making sure there are no other GTI files read in if you do not want them. >filter time file Extract, save, and plot image (see [8]) Extract, save, and plot lightcurve (see [8]) (select pi bin limits if you want to restrict the energy range). Extract and save spectrum in the same manner as the background spectrum. 10. Make rmf and arf responses. If the script xsl_xmm_epic_makersp is set up you can simply type >xsl_xmm_epic_makersp to make the rmf and arf responses. **WARNING** if the spectra are made with xselect and not SAS the effective area may be wrong by upt ~6%.