Extract a Spectrum from the ACIS Readout Streak
CIAO 4.16 Science Threads
Overview
Synopsis:
Since the Chandra ACIS CCDs are part of a shutterless detector system, photons from a source can be detected while data from a CCD are being read out. These photons occur at the CHIPX location of the source (which is dithered), but can occur at any valid CHIPY location. As a result, a sky image of a bright source exhibits a linear "read-out streak" that passes through the source. In full frame mode, this streak is around 1022 pixels long depending on the dither pattern and the readout mode. If a subarray is used, then the streak is shorter.
This thread describes how to perform a spectral analysis of the events in the streak.
Purpose:
To create source and background PI spectra, an ARF, and an RMF for some portion of a read-out streak.
Last Update: 15 Feb 2022 - Review for CIAO 4.14. Updated for Repro-5 and CALDB4.9.6.
Contents
- Get Started
- Define the Source and Background Regions
- Extract Spectrum of Streak
- Locate Centroids (dmstat)
- Calculate the On-axis RMF
- Calculate the On-axis ARF
- Correct the Streak Exposure Time
- Update File Headers (dmhedit)
- Fitting
- Caveats
- Parameter files:
- History
- Images
Get Started
Download the sample data: 3662 (ACIS-S, HER X-1)
unix% download_chandra_obsid 3662 evt2,asol,msk,bpix
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:
- -120 ACIS data taken in (V)FAINT mode that has the time-dependent gain adjustment and CTI correction applied
- -120 ACIS data taken in GRADED mode that has the time-dependent gain adjustment and CTI correction applied
- -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.
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
[Version: full-size]
Figure 1: Extraction regions on the event file
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(3981.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(3981.3876,3656.4142,13.065366,699.50852,332.558) unix% cat onaxis.reg # Region file format: CIAO version 1.0 circle(4171.079,4025.1189,25.999999)
Extract Spectrum of Streak
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.
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 the RMF.
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.66762545 868.19989483 ) 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: ( 4171.0201176 4024.8903933 ) 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.66,868.20). The source position in sky coordinates is (x,y)=(4171.0,4024,9) 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)
First determine which gain file was used in the data processing:
unix% dmkeypar 3662_evt2.fits gainfile echo+ acisD2000-01-29gain_ctiN0008.fits
This event file has been reprocessed with the version 6 gain file. For this gain, use the acisD2000-01-29p2_respN0008.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_respN0008.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.7 chipy=868.2 unix% pset mkacisrmf gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0008.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): WARNING: energy input ( 0.100) is out of the ccd_id=7 RSP's low bound ( 0.243). INFO: Effective user energy (keV) grids will be re-arranged in 0.25000 - 11.00000 Single region, #1148 , processed.
The ACIS detector is calibrated over the range 0.243 - 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[FUNCTION][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.224 - 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 pcadf03662_000N001_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).
Please ensure that you have set up ardlib to use the bad pixel file for your observation before continuing.
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_000N004_msk1.fits unix% pset mkarf pbkfile= 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_000N004_msk1.fits): NONE, or the name of the parameter block file (acisf141955042N004_pbk0.fits):
You can check the parameter file that was used with plist mkarf.
The pbkfile is not longer required. Please see the note on the Watch Out page.
Correct the Streak Exposure Time
The effective exposure time for the read-out streak is considerably shorter than the exposure time for data obtained when the detectors are not being read out. Therefore, the exposure time needs to be corrected. If the extraction region for the read-out streak includes N_rows rows, then the effective exposure time is given by
EXPOSURE = N_frames * N_rows * 4.0e-5 seconds,
where
N_frames = EXPOSURE / EXPTIME
is the number of valid frames in the good-time intervals. If your data are not on the AIM chip , you should use the EXPOSURn value for the CCD where the source is located.
unix% dmkeypar 3662_evt2.fits EXPOSURE echo+ 49577.78473833 unix% dmkeypar 3662_evt2.fits EXPTIME echo+ 3.1 % echo "49577.78473833/3.1" | bc -l 15992.833
and in this example N_rows is 700 in this region
unix% cat streak.reg # Region file format: CIAO version 1.0 rotbox(3973.3876,3656.4142,13.065366,699.50852,332.558)
This gives a streak time of
15993 frames * 700 rows * 4.0e-5 seconds/frame/row = 447.804 seconds
Now update the spectrum file headers with the new exposure:
unix% punlearn dmhedit unix% dmhedit infile=herx1.pi filelist="" operation=add key=EXPOSURE value=447.804
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. See the Introduction to Fitting PHA Spectra thread for details.
Caveats
The response of the detectors during the read-out process has not been calibrated. The data products obtained by following this thread are based on the assumption that the detectors spectral response characteristics during read out are the same as the spectral response characteristics during the standard static TIMED exposure mode observations.
Users should be very careful with trying to subtract the background extracted this way. The background events do not have the same ARF as the streak events. The streak events came from the sources off-axis angle/etc whereas the background comes from various off-axis angles and are detected at various chip locations. Users should model the background and not simply subtract it.
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 Maximum 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 Centroid Phys Value out_sigma_cntrd = Output Sigma Centroid 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 = NONE, or the name of the parameter block file detsubsys = ACIS-S3 Detector Name grating = NONE Grating for zeroth order ARF maskfile = acisf03662_000N004_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. |
13 Jan 2011 | reviewed for CIAO 4.3: no changes |
01 Mar 2011 | CALDB 4.4.2 release: fix to the header of the ACIS QE contamination file. Prior to this release, CIAO would fail when trying to look up the contamination model correction for chips ACIS-8 (S4) and ACIS-9 (S5); added missing information on CALDB 4.4.1 release (15 Dec 2010) |
04 Apr 2011 | updated for 04 Apr scripts package release: acis_fef_lookup script prints the version at verbose > 0. |
26 Apr 2011 | install version 2 of the tools package for CIAO 4.3 to fix the mkrmf bug. |
20 Jul 2011 | required software updates are listed in Synopsis |
10 Jan 2012 | reviewed for CIAO 4.4: there are 700 rows in the streak region, not 800 as the previous version of thread claimed; this changes the scaled exposure time. |
06 Apr 2012 | corrected typo where the readout time is incorrect |
03 Dec 2012 | Review for CIAO 4.5 |
14 Jan 2013 | Complete CIAO 4.5 review. Updated file names and versions. Added badpixel to retrieve list and added another note about running acis_set_ardlib in the ARF section. Added a final warning that background ARF and streak event ARF are not the same so users should not subtract when fitting. |
28 Jun 2013 | Updated information of frame time and general cleanup. |
11 Dec 2013 | Review for CIAO 4.6; Updated info about the mkarf pbkfile handling. |
23 Dec 2014 | Review for CIAO 4.7; no changes. |
15 Feb 2022 | Review for CIAO 4.14. Updated for Repro-5 and CALDB4.9.6. |