Last modified: 06 Jan 2025

URL: https://cxc.cfa.harvard.edu/ciao/threads/acis-fptemp-resp/

Extracting Spectra and Responses for ACIS Observations that Undergo Large Focal-plane Temperature Swings

CIAO 4.17 Science Threads


Overview

Synopsis:

[TIP]
Advanced Thread

The ACIS response is affected by warm ACIS focal-plane temperatures which can impact line-centroid accuracy. Individual observations of bright sources that undergo large swings in focal-plane temperature of ~several degrees or more may benefit from temperature filtering the observation and generating separate Response Matrix Files (RMFs) for each filter. Observations that are warm (e.g., warmer than -111 C) but do not significantly fluctuate in FP_TEMP during the observation should be reduced the standard way.

Users are strongly encouraged to perform their analysis with and without the methods in this thread to evaluate the impact of focal-plane temperature on their specific science goals. Timing analysis and imaging analysis, including source detection, are not affected by changes in focal-plane temperature. Variations in ACIS focal-plane temperatures while colder than -105 C do not impact dispersed grating data from the HETG or LETG.

[CAUTION]
Caution

Important note: Explicitly using temperature to filter an event file as shown in this thread will often produce event files with asynchronous events. If users wish to analyze spectral variability within an observation that undergoes large changes in focal-plane temperature then they should consider filtering the observations by time before applying the method discussed below.

The ACIS focal-plane temperature during some observations is allowed to vary by several degrees Kelvin to increase observing efficiency. Most ACIS calibration products already account for the effects of warmer focal-plane temperatures. However, some ACIS CCDs (Table 1 below) now have calibrations products for generating focal-plane temperature-dependent RMFs relevant for observations that undergo large swings in temperature. If a source of interest lies on one of these CCDs and the observation underwent large, multiple degrees Kelvin change in focal-plane temperature then this thread may be used to extract multiple spectra within an obsID with matching temperature-dependent response files.

Users that wish to completely filter out event associated with specific focal-plan temperatures should see Removing Warm ACIS Data.

Purpose:

To account for times when the ACIS focal-plane temperature is warm and varies over the observation which may degrade the CCD spectral resolution. This issue can be mitigated with new calibration products which affect spectral response files (RMFs).

Related Links:

Last Update: 06 Jan 2025 - Thread created.


Contents


Get Started

Download the sample data: 17233 (ACIS Observation)


Determine if Your Source Could Benefit from ACIS Warm RMF Calibrations

As of CALDB v 4.12.0, specific CCDs (see table below) have updated calibration products for the production of RMFs at discrete ACIS focal-plane temperatures. CCDs not listed in the table below will receive the standard -120 C calibration for RMFs regardless of the focal-plane temperature. This thread is for data where a source of interest occurs on a CCD with updated calibrations and the ACIS focal-plane temperature spans multiple calibrated temperature ranges. Data that do not meet these requirements can be processed in the standard way. Table 1 below shows the range of ACIS focal-plane temperatures and CCDs that have updated calibration products for generating RMFs.

List of ACIS CCDs with Updated CALDB p2_resp Products
ACIS Focal Plane Temperature CCDs with Updated Calibration
[152.96 to 153.96] K, [-120 to -119] C Values unchanged as of CALDB v. 4.11.5
[153.96 to 155.96] K, [-119 to -117] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[155.96 to 157.96] K, [-117 to -115] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[157.96 to 159.96] K, [-115 to -113] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[159.96 to 161.96] K, [-113 to -111] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[161.96 to 163.96] K, [-111 to -109] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[163.96 to 165.96] K, [-109 to -107] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
[165.96 to 167.96] K, [-107 to -105] C CCD_ID [0, 1, 2, 3, 6] -- ACIS [I0, I1, I2, I3, S2]
Notes: (1) Use FP_TEMP in K when filtering data. (2) Temperatures listed in C in table have an offset of 0.19 degrees.

First we need to check the observation's focal-plane temperature. An observation's median ACIS focal-plane temperature is saved in the FP_TEMP header keyword of a Chandra event file. Since we want to know the entire range of focal-plane temperatures during an observation, we will instead look at the FP_TEMP column of the mission timeline file.

We begin by using dmstat to identify the min and max focal-plane temperatures during the observation.

unix% dmstat 'infile=17233/secondary/acisf17233_000N002_mtl1.fits.gz[cols FP_TEMP]'

FP_TEMP
    min:	153.60722351 	      @:	333
    max:	157.96488953 	      @:	13607
   mean:	155.79074933
  sigma:	1.3777218286
    sum:	2165335.6249
   good:	13899
   null:	0

Here we can see that the focal-plane temperature varied during the observation between a minimum of 153.607 and maximum of 157.965 degrees Kelvin. Now lets use dmstat to see which ACIS CCD our example source of interest falls on. It's located at RA=221.8583 DEC=8.4735 which in sky coordinates is (4184,3915).

unix% dmstat infile='17233/primary/acisf17233N002_evt2.fits.gz[sky=circle(4184,3915,10)][cols ccd_id]'

# ccd_id
#     min:	3 	      @:	1
#     max:	3 	      @:	1
#    mean:	3
#   sigma:	0
#     sum:	13836
#    good:	4612
#    null:	0

We see here that our source of interest falls on CCD_ID 3 (ACIS-I3). Looking at the above table showing ACIS calibrated temperature ranges as of CALDB v 4.12.0, we see that the focal-plane varied across three different calibrated temperature ranges. Therefore, since our source of interest falls on ACIS I3 then this obsID could potentially benefit from filtering event data by calibrated focal-plane temperatures and generating individual responses. See Synopsis above for more info.

Instead of looking at only the min and max FP_TEMP, we can also view the FP_TEMP vs time by plotting it with python. FP_TEMP is stored in the mission timeline file in degrees Kelvin. To make the plot more legible, we plot time-offset from the first record.

The resulting plot is shown in Figure 1.

% python

from pycrates import read_file
import matplotlib.pyplot as plt

mtl=read_file("17233/secondary/acisf17233_000N002_mtl1.fits.gz[cols time,fp_temp]")
times = mtl.get_column("time").values
time_offset = (times - times[0]) / 1000.0  # sec -> ksec
fp_temp = mtl.get_column("fp_temp").values

p = plt.plot(time_offset,fp_temp)
p[0].set_marker("o")
p[0].set_markersize(1)
p[0].set_linestyle('None')

plt.xlabel("Time since observation start [ks]")
plt.ylabel("FP_TEMP [Kelvin]")
plt.title("OBS_ID : 17233")

plt.savefig("obs17233_fptemp.png")
exit()

Figure 1: Time versus ACIS Focal Plane Temperature

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 1: Time versus ACIS Focal Plane Temperature

How ACIS focal-plane temperature [K] changes with time [ks] since observation start for obsID 17233.

In this particular obsID, the focal-plane temperature changes approximately 4 degrees Kelvin during the observation and generally increases steadily with time from the observation start.


Create Good Time Intervals (GTIs) Based on Calibrated Focal Plane Temperatures

We can temperature filter the event file with a custom good time interval created using the dmgti tool.

In this example, we choose the following calibrated temperature intervals of [152.96 - 153.96 K], [153.96 - 155.96 K] and [155.96 - 157.96 K]. For a list of CCDs and temperature intervals currently calibrated, see Table 1 above.

unix% dmgti infile='17233/secondary/acisf17233_000N002_mtl1.fits.gz' outfile=temp_153K_154K_GTI.fits userlimit='( (FP_TEMP >= 152.96 ) && (FP_TEMP < 153.96 ) )'
unix% dmgti infile='17233/secondary/acisf17233_000N002_mtl1.fits.gz' outfile=temp_154K_156K_GTI.fits userlimit='( (FP_TEMP >= 153.96 ) && (FP_TEMP < 155.96 ) )'
unix% dmgti infile='17233/secondary/acisf17233_000N002_mtl1.fits.gz' outfile=temp_156K_158K_GTI.fits userlimit='( (FP_TEMP >= 155.96 ) && (FP_TEMP < 157.965 ) )'
[NOTE]
Note

The maxmium focal-plane temperature in the MTL file for this obsID is listed as 157.96488953 and this value lies just outside the [155.96 to 157.96] p2_resp calibrated temperature bin. Since the FP_TEMP value is unlikely to be this accurate, we opt to increase the dmgti userlimit FP_TEMP range for the 156-158K temperature bin above to 157.965 so we don't exclude any events.

The userlimit parameter is a dmmath expression that should evaluate to TRUE when the data meet the userlimit requirement. In this example we want to know the observation times when the ACIS FP_TEMP value was between the range supplied.


Apply GTIs to Create New Event Files and Update Their FP_TEMP Keyword Value

We can now use dmcopy to create temperature-filtered event files and dmkeypar to modify the FP_TEMP keyword in the event file header. We will modify the new FP_TEMP value to be the median value of the calibrated temperature range. We will save the output temperature-filtered evt2 files in the obsID's primary folder to make later spectral extraction with specextract easier.

unix% dmcopy infile='17233/primary/*evt2.fits.gz[@temp_153K_154K_GTI.fits]' outfile='17233/primary/obs17233_temp_153K_154K_evt2.fits'
unix% dmhedit infile='17233/primary/obs17233_temp_153K_154K_evt2.fits' filelist='None' operation='add' key='FP_TEMP' value=153.5

unix% dmcopy infile='17233/primary/*evt2.fits.gz[@temp_154K_156K_GTI.fits]' outfile='17233/primary/obs17233_temp_154K_156K_evt2.fits'
unix% dmhedit infile='17233/primary/obs17233_temp_154K_156K_evt2.fits' filelist='None' operation='add' key='FP_TEMP' value=155.0

unix% dmcopy infile='17233/primary/*evt2.fits.gz[@temp_156K_158K_GTI.fits]' outfile='17233/primary/obs17233_temp_156K_158K_evt2.fits'
unix% dmhedit infile='17233/primary/obs17233_temp_156K_158K_evt2.fits' filelist='None' operation='add' key='FP_TEMP' value=157.0

We can verify that these new event files have been temperature-filtered by comparing their exposure header keyword values to the original un-filtered evt2 file.

unix% dmlist 17233/primary/acisf17233N002_evt2.fits.gz header | grep EXPOSURE

0113 EXPOSURE                 42520.878762310 [s]        Real8        Exposure time

unix% dmlist 17233/primary/obs17233_temp_153K_154K_evt2.fits header | grep EXPOSURE
unix% dmlist 17233/primary/obs17233_temp_154K_156K_evt2.fits header | grep EXPOSURE
unix% dmlist 17233/primary/obs17233_temp_156K_158K_evt2.fits header | grep EXPOSURE

0113 EXPOSURE                  6262.7888060302 [s]       Real8        Exposure time
0113 EXPOSURE                 15438.218033820 [s]        Real8        Exposure time
0113 EXPOSURE                 20819.871922460 [s]        Real8        Exposure time

Summing the exposures of the temperature-filtered event files, we can see the sum is the same as the original evt2 file. When temperature-filtering data, some observations can have a large number of GTIs. When users apply a time filter to an ACIS event file, the boundaries of the original full-frame exposures are not preserved leading to small errors in the total exposure per good time interval (GTI). If your total exposure time is different from the summed exposure of the individual temperature boundaries, consider following the gti_align thread to create aligned GTIs before using them to filter the event file.

For each calibrated temperature range, we have created a temperature-filtered event file and modified its FP_TEMP header keyword value to reflect the temperature filter. Note, here we set the FP_TEMP keyword value to be the median of the calibrated temperature range. This value is not the median focal-plane temperature during the temperature-filtered times. This step ensures the CALDB uses the appropriate temperature product for RMF generation.

[CAUTION]
Caution

Explicitly using temperature to filter an event file as we did above will could produce event files with asynchronous events. If users wish to analyze spectral variability within an observation that undergoes large changes in focal-plane temperature, they should first filter the observations by time before applying the method discussed in this thread.


Extract Spectra and Matching Temperature-dependent Responses

These individual temperature-filtered event files can now be used with dmextract or specextract as you would normally extract spectra for point-like or extended sources. For this obsID, the object is an extended source so let's use specextract and extract a spectrum for a extended source located at RA=221.8583 DEC=8.4735 which in sky coordinates is (4184,3915). Let's choose a empty part of the sky as a background region with SKY coordinates of (4278,3642). Since our temperature-filtered event files are located in the observation's primary folder, specextract will automatically find the necessary ancillary files for spectral extraction. Otherwise, these files can be set manually in the specextract parameter file using the pset notation.

unix% specextract infile='17233/primary/obs17233_temp_153K_154K_evt2.fits[sky=circle(4184,3915,10.0)]' bkgfile='17233/primary/obs17233_temp_153K_154K_evt2.fits[sky=circle(4278,3642,40.0)]' outroot=obs17233_temp_153K_154K weight_rmf=yes weight=yes

unix% specextract infile='17233/primary/obs17233_temp_154K_156K_evt2.fits[sky=circle(4184,3915,10.0)]' bkgfile='17233/primary/obs17233_temp_154K_156K_evt2.fits[sky=circle(4278,3642,40.0)]' outroot=obs17233_temp_154K_156K weight_rmf=yes weight=yes

unix% specextract infile='17233/primary/obs17233_temp_156K_158K_evt2.fits[sky=circle(4184,3915,10.0)]' bkgfile='17233/primary/obs17233_temp_156K_158K_evt2.fits[sky=circle(4278,3642,40.0)]' outroot=obs17233_temp_156K_158K weight_rmf=yes weight=yes

If you wish to verify that this method used the correct temperature-dependent p2_resp ACIS calibration file then you can check using dmlist.

unix% dmlist obs17233_temp_156K_158K.rmf header | grep SCATFILE

The resulting spectral files can now be used for spectral analysis in a spectral fitting program such as sherpa. When appropriate, users should consider fitting their spectra jointly.

Users are strongly encouraged to perform their spectral analysis both with and without filtering to correct for the warm times. It is not recommended to analyze combined or temperature-filtered spectra for sources whose spectrum changes within an observation without considering how timing may impact the results.


Combine Extracted Spectra and Responses to Produce a Single Spectrum

Users can combine individual temperature-binned spectra and responses if desired. The individual event files produced in the previous step can be used with tools such as combine_spectra but this can be automated using the specextract 'combine' parameter which requires a input stack of event files.

First we use stk_build to create a stack of our temperature-filtered event files. We will need one stack for the source extraction region and another for the background extraction region.

unix% stk_build infile='17233/primary/obs17233_temp_153K_154K_evt2.fits[sky=circle(4184,3915,10.0)], 17233/primary/obs17233_temp_154K_156K_evt2.fits[sky=circle(4184,3915,10.0)], 17233/primary/obs17233_temp_156K_158K_evt2.fits[sky=circle(4184,3915,10.0)]' outfile=src_stack.lis

unix% stk_build infile='17233/primary/obs17233_temp_153K_154K_evt2.fits[sky=circle(4278,3642,40.0)], 17233/primary/obs17233_temp_154K_156K_evt2.fits[sky=circle(4278,3642,40.0)], 17233/primary/obs17233_temp_156K_158K_evt2.fits[sky=circle(4278,3642,40.0)]' outfile=bkg_stack.lis

Now that the stacks are assembled, we can run specextract with the 'combine' parameter set to 'yes'.

unix% specextract infile=@src_stack.lis bkgfile=@bkg_stack.lis outroot=obs17233_temps weight=yes weight_rmf=yes combine=yes

The resulting spectral files can now be used in spectral analysis in a spectral fitting program such as sherpa. Users are strongly encouraged to perform their spectral analysis both with and without filtering and correcting for the warm times. It is not recommended to analyze combined or temperature-filtered spectra for sources whose spectrum changes within an observation without considering how timing may impact the results.



Parameters for /home/username/cxcds_param/dmstat.par


        infile = 17233/primary/acisf17233N002_evt2.fits.gz[sky=circle(4184,3915,10)][cols ccd_id] Input file specification
   out_columns = ccd_id           Output Column Label
       out_min = 3                Output Minimum Value
   out_min_loc = 1                Output Minimum Location Value
       out_max = 3                Output Maximum Value
   out_max_loc = 1                Output Maximum Location Value
      out_mean = 3                Output Mean Value
    out_median =                  Output Median Value
     out_sigma = 0                Output Sigma Value
       out_sum = 13836            Output Sum of Values
      out_good = 4612             Output Number Good Values
      out_null = 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/dmgti.par


        infile = 17233/secondary/acisf17233_000N002_mtl1.fits.gz Input MTL file
       outfile = temp_156K_158K_GTI.fits Output GTI file
     userlimit = ( (FP_TEMP >= 156.16 ) && (FP_TEMP < 158.16 ) ) User defined limit string
      (mtlfile = none)            Optional output smoothed/filtered MTL file
     (lkupfile = none)            Lookup table defining which MTL columns to check against (NONE|none|<filename>)
       (smooth = no)              Smooth the input MTL data?
      (clobber = yes)             Clobber output file if it exists?
      (verbose = 5)               Debug level
         (mode = hl)        
    


Parameters for /home/username/cxcds_param/dmcopy.par


        infile = 17233/primary/*evt2.fits.gz[@temp_156K_158K_GTI.fits] Input dataset/block specification
       outfile = 17233/primary/obs17233_temp_156K_158K_evt2.fits Output dataset name
       (kernel = default)         Output file format type
       (option = )                Option - force output type
      (verbose = 0)               Debug Level
      (clobber = no)              Clobber existing file
         (mode = ql)
    


Parameters for /home/username/cxcds_param/dmhedit.par


        infile = 17233/primary/obs17233_temp_156K_158K_evt2.fits Input dataset/block specification
      filelist = None             Edit list file name
     operation = add              Operation
           key = FP_TEMP          Keyword
         value = 157.0            Value for keyword
     (datatype = indef)           Keyword data type
         (unit = )                Unit for keyword
      (comment = )                Comment for keyword
      (verbose = 0)               Verbosity Level(0-5)
         (mode = ql)
    


Parameters for /home/username/cxcds_param/dmlist.par


        infile = 17233/primary/obs17233_temp_156K_158K_evt2.fits Input dataset/block specification
           opt = header           Option
      (outfile = )                Output file (optional)
         (rows = )                Range of table rows to print (min:max)
        (cells = )                Range of array indices to print (min:max)
      (verbose = 0)               Debug Level(0-5)
         (mode = ql)           
    


Parameters for /home/username/cxcds_param/stk_build.par


        infile = 17233/primary/obs17233_temp_153K_154K_evt2.fits[sky=circle(4278,3642,40.0)], 17233/primary/obs17233_temp_154K_156K_evt2.fits[sky=circle(4278,3642,40.0)], 17233/primary/obs17233_temp_156K_158K_evt2.fits[sky=circle(4278,3642,40.0)] Stack to expand
       outfile = bkg_stack.lis    Output file name
      (clobber = no)              OK to overwrite existing output file?
      (verbose = 0)               Verbosity level
         (mode = ql)            
    


Parameters for /home/username/cxcds_param/specextract.par


        infile = @src_stack.lis   Source event file(s)
       outroot = obs17233_temps   Output directory path + root name for output files
      (bkgfile = )                Background event file(s)
          (asp = )                Source aspect solution or histogram file(s)
      (dtffile = )                Input DTF files for HRC observations
      (mskfile = )                Maskfile (input to mkwarf)
      (rmffile = CALDB)           rmffile input for CALDB
   (badpixfile = )                Bad pixel file for the observation
       (dafile = CALDB)           Dead area file (input to mkwarf)
      (bkgresp = yes)             Create background ARF and RMF?
       (weight = yes)             Should response files be weighted?
   (weight_rmf = no)              Should RMF also be weighted?
     (resp_pos = REGION)          Unweighted response position determination method
     (refcoord = )                RA and Dec of responses?
   (correctpsf = no)              Apply point source aperture correction to ARF?
      (combine = no)              Combine ungrouped output spectra and responses?
(readout_streakspec = no)              Is the source extraction region for the ACIS readout streak?
    (grouptype = NUM_CTS)         Spectrum grouping type (same as grouptype in dmgroup)
      (binspec = 15)              Spectrum grouping specification (NONE,1:1024:10,etc)
(bkg_grouptype = NONE)            Background spectrum grouping type (NONE, BIN, SNR, NUM_BINS, NUM_CTS, or ADAPTIVE)
  (bkg_binspec = )                Background spectrum grouping specification (NONE,10,etc)
       (energy = 0.3:11.0:0.01)   Energy grid
      (channel = 1:1024:1)        RMF binning attributes
  (energy_wmap = 300:2000)        Energy range for (dmextract) WMAP input to mkacisrmf
   (binarfcorr = 1)               Detector pixel binnning factor for (arfcorr) to determine size and scale of PSF to derive aperture corrections at each energy step.
      (binwmap = tdet=8)          Binning factor for (dmextract) WMAP input to mkacisrmf
   (binarfwmap = 1)               Binning factor for (sky2tdet) WMAP input to mkwarf
     (parallel = yes)             Run processes in parallel?
        (nproc = INDEF)           Number of processors to use
       (tmpdir = ${ASCDS_WORK_PATH} -> /var/folders/ss/k9bxl4w138gc6lcytt_66rtw0000gn/T/) Directory for temporary files
      (clobber = no)              OK to overwrite existing output file?
      (verbose = 1)               Debug Level(0-5)
         (mode = ql)        
    

History

06 Jan 2025 Thread created.