Extract a Spectrum from the ACIS Readout Streak
![[CXC Logo]](../../imgs/cxc-logo.gif)
CIAO 4.2 Science Threads
Overview
Last Update: 15 Jun 2010 - The background spectrum exposure time also needs to be scaled.
Synopsis:
While ACIS reads out a frame, it is still taking data. Photons detected during the readout are clocked out in the wrong row and so have incorrect CHIPY values. For a bright source, you get a streak along the entire column of the source. These streak photons can be used for spectral analysis by adjusting the exposure time in the final spectrum.
An on-axis Response Matrix File (RMF) and Ancillary Response File (ARF) are also created for use in the analysis. The responses are made for the on-axis location because that is where the events hit the detector before being read out at an incorrect position.
Purpose:
To generate source and background PI (PHA) spectra from the streak events of an ACIS source and build the proper RMFs and ARFs.
Read this thread if:
you are working with any ACIS imaging observation which exhibits a readout streak.
Contents
- Get Started
- Downloading acis_fef_lookup
- Define the Source and Background Regions
- Extract Spectrum of Object
- Locate Centroids (dmstat)
- Calculate the On-axis RMF
- Calculate the On-axis ARF
- Correct the Streak Exposure Time
- Update File Headers (dmhedit)
- Fitting
- Parameter files:
- History
- Images
Get Started
Sample ObsID used: 3662 (ACIS-S, HER X-1)
File types needed: evt2; asol1; pbk0
Please ensure that you have set up ardlib to use the bad pixel file for your observation before following this thread.
Using Consistent Calibration: mkrmf vs mkacisrmf
The tool mkacisrmf is used to create RMFs for:
- all -120 ACIS data taken in (V)FAINT mode that has the time-dependent gain adjustment and CTI correction applied
- -120 ACIS GRADED mode data on the back-illuminated chips (ACIS-S1 and S3) only
- -110 ACIS data taken on the back-illuminated chips (ACIS-S1 and S3) only
All new analyses with these types of data should be done with mkacisrmf instead of mkrmf. This thread gives the syntax for both tools in the Calculate the RMFs section; it is up to the user to chose the appropriate method for the analysis.
It is important that the calibration applied to the event file is consistent with the RMF tool chosen, as explained in the "Using Consistent Calibration" section of the why topic. If necessary, reprocess your data with the correct gain file before beginning this thread.
Downloading acis_fef_lookup
This thread uses the acis_fef_lookup script, which is part of the CIAO Scripts distribution. The CIAO scripts package should be the following version or newer:
unix% cat $ASCDS_CONTRIB/VERSION.CIAO_scripts 14 Dec 2009
Please check that you have at least this version of the scripts package installed before continuing. If you do not have the scripts installed or need to update to a newer version, refer to the Scripts page.
Define the Source and Background Regions
We need to define several regions: one for the readout streak and a streak-free background region. Additionally, an on-axis source region is defined around the object.
unix% ds9 3662_evt2.fits &
The streak region is defined with a rectangle (see this FAQ on how to rotate shapes in ds9); the acis_streak_map tool is another method that may be used to create the streak region file. The background region is a wider rectangle which excludes the source region. The two regions are shown in separate frames in Figure 1. The on-axis source region is shown in red in both frames
![[Thumbnail image: The streak region around the jet is a rotated rectangle; the background region is a larger rectangle which excludes the streak region. The on-axis streak region is shown in both frames]](reg.thumb300.png)
[Version: full-size]
![[Print media version: The streak region around the jet is a rotated rectangle; the background region is a larger rectangle which excludes the streak region. The on-axis streak region is shown in both frames]](reg.png)
Figure 1: Extraction regions on the event file
The streak region is shown in the left frame and the background region is in the right frame. The red line through the center of the background region indicates the excluded portion of the region. The on-axis source region is shown in red in both frames
To save the regions, follow these steps:
- Region → Save Regions... → Save As "streak.reg" (streak), "streak_bg.reg" (background), and "onaxis.reg" (on-axis source).
- After choosing "OK" in the region filename dialog, a format dialog is opened. Set the format to "CIAO" and the coordinate system to "Physical".
The resulting region files look like:
unix% cat streak.reg # Region file format: CIAO version 1.0 rotbox(3973.3876,3656.4142,13.065366,699.50852,332.558) unix% cat streak_bg.reg # Region file format: CIAO version 1.0 rotbox(3971.7453,3657.4308,122.95122,699.99999,332.558) -rotbox(3973.3876,3656.4142,13.065366,699.50852,332.558) unix% cat onaxis.reg # Region file format: CIAO version 1.0 circle(4173.999,4043.9959,25.999999)
Extract Spectrum of Object
The spectra are extracted in pulse invariant (PI) space to create a histogram of number of counts vs. PI channel:
unix% punlearn dmextract unix% pset dmextract infile="3662_evt2.fits[sky=region(streak.reg)][bin pi]" unix% pset dmextract outfile=herx1.pi unix% dmextract Input event file (3662_evt2.fits[sky=region(streak.reg)][bin pi]): Enter output file name (herx1.pi):
And for the background spectrum:
unix% pset dmextract infile="3662_evt2.fits[sky=region(streak_bg.reg)][bin pi]" unix% pset dmextract outfile=herx1_bg.pi unix% dmextract Input event file (3662_evt2.fits[sky=region(streak_bg.reg)][bin pi]): Enter output file name (herx1_bg.pi):
You can check the parameter file that was used with plist dmextract.
Locate Centroids (dmstat)
The responses are made for the on-axis location because that is where the events hit the detector before being read out at an incorrect position.
Since the calibration varies across the chips, we need to locate the centroid (in chip coordinates) of the on-axis source region. This information will be used to create the ARF and to select the FEF (FITS Embedded Function) to use in calculating the RMF with mkrmf.
unix% dmstat "3662_evt2.fits[sky=region(onaxis.reg)][cols chipx,chipy,ccd_id,x,y]" chip(chipx, chipy)[pixel] min: ( 80 827 ) @: ( 19103 16594 ) max: ( 164 911 ) @: ( 103349 14719 ) mean: ( 121.6962529 868.3099628 ) sigma: ( 15.342811518 15.53880314 ) sum: ( 29603222 211220740 ) good: ( 243255 243255 ) null: ( 0 0 ) ccd_id min: 7 @: 1 max: 7 @: 1 mean: 7 sigma: 0 sum: 1702785 good: 243255 null: 0 sky(x, y)[pixel] min: ( 4148.0029297 4018.0319824 ) @: ( 176095 185976 ) max: ( 4199.9956055 4069.9790039 ) @: ( 182148 152100 ) mean: ( 4173.873478 4043.4555486 ) sigma: ( 10.076932348 10.178223086 ) sum: ( 1015315592.9 983590779.46 ) good: ( 243255 243255 ) null: ( 0 0 )
The centroid of the distribution is at (chipx,chipy)=(121.70,868.31). The source position in sky coordinates is (x,y)=(4173.87,4043.46) and is on ccd_id=7 (ACIS-S3).
You can check the parameter file that was used with plist dmstat.
Calculate the On-axis RMF
The syntax for both mkacisrmf and mkrmf are given in this section. Users must choose the appropriate tool for the data and calibration.
The observation used in this thread (ObsID 3662) was taken at the -120 C focal plane temperature and has the TGAIN and CTI calibrations applied. Therefore, it is possible to use mkacisrmf to create the RMF file.
Using mkacisrmf (mkacisrmf)
The Creating ACIS RMFs with mkacisrmf thread has details on using the mkacisrmf tool. First determine which gain file was used in the data processing:
unix% dmkeypar 3662_evt2.fits gainfile echo+ acisD2000-01-29gain_ctiN0005.fits
This event file has been reprocessed with the version 5 gain file. For this gain, use the acisD2000-01-29p2_respN0005.fits file as the infile parameter. The ccd_id value and (chipx,chipy) position from dmstat are also input:
unix% punlearn mkacisrmf unix% pset mkacisrmf infile=$CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0005.fits unix% pset mkacisrmf outfile=herx1_mkacisrmf.rmf unix% pset mkacisrmf energy=0.1:11.0:0.01 unix% pset mkacisrmf channel=1:1024:1 unix% pset mkacisrmf chantype=PI unix% pset mkacisrmf wmap=none unix% pset mkacisrmf ccd_id=7 chipx=121.70 chipy=868.31 unix% pset mkacisrmf gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0005.fits unix% mkacisrmf scatter/rsp matrix file (/soft/ciao/CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0005.fits): RMF output file (herx1_mkacisrmf.rmf): WMAP file (none): energy grid in keV (lo:hi:bin) (0.1:11.0:0.01): channel grids in pixel (min:max:bin) (1:1024:1): channel type (PI|PHA) (PI): filter CCD-ID (0:9) (7): filter chipx in pixel (121): filter chipy in pixel (868): gain file (/soft/ciao/CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0005.fits): INFO: Effective user energy (keV) grids will be re-arranged in 0.25000 - 11.00000 Single region, #2172 , processed.
The ACIS detector is calibrated over the range 0.224004 - 12 keV. The warning indicates that mkacisrmf has adjusted the energy grid to fall within the calibrated range.
You can check the parameter file that was used with plist mkacisrmf.
If you use mkacisrmf to create the RMFs, you can now continue to the Calculate the ARFs step.
Using mkrmf (acis_fef_lookup, mkrmf)
First acis_fef_lookup is needed to determine the correct FEF. The ccd_id value and (chipx,chipy) position from dmstat are input:
unix% punlearn acis_fef_lookup unix% acis_fef_lookup 3662_evt2.fits 7 121.70 868.31 /soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2][ccd_id=7,chipx=97:128,chipy=865:896]
You can check the parameter file that was used with plist acis_fef_lookup.
Now that we have the FEFs, we can compute the RMF with mkrmf. The energy range (keV) for axis1 should cover the detector response range, which is 0.224004 - 12 keV for ACIS. The default for extraction in PI space is axis2=1:1024:1.
unix% punlearn mkrmf unix% pset mkrmf infile="/soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2][ccd_id=7,chipx=97:128,chipy=865:896]" unix% pset mkrmf outfile=herx1.rmf unix% pset mkrmf axis1="energy=0.1:11.0:0.01" unix% pset mkrmf axis2="pi=1:1024:1" unix% mkrmf name of FEF input file (/soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2][ccd_id=7,chipx=97:128,chipy=865:896]): name of RMF output file (herx1.rmf): axis-1(name=lo:hi:btype) (energy=0.1:11.0:0.01): axis-2(name=lo:hi:btype) (pi=1:1024:1):
You can check the parameter file that was used with plist mkrmf.
Calculate the On-axis ARF
1. Compute the Aspect Histogram (asphist)
The aspect histogram, a binned representation of aspect motion during the observation, is created. The aspect solution files are supplied as a stack. In this example, there is only one asol1.fits file, but many observations will have multiple files to include:
unix% cat pcad_asol1.lis pcadf141954141N002_asol1.fits unix% punlearn asphist unix% pset asphist infile="@pcad_asol1.lis" unix% pset asphist outfile=herx1.asphist unix% pset asphist evtfile="3662_evt2.fits[ccd_id=7]" unix% asphist Aspect Solution List Files (@pcad_asol1.lis): Aspect Histogram Output File (herx1.asphist): Event List Files (3662_evt2.fits[ccd_id=7]):
You can check the parameter file that was used with plist asphist.
2. Compute the ARF (mkarf)
In addition to the aspect histogram file, the on-axis source position calculated by dmstat is input to mkarf. The RMF file is used to define the energy grid (engrid) to ensure that the ARF is made on the same grid.
To obtain an accurate ARF at the very edge of a CCD, subarray or window, it is necessary to include the mask file (msk1.fits).
unix% punlearn mkarf unix% pset mkarf asphistfile="herx1.asphist[ASPHIST]" unix% pset mkarf outfile=herx1.arf unix% pset mkarf obsfile="3662_evt2.fits[EVENTS]" unix% pset mkarf maskfile=acisf03662_000N002_msk1.fits unix% pset mkarf pbkfile=acisf141955042N002_pbk0.fits unix% pset mkarf detsubsys=ACIS-S3 unix% pset mkarf engrid="grid(herx1_mkacisrmf.rmf[cols ENERG_LO,ENERG_HI])" unix% pset mkarf sourcepixelx=4173.87 sourcepixely=4043.46 unix% mkarf Aspect Histogram File (herx1.asphist[ASPHIST]): Output File Name (herx1.arf): Source X Pixel (4173.87): Source Y Pixel (4043.46): Energy grid spec (grid(herx1_mkacisrmf.rmf[cols ENERG_LO,ENERG_HI])): Name of fits file with obs info (evt file -- include extension) (3662_evt2.fits[EVENTS]): Verbosity (0:5) (0): Detector Name (ACIS-S3): Grating for zeroth order ARF (NONE|LETG|HETG) (NONE): NONE, or name of ACIS window mask file (acisf03662_000N002_msk1.fits): NONE, or the name of the parameter block file (acisf141955042N002_pbk0.fits):
You can check the parameter file that was used with plist mkarf.
Correct the Streak Exposure Time
As the spectrum was made from streak data, not on-axis data, it is necessary to correct the exposure time in the spectrum file headers.
It takes 40 μs to transfer the charge from one row to another when reading out ACIS data. For the standard 1024 rows of a chip, the full time is then
1024 * 0.000040 = 0.04096
The full ACIS frame time is 3.24104 seconds. The ratio of the 1024 readout time to the ACIS frame time is:
0.04096/3.24104 = 0.0126379
Since there are only have 800 rows in this region, it's further reduced to:
0.012954 * (800/1024) = 0.00987336
Retrieve the exposure value from the header of the event file and scale it by this factor:
unix% dmkeypar 3662_evt2.fits EXPOSURE echo+ 49579.136114336 49579.136114336 * 0.00987336 = 489.51
Now update the spectrum file headers with the new exposure:
unix% punlearn dmhedit unix% dmhedit infile=herx1.pi filelist="" operation=add key=EXPOSURE value=489.51 unix% dmhedit infile=herx1_bg.pi filelist="" operation=add key=EXPOSURE value=489.51
Update File Headers (dmhedit)
Finally, add the background and response filenames to the header of the streak spectrum file.
unix% dmhedit infile=herx1.pi filelist="" operation=add key=BACKFILE value=herx1_bg.pi unix% dmhedit infile=herx1.pi filelist="" operation=add key=RESPFILE value=herx1_mkacisrmf.rmf unix% dmhedit infile=herx1.pi filelist="" operation=add key=ANCRFILE value=herx1.arf
Fitting
To fit the streak spectrum using the RMF and ARF, simply read the source spectrum FITS file into Sherpa, subtract the background, and fit it. See the Introduction to Fitting PHA Spectra thread for details.
Parameters for /home/username/cxcds_param/dmextract.par infile = 3662_evt2.fits[sky=region(streak_bg.reg)][bin pi] Input event file outfile = herx1_bg.pi Enter output file name (bkg = ) Background region file or fixed background (counts/pixel/s) subtraction (error = gaussian) Method for error determination(gaussian|gehrels|<variance file>) (bkgerror = gaussian) Method for background error determination(gaussian|gehrels|<variance file>) (bkgnorm = 1.0) Background normalization (exp = ) Exposure map image file (bkgexp = ) Background exposure map image file (sys_err = 0) Fixed systematic error value for SYS_ERR keyword (opt = pha1) Output file type (defaults = ${ASCDS_CALIB}/cxo.mdb -> /soft/ciao/data/cxo.mdb) Instrument defaults file (wmap = ) WMAP filter/binning (e.g. det=8 or default) (clobber = no) OK to overwrite existing output file(s)? (verbose = 0) Verbosity level (mode = ql)
Parameters for /home/username/cxcds_param/dmstat.par infile = 3662_evt2.fits[sky=region(onaxis.reg)][cols chipx,chipy,ccd_id,x,y] Input file specification out_columns = chipx,chipy,ccd_id,x,y Output Column Label out_min = 80,827,7,4148.0029297,4018.0319824 Output Minimum Value out_min_loc = 19103,16594,1,176095,185976 Output Minimum Location Value out_max = 164,911,7,4199.9956055,4069.9790039 Output Maximum Value out_max_loc = 103349,14719,1,182148,152100 Output Maxiumum Location Value out_mean = 121.6962529,868.3099628,7,4173.873478,4043.4555486 Output Mean Value out_median = Output Median Value out_sigma = 15.342811518,15.53880314,0,10.076932348,10.178223086 Output Sigma Value out_sum = 29603222,211220740,1702785,1015315592.9,983590779.46 Output Sum of Values out_good = 243255,243255,243255,243255,243255 Output Number Good Values out_null = 0,0,0,0,0 Output Number Null Values out_cnvrgd = Converged? out_cntrd_log = Output Centroid Log Value out_cntrd_phys = Output Centriod Phys Value out_sigma_cntrd = Output Sigma Centriod Value (centroid = yes) Calculate centroid if image? (median = no) Calculate median value? (sigma = yes) Calculate the population standard deviation? (clip = no) Calculate stats using sigma clipping? (nsigma = 3) Number of sigma to clip (maxiter = 20) Maximum number of iterations (verbose = 1) Verbosity level (mode = ql)
Parameters for /home/username/cxcds_param/mkacisrmf.par infile = /soft/ciao/CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0006.fits scatter/rsp matrix file outfile = herx1_mkacisrmf.rmf RMF output file wmap = none WMAP file energy = 0.1:11.0:0.01 energy grid in keV (lo:hi:bin) channel = 1:1024:1 channel grids in pixel (min:max:bin) chantype = PI channel type ccd_id = 7 filter CCD-ID chipx = 121 filter chipx in pixel chipy = 868 filter chipy in pixel gain = /soft/ciao/CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0006.fits gain file (asolfile = ) aspect solution file or a stack of asol files (obsfile = )wmap -> none) obs file (logfile = ) log file (contlvl = 100) # contour level (geompar = geom) pixlib geometry parameter file (thresh = 1e-06) low threshold of energy cut-off probability (clobber = no) overwrite existing output file (yes|no)? (verbose = 0) verbosity level (0 = no display) (mode = ql)
Parameters for /home/username/cxcds_param/acis_fef_lookup.par infile = 3662_evt2.fits Source file (event or spectrum) chipid = 7 ACIS chip number chipx = 121 ACIS chip x coordinate chipy = 868 ACIS chip y coordinate outfile = /soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2][ccd_id=7,chipx=97:128,chipy=865:896] FEF file to use (quality = no) Should you use the FEF file (if no use mkacisrmf)? (verbose = 0) Verbose level (mode = ql)
Parameters for /home/username/cxcds_param/mkrmf.par infile = /soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2][ccd_id=7,chipx=97:128,chipy=865:896] name of FEF input file outfile = herx1.rmf name of RMF output file axis1 = energy=0.1:11.0:0.01 axis-1(name=lo:hi:btype) axis2 = pi=1:1024:1 axis-2(name=lo:hi:btype) (logfile = STDOUT) name of log file (weights = ) name of weight file (thresh = 1e-5) low threshold of energy cut-off probability (outfmt = legacy) RMF output format (legacy|cxc) (clobber = no) overwrite existing output file (yes|no)? (verbose = 0) verbosity level (0 = no display) (axis3 = none) axis-3(name=lo:hi:btype) (axis4 = none) axis-4(name=lo:hi:btype) (axis5 = none) axis-5(name=lo:hi:btype) (mode = ql)
Parameters for /home/username/cxcds_param/asphist.par infile = @pcad_asol1.lis Aspect Solution List Files outfile = herx1.asphist Aspect Histogram Output File evtfile = 3662_evt2.fits[ccd_id=7] Event List Files dtffile = Live Time Correction List Files for HRC (geompar = geom) Parameter file for Pixlib Geometry files (res_xy = 0.5) Aspect Resolution x and y in arcsec (res_roll = 600.) Aspect Resolution roll in arcsec (max_bin = 10000.) Maximal number of bins (clobber = no) Clobber output (verbose = 0) Verbose (mode = ql)
Parameters for /home/username/cxcds_param/mkarf.par asphistfile = herx1.asphist[ASPHIST] Aspect Histogram File outfile = herx1.arf Output File Name sourcepixelx = 4173.87 Source X Pixel sourcepixely = 4043.46 Source Y Pixel engrid = grid(herx1_mkacisrmf.rmf[cols ENERG_LO,ENERG_HI]) Energy grid spec obsfile = 3662_evt2.fits[EVENTS] Name of fits file with obs info (evt file -- include extension) pbkfile = acisf141955042N002_pbk0.fits NONE, or the name of the parameter block file detsubsys = ACIS-S3 Detector Name grating = NONE Grating for zeroth order ARF maskfile = acisf03662_000N002_msk1.fits NONE, or name of ACIS window mask file verbose = 0 Verbosity (dafile = CALDB) NONE, CALDB, or name of ACIS dead-area calibration file (mirror = HRMA) Mirror Name (ardlibparfile = ardlib.par) name of ardlib parameter file (geompar = geom) Parameter file for Pixlib Geometry files (clobber = no) Overwrite existing files? (mode = ql) Enter mode for parameter file.
History
17 Jul 2009 | new for CIAO 4.1 |
15 Sep 2009 | corrected a typo in dmhedit command (was "key=key=EXPOSURE") |
22 Jan 2010 | reviewed for CIAO 4.2: updated results to match archived data; ds9 region file format menu has changed |
09 Mar 2010 | The ACIS detector is calibrated over the range 0.224004 - 12 keV; choosing values outside this range results in a warning from mkacisrmf. |
15 Jun 2010 | The background spectrum exposure time also needs to be scaled. |