While a variety of analysis packages can be used for the following steps, the SAS was designed for the basic reduction and analysis of XMM-Newton data (extraction of spatial, spectral, and temporal data); therefore, it will be used here for demonstration purposes.
NOTE: For PN observations with very bright sources, out-of-time events can provide a serious contamination of the image. Out-of-time events occur because the read-out period for the CCDs can be up to % of the frame time. Since events that occur during the read-out period can't be distinguished from others events, they are included in the event files but have invalid locations. For observations with bright sources, this can cause bright stripes in the image along the CCD read-out direction.
At this point, it is assumed that you have downloaded the data from the HEASARC archive onto a Hera server, standard or anonymous Hera is running (see §4.2), and you have prepared the data for processing (see §6). Throughout this chapter, as in §6, we will use the Lockman Hole dataset with ObsID 0123700101, though any dataset will suffice.
If a dataset is more than a year old, it was probably processed with older versions of CCF and SAS prior to archiving, so the pipeline should be rerun to generate event files with the latest calibrations. The MOS has two pipeline tasks, emchain and emproc, while the PN has one, epproc for the PN. The two MOS tasks produce the same output, so which one to use is entirely a matter of the user's personal preference.
Verify that the working directory PROC is highlighted, then:
By default, none of these tasks keep any intermediate files they generate. Emchain
maintains the naming convention described in §5.3.3.
Emproc and epproc designate their output event files with ``Evts.ds'';
``*ImagingEvts.ds'', ``*TimingEvts.ds'', and ``*BurstEvts.ds'' denote the imaging mode, timing,
and burst mode event lists, respectively. In either case, you may want to name the new files
something easy to type. Right-clicking on a file will give you the option to rename it.
Once the new event files have been obtained, the analysis techniques described below can be used. We will refer to the new event files as mos1.fits, mos2.fits, and pn.fits.
The heraXmmselect GUI, in the ``experimental'' folder of ``XMM-SAS'', provides a very simple method for producing and displaying images, spectra, and light curves, and is the recommended method for extracting data unless large numbers of sources are being analyzed.
An event list from the MOS1 can be loaded by highlighting the event file mos1.fits in the PROC directory, then double-clicking on heraXmmselect. A Table Selection window will pop up to confirm your selection; clicking ``Go'' will start the task.
To create an image in sky coordinates with heraXmmselect,
Different binnings and other selections can be invoked by accessing the ``Image'' tab
at the top of the GUI. The default settings are reasonable, however, for a basic image.
The resultant image is written to the file image.fits, and is automatically displayed
with POW. It can also be downloaded to your local machine and viewed with
ds9; see Figure 7.2.
To create a light curve with heraXmmselect,
The resultant light curve is written to the file mos1_ltcrv.fits and is
automatically displayed in POW; see Fig. 7.3.
Whether using the GUI or the command line, the needed filtering ``expressions'' for the MOS and PN are, respectively:
If the PN data is timed, then the PATTERN parameter should be set to 4:
The first two expressions will select good events with PATTERN in the 0 to 12 range, and the last will select events with PATTERN between 0 and 4. The PATTERN value is similar the GRADE selection for ASCA data, and is related to the number and pattern of the CCD pixels triggered for a given event.The PATTERN assignments are: single pixel events: PATTERN == 0, double pixel events: PATTERN in [1:4], triple and quadruple events: PATTERN in [5:12].
The second keyword in the expressions, PI, selects the preferred pulse height of the event; for the MOS, this should be between 200 and 12000 eV. For the PN, this should be between 200 and 15000 eV. This should clean up the image significantly with most of the rest of the obvious contamination due to low pulse height events. Setting the lower PI channel limit somewhat higher (e.g., to 300 eV) will eliminate much of the rest.
Finally, the #XMMEA_EM (#XMMEA_EP for the PN) filter provides a canned screening set of FLAG values for the event. (The FLAG value provides a bit encoding of various event conditions, e.g., near hot pixels or outside of the field of view.) Setting FLAG == 0 in the selection expression provides the most conservative screening criteria and should always be used when serious spectral analysis is to be done.
It is a good idea to keep the output filtered event files and use them in your
analyses, as opposed to re-filtering the original file with every task. This will
save much time and computer memory. As an example, the pipelined Lockman Hole data
for the MOS1 is 44Mb; the quality-filtered list is 29Mb, and when the temporal
filter is applied, the final ``clean'' event list is only 7Mb!
To filter the data with heraXmmselect,
Sometimes, it is necessary to filter on time, in addition to those mentioned above. This is because of soft proton background flaring, which can have count rates of 100 counts/sec or higher.
It should be noted that the amount of flaring that needs to be removed depends in part on the object observed; a faint, extended object will be more affected than a very bright X-ray source.
There are two ways to filter on time: with an explicit reference to the
TIME or RATE parameters in the filtering expression, or by
creating a secondary Good Time Interval (GTI) file with the task tabgtigen.
Both procedures are described below. For the example data, we will filter by time,
though you can just as easily filter by rate.
To explicitly define the TIME or RATE parameters, make a light curve and display it, as demonstrated in §7.2.2 and plotted in Figure 7.3. There is a very large flare toward the end of the observation, so the syntax for the time selection is (TIME 7.32273e7). However, there is also a small flare within an otherwise good interval. A slightly more comlicated expression to remove it would be: (TIME 7.32273e7)&&!(TIME IN [7.32219e7:7.32238e7]). The syntax &&(TIME 7.32273e7) includes only events with times less than 7.32273e7, and the ``!'' symbol stands for the logical ``not'', so use &&!(TIME in [7.32219e7:7.32238e7]) to exclude events in the time interval 7.32219e7 to 7.32238e7.
If combined with the standard filtering expression (see §7.2.3), the full filtering expression would then be:
This expression can then be used to filter the original event file, as shown in §7.2.3, or only the times can be used to filter the file that has already had the standard filters applied.
To filter on time using a secondary GTI file, make the file by using the same time filtering parameters as determined above and the tabgtigen task:
Now, apply the new GTI file with heraXmmselect:
The task edetect_chain is a metatask that does nearly all the work involved with EPIC source detection. It can take as input arbitrary combinations of images from different energy bands and different EPIC instruments, with up to three instruments and 5 energy bands. However, users should be aware that that the binning and WCS keywords in all images must be identical. Edetect_chain is comprised of seven straightforward tasks that can also be run by hand. Edetect_chain requires input files to be generated and prepared using the tasks atthkgen and evselect; the task emosaic, while not necessary for source detection, does provide a nice mosaicked image for display purposes. Fortunately, these are all quick and straightforward.
In the example below, source detection is done on images in bands, 500 - 1000 eV and 4500 - 12000 eV, which correspond to bands 2 and 5 of the 3XMM Catalogue, for all three detectors. The source count rates are converted into fluxes through the energy converstion factors (ECFs) for each detector and energy band. The ECFs depend on the pattern selection and filter used during the observation and are given in units of cts cm/erg. Interested users can find all of the bands listed in Table 1 of the Catalogue. The ECFs are in Table 8 of the Catalogue.)
The example uses the filtered event files from all three cameras, which can be
produced in §7.2.4.
First, make the attitude file:
Next, make the band 2 and band 5 images with evselect. We'll start with the band 2 image in the MOS1.
For band 5, just change the filtering expression to (FLAG == 0)&&(PI in [4500:12000]). We will refer to the output as mos1-b5fits.
The procedure is similar for the MOS2 and PN. Note that, because we are using these
images for the specific purpose of source detection, the image binning that we would
normally use for MOS (22, corresponding to 1.1 arcsec) must be adjusted to match that
of PN (82, corresponding to 4.1 arcsec). We will assume the output images are named
mos1-b2.fits, mos2-b2.fits, pn-b2.fits, mos1-b5.fits, mos2-b5.fits, and
Now we can run edetect_chain:
Throughout the following, please keep in mind that some parameters are instrument-dependent. The parameter specchannelmax should be set to 11999 for the MOS, or 20479 for the PN. Also, for the PN, the most stringent filters, (FLAG==0)&&(PATTERN<=4), must be included in the expression to get a high-quality spectrum.
For the MOS, the standard filters should be appropriate for many cases, though there are some instances where tightening the selection requirements might be needed. For example, if obtaining the best-possible spectral resolution is critical to your work, and the corresponding loss of counts is not important, only the single pixel events should be selected (PATTERN==0). If your observation is of a bright source, you again might want to select only the single pixel events to mitigate pile up (see §7.3.3 and §7.3.4 for a more detailed discussion).
First, make an image of the filtered file, mos1_filt_time.fits, as described in §7.2.1). Download it and display it with ds9, then click on an object whose spectrum you wish to extract. Adjust the extraction region until you are satisfied with it. For this example, we will choose the source at (26165.75, 22816.25) and set the extraction radius to 400.
To extract the source spectrum,
A plot of the counts per channel will be displayed automatically in fv. (The flux per energy cannot be calculated until the response matrix and ancillary files are made, see §7.3.5.)
When extracting the background spectrum, follow the same procedures, but change the extraction area. For example, make an annulus around the source; this can be done using two circles, each defining the inner and outer edges of the annulus, then change the filtering expression (and output file name) as necessary. For our example, we will set the filtering expression to ((X,Y) in CIRCLE(26165.75,22816.2,1200))&&!((X,Y) in CIRCLE(26165.75,22816.2,400)) && (FLAG==0). The event file output will be mos1_filt_time_bkg.fits and the spectrum file will be mos1_bkg_pi.fits
The source and background region areas can now be found. This is done with the task
backscale, which takes into account any bad pixels or chip gaps, and writes
the result into the BACKSCAL keyword of the spectrum table.
To find the source extraction areas,
The procedure is the same for the background extraction area.
Depending on how bright the source is and what modes the EPIC detectors are in, event pile up may be a problem. Pile up occurs when a source is so bright that incoming X-rays strike two neighboring pixels or the same pixel in the CCD more than once in a read-out cycle. In such cases the energies of the two events are in effect added together to form one event. If this happens sufficiently often, 1) the spectrum will appear to be harder than it actually is, and 2) the count rate will be underestimated, since multiple events will be undercounted. To check whether pile up may be a problem, use the SAS task epatplot. (Heavily piled sources will be immediately obvious, as they will have a ``hole'' in the center.) Note that this procedure requires as input the event files created when the spectrum was made.
The output of epatplot is a postscript file, which may be viewed with viewers such as gv, containing two graphs describing the distribution of counts as a function of PI channel; see Figure 7.4.
A few words about interpretting the plots are in order. The top is the distribution of counts versus PI channel for each pattern class (single, double, triple, quadruple), and the bottom is the expected pattern distribution (smooth lines) plotted over the observed distribution (histogram). If the lower plot shows the model distributions for single and double events diverging significantly from the observed distributions, then the source is piled up.
The source used in our Lockman Hole example is too faint to provide reasonable
statistics for epatplot and is far from being affected by pile up.
In contrast, plots from two different observations are shown in
Figure 7.4 and 7.5. In Figure 7.4,
the source is bright enough to provide statistics (and a good fit) at energies above
about 1.5 keV. Figure 7.5 shows a plot of a very bright source
which is strongly affected by pileup. Note the severe divergence
between the model and the observed pattern distribution.
To check for pile up,
The postscript file can be copied to the user's local machine and viewed there.
There are a few ways to deal with pile up. First, using the region selection and event file filtering procedures demonstrated in earlier sections, you can excise the inner-most regions of a source (as they are the most heavily piled up), re-extract the spectrum, and continue your analysis on the excised event file. For this procedure, it is recommended that you take an iterative approach: remove an inner region, extract a spectrum, check with epatplot, and repeat, each time removing a slightly larger region, until the model and observed distribution functions agree.
You can also use the event file filtering procedures to include only single pixel events (PATTERN==0), as these events are less sensitive to pile up than other patterns.
In order to do spectral analysis, it is necessary to find the instrument's
repsonse as a function of energy and PI channel. This is done by reformating
the detector response and energy bounds information and correcting for
instrumental effects, and writing the result to the Redistribution Matrix
File (RMF). The following assumes that an appropriate source spectrum, named
mos1_source_pi.fits, has been extracted as in §7.3.1.
To make the RMF,
Now use the RMF, spectrum, and event file to make the ancillary file.
To make the ARF,
At this point, the spectrum is ready to be analyzed, so we can prepare the spectrum for fitting.
With the source and background spectra now extracted and the RMF and ARF created, we will do some simple spectral fitting. SAS does not include fitting software, so HEASoft packages will be used, and all fitting tasks will be called from the Command Window.
Nearly all spectra will need to be binned for statistical purposes. The procedure grppha, located in the HEASARC folder in the Available Tools window, provides an excellent mechanism to do just that. While some users may prefer the Hera GUI, it is often easier and more useful to simply enter the commands in the Command Window, especially as only one command may be entered at a time using the GUI interface. (With the GUI, the commands are entered in the two ``GRPPHA'' text boxes, and the last command entered must be exit to avoid a hung session.) In light of this, only instructions for the Command Window are shown here.
The following commands not only group the source spectrum for Xspec but also associate the appropriate background and response files for the source.
In the Command Window, type
and edit the parameters and file names as appropriate:
Please enter PHA filename mos1_source_pi.fits ! input spectrum file name Please enter output filename mos1_grp.fits ! output grouped spectrum GRPPHA chkey BACKFILE mos1_bkg_pi.fits ! include the background spectrum GRPPHA chkey RESPFILE mos1_rmf.fits ! include the RMF GRPPHA chkey ANCRFILE mos1_arf.fits ! include the ARF GRPPHA group min 25 ! group the data by 25 counts/bin GRPPHA exit
Upon exiting, the output file mos1_grp.fits will appear in your working directory. Next, use Xspec to fit the spectrum by typing:
A POW window will pop up and display the spectrum later on. Edit the parameters and file names as appropriate:
XSPEC> data mos1_grp.fits ! input data XSPEC> ignore 0.0-0.2,6.6-** ! ignore unusable energy ranges, in keV ! set a range appropriate for the data XSPEC> model wabs(pow+pow) ! set spectral model to two absorbed power laws 1:wabs:nH> 0.01 ! set model absorption column density to 1.e20 2:powerlaw:PhoIndex> 2.0 ! set the first model power law index to -2.0 3:powerlaw:norm> ! use the default model normalization 4:powerlaw:PhoIndex> 1.0 ! set the second model power law index to -1.0 5:powerlaw:norm> ! use the default model normalization renorm ! renormalize the model spectrum XSPEC> fit ! fit the model to the data XSPEC> setplot energy ! plot energy along the X axis XSPEC> plot ldata ratio ! plot two panels with the log of the data and ! the data/model ratio values along the Y axes XSPEC> exit ! exit Xspec
Figure 7.6 shows the fit to the spectrum.
This section will demonstrate some basic timing analysis of EPIC image-mode data using the Xronos analysis package. For this exercise, the central source from the observation of G21.5-09 (Obs ID 0122700101) is used. These examples assume that the source's lightcurve has been made as in § 7.2.2, but with timebinsize set to 1 and makeratecolumn set to no; the name of this file assumed to be source_ltcrv.fits.
For the aficionado, the task barycen can be used for the barycentric correction of the source event arrival times.
The Xronos tools can be access through the Hera GUI by clicking on XRONOS
in the Available Tools panel.
To make a binned lightcurve with the Xronos GUI:
The output can be viewed with fv by right-clicking on the filename and selecting the ``Edit/Display File'' option. Output is shown in Figure 7.7.
To make a binned lightcurve with Xronos in the Command Window:
The output can be viewed with fv by right-clicking on the filename and selecting the
``Edit/Display File'' option. Output is shown in Figure 7.7.
To calculate power spectrum density with the Xronos GUI:
The output can be viewed with fv by right-clicking on the filename and selecting the ``Edit/Display File'' option. Output is shown in Figure 7.8.
To calculate power spectrum density with Xronos in the Command Window, type:
The output can be viewed with fv by right-clicking on the filename and selecting the
``Edit/Display File'' option. Output is shown in Figure 7.8.
To search for periodicities in the time series with the Xronos GUI:
To search for periodicities in the time series with Xronos in the Command Window, type:
To calculate the autocorrelation for a time series with the Xronos GUI:
To calculate the autocorrelation for a time series with Xronos in the Command Window, type:
To calculate statistical quantities for a time series with the Xronos GUI:
The statistics will be printed in the Command Window.
To calculate statistical quantities for a time series with Xronos in the Command Window, type:
write the output to an ASCII file fname. (Leave off the fname to write the results to the screen.)