XMM-NEWTON DATA ANALYSIS WITH PERL SCRIPTS
The GOF has developed Perl scripts in an effort to simplify the EPIC and RGS data reduction process and make XMM data more accessible to astrophysicists and students who may not be very familiar with the details of working with (locally-installed) SAS. These, plus a short guide to their use, and a summary of commands, are available below. Knowledge of SAS is not required to run the scripts. However, all scripts assume that SAS has been initialized and the intial environmental variables have been set. They also assume you are working with a point source that will be extracted in a circular region. In the walk-throughs, we assume that the scripts have been placed in a convenient directory and aliased, as shown below. All the steps given here are the same as in the ABC Guide. In the EPIC example, we use the observation of the Lockman Hole (ObsID 0123700101) and for RGS, we use AB Dor (ObsID 0134520301). As always when working with SAS, be sure to call tasks from your working directory.
Scripts
A Walk-Through with EPIC
A Summary of Commands with EPIC
A Walk-Through with RGS
A Summary of Commands with RGS
Scripts
These are the available scripts with a short description of each. Clicking on each name will take you to a page with the script, where they can easily be saved by your browser.
- reprocess_epic: repipeline the data and apply standard filters.
- make_expmap_epic: make exposure maps based on default energy ranges or user-supplied ranges
- make_bkg_spectrum_epic: make a background spectrum
- make_filteredevents_epic: remove flares from event files
- make_image_epic: make images for display in ds9 or fv
- make_lc_epic: make light curves
- make_spectrum_epic: extract spectra, make RMFs and ARFs, and check for pile-up
- reprocess_rgs: repipeline the data, then make a light curve. Also, make PI vs. BETA_CORR and XDSP_CORR vs. BETA_CORR images.
- make_image_rgs: make images for display in ds9 or fv
- make_lc_rgs: make light curves
- make_filteredevents_rgs: remove flares from event files
- make_spectrum_rgs: make response files and combine spectra if requested
After grabbing them with your browser, the easiest way to use these is to place them in a convenient directory and edit your .cshrc (or .bashrc or .zcshrc) file to look for them:
> cd ~And in your .cshrc, add the appropriate aliases, e.g.:
> mkdir sas_scripts/
> mv *_epic sas_scripts/
> mv *_rgs sas_scripts/
alias make_image_epic 'perl ${HOME}/sas_scripts/make_image_epic'Remember to source your .cshrc to pick up the new aliases:
alias reprocess_rgs 'perl ${HOME}/sas_scripts/reprocess_rgs'
> source .cshrc
> cd ODF
> cd ../proc
There are two somewhat bright sources in the field. We can
make a region file with DS9, being sure to use physical coordinates,
of both the sources and the background. (If using these scripts on both
extended sources and point sources, be sure to keep them seperated,
that is, have one region file for point sources and another for extended sources.)
> more LH_src.reg
# Region file format: DS9 version 4.1
> more LH_bkg.reg
# Region file format: DS9 version 4.1
> make_image_epic
> make_lc_epic
> more bad_times.txt
To remove these time ranges, in the "proc" directory,
> make_filteredevents_epic
There will be several "DssBlockClash" warnings; these can be ignored. The
output will be placed in the working directory and follow the naming convention
"instrument_flt_evt2.fits".
Remember to update the events file list with the new files!
> make_spectrum_epic
> make_bkg_spectrum_epic
> more energy.txt
it will produce two exposure maps for each event file, over the ranges 1-2 keV and
2-3 keV. If no energy file is entered, the default range 2-4.5 keV is used.
In any case, the output is placed in the "expmap" directory and follows the
naming convention "instrument_expmap_LowEnergy-HighEnergykeV.fits". In the "proc"
directory,
> make_expmap_epic
For our example, six exposure maps will be made: m1_expmap_1-2keV.fits, m1_expmap_2-3keV.fits,
m2_expmap_1-2keV.fits, m2_expmap_2-3keV.fits, pn_expmap_1-2keV.fits, and pn_expmap_2-3keV.fits.
You can reduce XMM data and extract useful products with minimal input by
using these commands and entering the appropriate text files when prompted.
> cd ODF
> cd ODF
> cd ../proc
> make_image_rgs
> make_lc_rgs
The output will have the naming convention "instrument_ltcrv_binsize.fits".
For our example case, there are two time ranges contaminated with flares:
> more gti.txt
We will also want to combine the spectra from the same orders in Step 6, so we will
use wavelength binning.
In the "proc" directory,
> make_filteredevents_rgs
The output will be placed in the working directory and will overwrite the unfiltered files.
> make_spectrum_rgs
The output files will have for format "instrument_order_type.fits", where "type" is
the background spectrum (bgspec), the total spectrum (srspec), or the response (rmf).
At this point, further analysis can be done with XSpec or CIAO,
as shown in the ABC Guide.
You can reduce RGS data and extract useful products with minimal input by
using these commands and entering the appropriate text files when prompted.
> cd ODF
A Walk-Through with EPIC
With these data products, further analysis can be done with XSpec or CIAO,
as shown in the ABC Guide.
> gunzip *gz
> reprocess_epic
> y
> y
> ls *evt2.fits > events.txt
global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
physical
circle(26202.5,22793.5,600)
circle(20219.586,36401.5,600)
global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
physical
annulus(26202.5,22793.5,600,1400)
annulus(20219.586,36401.5,600,1400)
Enter the file listing the event files: events.txt
Should I use a region file? If so, enter the file name; otherwise, enter N: n
Enter the file listing the event files: events.txt
Should I use a region file? If so, enter the file name; otherwise, enter N: LH_src.reg
Please enter the size of the time bins. 10
7.32276e7 7.32405e7
7.32118e7 7.3212e7
7.32204e7 7.32206e7
Enter the file listing the event files: events.txt
Enter the file with the times to be removed: bad_times.txt
Enter the file listing the event files: events.txt
Enter the region file name: LH_src.reg
Is this an extended source? y/n: n
Enter the file listing the event files: events.txt
Enter the background region file name: LH_bkg.reg
Is this an extended source? y/n: n
Make rmf and arf files for the background? y/n: y
1000 2000
2000 3000
Enter the file listing the event files: events.txt
Should I use an energy file? If so, enter the file name; otherwise, enter N: energy.txt
Summary of Commands with EPIC
> reprocess_epic
> cd ../proc
> make_image_epic
> make_lightcurve_epic
> make_filteredevents_epic
> make_expmap_epic
> make_spectrum_epic
> make_bkg_spectrum_epic
A Walk-Through with RGS
> gunzip *gz
> reprocess_rgs
In the ODF directory, continuing.
You can process the data in one of these ways:
1) with the option to combine 1st order spectra from RGS1 and RGS2 later on, or
2) with the option to combine 1st and 2nd order spectra from one RGS instrument later on.
Which would you like? (1/2) 1
Ok, setting the appropriate parameter value.
Would you like to make light curves? Y/N: y
Please enter the size of the time bins, in seconds, for the light curves.
50
Would you like to make images of PI, XDSP_CORR, and BETA_CORR? Y/N: y
> ls *EVENLI* > rgs12_event.list
Enter the file listing the event files: rgs12_event.list
Enter the file listing the event files: rgs12_event.list
Please enter the size of the time bins in seconds for the light curves.
100
9.64046e7 9.64133e7 -
9.64222e7 9.64259e7 -
Enter the name of the file with the times to be kept or removed: gti.txt
What spectrum binning should I use?
1 = lambda (default; use this if you want to combine the same orders from different RGSes.)
2 = beta
> 1
Enter the file listing the event files: rgs12_event.list
Do you want to combine the same orders from the two RGSes? (y/n)
y
Summary of Commands with RGS
> reprocess_rgs
> cd ../proc
> make_image_rgs
> make_lightcurve_rgs
> make_filteredevents_rgs
> make_spectrum_rgs
If you have any questions concerning XMM-Newton
send e-mail to
xmmhelp@lists.nasa.gov