Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 25 Nov 2013

URL: http://cxc.harvard.edu/ciao/threads/acisreadcorr/

Remove the ACIS Readout Streak

CIAO 4.6 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: 25 Nov 2013 - Reviewd for CIAO 4.6. Updated caption in Figure 5. Added example to get subarray info in the Caveat section.


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.

[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 acisf01712N004_evt2.fits &
    

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

    [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 white cross is used to estimate the source location as (4088.25,4083.25).

  2. With dmstat:
    the virtual file syntax is used to find the maximum number of photons in the field. It follows that this is the source location:

    unix% punlearn dmstat
    unix% pset dmstat centroid=no sigma=no
    unix% dmstat "acisf01712N004_evt2.fits[bin sky=16]"
    EVENTS_IMAGE
        min:        0             @:        ( 8.5 8.5 )
        max:        9996          @:        ( 4088.5 4088.5 )
       mean:        1.7411842346
        sum:        456441
       good:        262144
       null:        0
    

    The source location is given as (4088.5 4088.5).

  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. After setting the celestial coordinate format to sexagesimal, the tool is run in interactive mode:

    In many cases, there will be more than one aspect solution file (pcad_asol1.fits) for an observation. All the files must be input to the tool, either as a comma-separated list or as a stack. Here we use:

    unix% cat pcad_asol1.lis
    pcadf077378077N004_asol1.fits
    
    unix% punlearn dmcoords
    unix% pset dmcoords celfmt=hms
    unix% dmcoords acisf01712N004_evt2.fits asolfile=@pcad_asol1.lis
    dmcoords>: cel 12:29:06.700, +02:03:08.60
    (RA,Dec):     12:29:06.700    +02:03:08.60
    (RA,Dec):      187.27792        2.05239 deg
    THETA,PHI            7.8"        123.95 deg
    (Logical):        4088.10       4083.00
    SKY(X,Y):         4088.10       4083.00
    DETX,DETY         4087.62       4109.69
    CHIP ACIS-S3       209.22        384.78
    TDET              4126.22       2086.78
    dmcoords>: q
    

    The source position in sky pixels is (4088.10,4083.00). 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.

[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="acisf01712N004_evt2.fits[sky=region(bkg.reg)][bin pi=1:1024:1]"
unix% pset dmextract outfile=bkg_pi.fits
unix% dmextract
Input event file  (acisf01712N004_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.

[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
pcadf077378077N004_asol1.fits

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

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.

[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.

[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.

[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.

[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 = acisf01712N004_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 = acisf01712N004_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.


Last modified: 25 Nov 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.