Last modified: 13 Jan 2022

URL: https://cxc.cfa.harvard.edu/ciao/threads/acisreadcorr/

Remove the ACIS Readout Streak

CIAO 4.16 Science Threads


Overview

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, as shown in the Get Started section. Events above a source occur as a frame is being read out. Events below the source occur when the previous frame is being read out.

Note that the streak events can be used for spectral extraction, as described in the Extract a Spectrum from the ACIS Readout Streak thread.

Purpose:

To remove the streak from the image (for cosmetic reasons and so that it doesn't affect source detection), and to retain the streak photons.

Related Links:

Last Update: 13 Jan 2022 - Reviewed for CIAO 4.14. No changes.


Contents


Get Started

Download the sample data: 1712 (ACIS-S, 3C273)

unix% download_chandra_obsid 1712 evt2,asol

Figure 1 shows the prominent readout streak on the S3 chip, which will be removed by running this thread. There may also be streaks on the S4 chip, which are due to a flaw in the serial readout of the chips; use the tool destreak to remove those streaks.

Figure 1: ACIS readout streak

[Thumbnail image: The ACIS source is piled and has a bright streak running through it.]

[Version: full-size]

[Print media version: The ACIS source is piled and has a bright streak running through it.]

Figure 1: ACIS readout streak

The streak photons are clocked out in the wrong row and so have incorrect CHIPY values.


Get Source Location

acisreadcorr uses the source position to determine which events may have a misplaced CHIPY value. There are several ways to estimate the source position:

  1. With ds9:

    unix% ds9 acisf01712N005_evt2.fits &
    

    From the ds9 display (Figure 2), we can estimate that the center of the source is at (4082.25,4076.25).

    Figure 2: Getting the source location from ds9

    [Thumbnail image: A white cross point is located in the center of the piled-up source hole. A region information window shows the coordinates of the point.]

    [Version: full-size]

    [Print media version: A white cross point is located in the center of the piled-up source hole. A region information window shows the coordinates of the point.]

    Figure 2: Getting the source location from ds9

    The circle is used to estimate the source location as (4082.25,4076.25).

  2. With dmstat:

    The value obtained from visual inspection with ds9 can be improved by computing the centroid with dmstat. Here we filter the event file and bin it into an image around the location of the source. Even though the source is completely cratered, the centroid can often be a robust estimate for the source location.

    unix% punlearn dmstat
    dmstat "acisf01712N005_evt2.fits[sky=circle(4082.25,4076.25,20)][bin sky=1]" centroid+ sig- med-
    EVENTS_IMAGE(x, y)
        min:	0 	      @:	( 4083.75 4056.75 )
        max:	162 	      @:	( 4085.75 4078.75 )
    cntrd[log] :	( 20.365025631 20.422719799 )
    cntrd[phys]:	( 4082.1150256 4076.1727198 )
       good:	1264 
       null:	336
    

    A radius of 20 was chosen to enclose most of the wings of the PSF but to avoid the jet. The source location is given as (4082.1,4076.2).

  3. From a catalog:
    use the known source position from SIMBAD, NED, or another reputable source.

    From SIMBAD, the known position for 3C 273 is (RA,DEC) = (12:29:06.700, +02:03:08.60).

    dmcoords is used to to convert (RA,Dec) to sky(x,y) coordinates.

    unix% punlearn dmcoords
    unix% dmcoords acisf01712N005_evt2.fits op=cel celfmt=hms ra=12:29:06.700 dec=+02:03:08.60
    unix% pget dmcoords x y
    4082.181976564152
    4076.110245719566
    

    The celfmt=hms is used to indicate that the coordinates are provided in sexagesimal format.

    The source position in sky pixels is (4082.2, 4076.1). This value will be used in the rest of the thread.


Create a Background Spectrum

Removing all the photons from the affected area would leave a black streak instead of a bright one. We wish instead to leave the background photons where they are. For this reason, it is possible to input a background PI spectrum. The tool then attempts to leave background photons - consistent with the given PI spectrum and distributed evenly in time - where the streak once was.

First, we need to select a background region. This can be from any area of the chip that doesn't contain any bright regions; Figure 3 shows the region used. For help on rotating regions in ds9, see this FAQ.

Figure 3: Region for background spectrum

[Thumbnail image: A square region parallel to the readout streak is displayed on the image.]

[Version: full-size]

[Print media version: A square region parallel to the readout streak is displayed on the image.]

Figure 3: Region for background spectrum

The background region is selected from a source-free region on the same chip away from the readout streak.

To save the regions, follow these steps:

  1. Region → Save Regions... → Save As "bkg.reg".
  2. 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 file will look something like this:

unix%  more bkg.reg 
# Region file format: CIAO version 1.0
rotbox(4410.92,4353.0555,389.55054,66.92414,24.719781)

The tool dmextract is now used to create the spectrum of this region:

unix% punlearn dmextract
unix% pset dmextract infile="acisf01712N005_evt2.fits[sky=region(bkg.reg)][bin pi=1:1024:1]"
unix% pset dmextract outfile=bkg_pi.fits
unix% dmextract
Input event file  (acisf01712N005_evt2.fits[sky=region(bkg.reg)][bin pi=1:1024:1]): 
Enter output file name (bkg_pi.fits): 

The contents of the parameter file may be checked using plist dmextract.

NOTE: if your observation was taken with a subarray defined, read the Observations Using Subarrays caveat before proceeding.

The background spectrum should be binned to be the same size as your event file. If you were to bin this example to 1:1023:1, for instance, it may cause photons with PI=1024 to be attributed to the source erroneously. Changing the binning is only a concern if you have filtered your event file such that there are no longer 1024 channels of PI.


Run acisreadcorr

The dx and dy parameters may need to be adjusted before running the tool. The default value for dx (2 pixels), or a number close to it, should be fine for on-axis point sources. dy can be estimated by drawing a circle in ds9 and finding the diameter (Figure 4). These values determine the width of the region to be cleaned and how close to get to the source, respectively.

Figure 4: Choosing dy for the observation

[Thumbnail image: A red circle outlines the source. A region information window shows the coordinates of the circle.]

[Version: full-size]

[Print media version: A red circle outlines the source. A region information window shows the coordinates of the circle.]

Figure 4: Choosing dy for the observation

dy, the number of rows to be avoided around a source, can be estimated from the diameter of a circle drawn in ds9 (50 px).

Now we have all the necessary information to run acisreadcorr. The same aspect solution list file, @pcad_asol1.lis, is used:

unix% cat pcad_asol1.lis
pcadf01712_001N001_asol1.fits

unix% punlearn acisreadcorr
unix% pset acisreadcorr infile=acisf01712N005_evt2.fits
unix% pset acisreadcorr outfile=acis_1712_corr_evt2.fits
unix% pset acisreadcorr aspect=@pcad_asol1.lis
unix% pset acisreadcorr x=4082.2 y=4076.1
unix% pset acisreadcorr dx=5 dy=50
unix% pset acisreadcorr bkg=bkg_pi.fits
unix% acisreadcorr 
Input dataset/block specification (acisf01712N005_evt2.fits): 
Output dataset/block specification (acis_1712_corr_evt2.fits): 
Aspect file (@pcad_asol1.lis): 
Sky X position (pixels) (4082.2): 
Sky Y position (pixels) (4076.1):

The contents of the parameter file may be checked using plist acisreadcorr.


Examine the Results

The newly created file can be viewed in ds9:

unix% ds9 acis_1712_corr_evt2.fits &

as seen in Figure 5.

Figure 5: Event file with streak removed (used background spectrum)

[Thumbnail image: The readout streak has been removed from the data and filled in.]

[Version: full-size]

[Print media version: The readout streak has been removed from the data and filled in.]

Figure 5: Event file with streak removed (used background spectrum)

Only events consistent, spectrally, with the background are left in the readout streak area. All the other events have been moved to the source location positon.

The new event file is compared to the original event file in Figure 6.

Figure 6: Comparison of original and filled event files

[Thumbnail image: The original event file and the file without the streak are displayed side-by-side in ds9.]

[Version: full-size]

[Print media version: The original event file and the file without the streak are displayed side-by-side in ds9.]

Figure 6: Comparison of original and filled event files

The original event file is in the left frame and the file with readout streak removed is in the right frame.

Figure 7 shows an image of a nearly identical acisreadcorr run. The only difference is that a background spectrum was not supplied to the tool (i.e. bkg=""). The streak has been removed and a stripe of zero counts replaces it.

Figure 7: Event file with streak removed (without background spectrum)

[Thumbnail image: The readout streak has been removed from the data but was not filled in.]

[Version: full-size]

[Print media version: The readout streak has been removed from the data but was not filled in.]

Figure 7: Event file with streak removed (without background spectrum)

If a background spectrum is not provided, the streak is removed and a stripe of zero counts replaces it.

dmcopy may be used to see which photons were flagged by the tool. Status bit 22 marks photons identified as background and bit 21 marks out-of-time source events. In the following filters, the bits are numbered from the right, starting at zero:

unix% dmcopy "acis_1712_corr_evt2.fits[status=xxxxxxxxxx10xxxxxxxxxxxxxxxxxxxxx]" \
      flag_bkg.fits

unix% dmcopy "acis_1712_corr_evt2.fits[status=xxxxxxxxxx01xxxxxxxxxxxxxxxxxxxxx]" \
      flag_source.fits

Displaying these event files side-by-side produces Figure 8.

Figure 8: Photons flagged by acisreadcorr

[Thumbnail image: The background and source photons flagged by the tool are displayed side-by-side in ds9.]

[Version: full-size]

[Print media version: The background and source photons flagged by the tool are displayed side-by-side in ds9.]

Figure 8: Photons flagged by acisreadcorr

The background photons are in the left frame and the out-of-time source photons are in the right frame. The right frame is set at zoom=4.


Caveats

Observations Using Subarrays

There is a bug in the current version of acisreadcorr such that so that it does not work correctly on observations that used a subarray. A subarray is a defined region of the CCD in which data will be taken, rather than the entire chip. Since the readout time is scaled by the fraction of the chip used, a common case in which observers decide to use a subarray is to reduce pileup (i.e. the data are read out faster). See the Frame Times & Subarrays section of the POG for details.

Users can check if the observation was done in subarray mode by checking the NROWS keyword. Any value less than 1024 indicates a subarray was used.

unix% dmkeypar acis_repro_evt2.fits NROWS echo+
128

The bug comes into play when a background spectrum is used (bkg parameter). The workaround is to modify the BACKSCAL header keyword with dmhedit. Specifically, it needs to be multiplied by:

1024 / (subarray delta y)

For example, a 1/8 subarray has delta y = 128, so the ratio is:

1024 / 128 = 8

Then modify the background file created in the Create a Background Spectrum step.

NOTE: the observation in this thread does not use a subarray; this background file is used for illustrative purposes only:

unix% dmkeypar bkg_pi.fits BACKSCAL echo+
0.00038847826236539

calculate new value:	0.00038847826236539 * 8 = 0.00310782609892312

unix% dmhedit infile=bkg_pi.fits filelist="" operation=add \
      key=BACKSCAL value=0.00310782609892312 unit="[pixel]" comment="Fractional area"

unix% dmkeypar bkg_pi.fits BACKSCAL echo+
0.0031078260989231

The BACKSCAL keyword has been properly updated, so the thread may be continued from the Run acisreadcorr step.



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


#--------------------------------------------------------------------
#
# DMEXTRACT -- extract columns or counts from an event list
#
#--------------------------------------------------------------------
        infile = acisf01712N005_evt2.fits[sky=region(bkg.reg)][bin pi=1:1024:1] Input event file 
       outfile = bkg_pi.fits      Enter output file name
          (bkg = )                Background region file or fixed background (counts/pixel/s) subtraction
        (error = gaussian)        Method for error determination(poisson|gaussian|<variance file>)
     (bkgerror = gaussian)        Method for background error determination(poisson|gaussian|<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: pha1 
     (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/acisreadcorr.par


        infile = acisf01712N005_evt2.fits   Input dataset/block specification
       outfile = acis_1712_corr_evt2.fits Output dataset/block specification
        aspect = @pcad_asol1.lis  Aspect file
             x = 4088.1           Sky X position (pixels)
             y = 4083             Sky Y position (pixels)
           (dx = 5)               Chip X tolerance diameter (pixels)
           (dy = 50)              Chip Y tolerance diameter (pixels)
          (bkg = bkg_pi.fits)     Background PI spectrum file
       (bgroup = 10)              Min counts for PI group
      (geompar = geom)            Parameter file for Pixlib Geometry files
       (random = 0)               random seed (0 use time)
      (verbose = 0)               Debug Level(0-5)
      (clobber = no)              Clobber existing file
         (mode = ql)              
    

History

16 Dec 2004 updated for CIAO 3.2: default value of bgroup parameter is changed to 10
12 Dec 2005 updated for CIAO 3.3: default value of dmextract error and bkgerror parameters is "gaussian"
01 Dec 2006 reviewed for CIAO 3.4: no changes
24 Jul 2007 improved quality of images
23 Jan 2008 updated for CIAO 4.0: filename and screen output updated for reprocessed data (version N003 event file)
24 Jun 2008 updated image display to place figures inline with text
12 Jan 2009 updated for CIAO 4.1: updated source position based on version N003 event file; added example of getting source position from a catalog
17 Jul 2009 added a link to the Extract a Spectrum from the ACIS Readout Streak thread
04 Feb 2010 updated for CIAO 4.2: changes to the ds9 region file format menu
13 Jan 2011 reviewed for CIAO 4.3: no changes
09 Jan 2012 reviewed for CIAO 4.4: no changes
03 Dec 2012 Review for CIAO 4.5; updated file version numbers;
25 Nov 2013 Reviewd for CIAO 4.6. Updated caption in Figure 5. Added example to get subarray info in the Caveat section.
16 Dec 2014 Reviewed for CIAO 4.7; no changes.
20 Dec 2016 Review for CIAO 4.9. Updated section on using dmstat to compute the centroid.
09 Aug 2021 Updated for repro5 data, CIAO 4.13, CALDB 4.9.5.
13 Jan 2022 Reviewed for CIAO 4.14. No changes.