Last modified: 7 Feb 2022

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

Correct Events for Aspect Periscope Drift

CIAO 4.16 Science Threads


Overview

Synopsis:

Thermal cycling on the spacecraft can result in an apparent temporal drift of the sky position of an X-ray source during an observation. This appears as a drift of up to about 0.5 arcsec in the X-ray event sky coordinates over time. Because of the thermal variation time-scales, this effect is usually most prominent in long observations (more than ~50 ksec).

As of DS 8.4, a drift correction is applied to the aspect solution using the periscope gradients telemetry in the standard data processing pipeline. However, temporal drifts have continued to increase with thermal variation of the spacecraft; therefore, the Aspect team suggests that to accomplish science related to sub-arcsecond source structure, users should follow this thread to correct residual drift induced by the periscope. This requires a relatively bright, on-axis source (within a few arcminutes off-axis angle) to perform a "self-calibration" of the aspect solution.

The correct_periscope_drift script returns plots of the fits of the drift in the Aspect Camera Y- and Z-angle and new aspect solution file with offsets updated to include drift corrections. This new aspect solution may be applied with the chandra_repro (via acis_process_events or hrc_process_events) script to correct the sky positions in a new evt2 file.

Purpose:

  • To aid in determining the drift during an observation.

  • Help evaluate the goodness-of-fit to the data and to determine if applying the correction will have value.

Related Links:

Last Update: 7 Feb 2022 - Review for CIAO 4.14. Updated for Repro5 and CALDB 4.9.6


Contents


Get Started

Download the sample data: 17128 (3C 15)

In this thread, we assume that we work in the same directory, making references to paths relative to the working directory.

For gratings data, only use events around the zeroth-order position. Retaining only the zeroth-order and unsorted gratings events can be done by applying the "[tg_m=0,Null]" filter on the events file used with correct_periscope_drift to produce the corrected aspect solution.


View and Select a Region to Use for the Autocorrection.

While selecting an isolated, bright point source in a field is trivial, picking an appropriate on-axis source—particularly in a crowded field—to use for the drift correction may take some work. celldetect is one rough method to view and select a source.

unix% punlearn celldetect
unix% celldetect infile= 17128/primary/acisf17128N004_evt2.fits.gz outfile=mysrc.fits fixedcell=12
[TIP]
New in CIAO 4.11

The way in which users supply information to celldetect about the size of the PSF has changed in CIAO 4.11. In previously releases, celldetect obtained information about the size of the PSF from the hidden psftable parameter. In CIAO 4.11, users must supply the PSF size information via the new psffile. This is illustrated in the Running celldetect thread by using the mkpsfmap tool. For this ACIS observation we could do something like:

unix% mkpsfmap 17128/primary/acisf17128N004_evt2.fits.gz my.psfmap energy=1.4967 ecf=0.8 spectrum=none
unix% celldetect ... fixedcell=0 psffile=my.psfmap maxlogical=8192 ....

However, in this example, we have chosen to ignore the variable size of the Chandra PSF and instead to use a fixed detect cell size of 12 pixels. This is small enough to detect on-axis point source in a sparse field and large enough to detect some source further off-axis. As the objective of this thread is use an on-axis source, this is a reasonable choice for this parameter.

unix% punlearn dmsort
unix% dmsort mysrc.fits"[SRCLIST]" key=-snr outfile=mysrc_snrsort.fits

unix% dmlist mysrc_snrsort.fits"[cols net_counts,x,y,snr,r][net_counts=500:]" data 

 
--------------------------------------------------------------------------------
Data for Table Block SRCLIST
--------------------------------------------------------------------------------
 
ROW    NET_COUNTS           POS(X,Y)                                 SNR                  R[2]
 
     1               6013.0 (     4107.9815646040,     4100.3877845463)        73.2762756348 [        3.4674890041         2.9725918770]

From the celldetect source list, we are looking for a high count, high SNR source, relatively close to the optical-axis (which for ACIS is defined at (x,y)=(4096.5,4096.5). This source will do. We select a radius greater than the larger reported value of R of the celldetect shape, 6 ACIS pixels in this example, and view it in DS9.

unix% ds9 17128/primary/acisf17128N004_evt2.fits.gz \
? -bin about 4107.9815646040 4100.3877845463 \
? -scale log \
? -regions command "circle 4107.9815646040  4100.3877845463 6 # color=red" \
? -zoom 8

Figure 1: Source Region for ObsID 17128

[source regions for ObsID 17128]
[Print media version: source regions for ObsID 17128]

Figure 1: Source Region for ObsID 17128

The bright source detected by celldetect highlighted by a red circle with a 6-pixel radius.

The source looks point-like and is basically contained within the specified region.


Running the Correction Script Using the Source for Reference Events

Set the source for the script and other input and output files as desired.

unix% punlearn correct_periscope_drift

unix% pset correct_periscope_drift x=4107.9815646040 y=4100.3877845463 radius=6

unix% pset correct_periscope_drift infile= 17128/primary/pcadf17128_002N001_asol1.fits.gz
unix% pset correct_periscope_drift evtfile= 17128/primary/acisf17128N004_evt2.fits.gz
unix% pset correct_periscope_drift outfile=driftcorr_asol1.fits
unix% pset correct_periscope_drift corr_plot_root=demo_corr

unix% correct_periscope_drift mode=h

The script will write out an updated aspect solution to driftcorr_asol1.fits as requested by the outfile parameter and will save the plots of the fits into the working directory.

[NOTE]
Note on Coordinate Systems

The correction is performed by directly updating the dy and dz values in the aspect solution. The dy/dz values are aligned with the Aspect Camera Y and Z axes, and therefore, to fit the X-ray events, this script transforms the event coordinates into positions in the Aspect Camera frame, and then independently fits offsets in those Y and Z axes. Note that the positions in this frame are abbreviated 'yag' and 'zag' in the fit and data plots output by the script.

Running: correct_periscope_drift
  version = 6 Feb 2020
with parameters:
  infile=17128/primary/pcadf17128_002N001_asol1.fits.gz
  evtfile=17128/primary/acisf17128N004_evt2.fits.gz
  outfile=driftcorr_asol1.fits
  verbose=2
  and ASCDS_INSTALL is /export/miniconda/envs/ciao-4.14
------------------------------------------------------------
Fitting a line to the data to get reduced stat errors
Fitting a polynomial of degree 2 to the data
Fitting a line to the data to get reduced stat errors
Fitting a polynomial of degree 2 to the data
------------------------------------------------------------
Fit results
	Events show drift range of 0.40 arcsec in yag axis
	Max absolute correction of 0.23 arcsec for yag axis
	Events show drift range of 0.05 arcsec in zag axis
	Max absolute correction of 0.03 arcsec for zag axis
------------------------------------------------------------
Writing out corrected aspect solution file to driftcorr_asol1.fits

You *must* review the following plots before using this correction:
	demo_corr_fit_yag.png
	demo_corr_data_yag.png
	demo_corr_fit_zag.png
	demo_corr_data_zag.png

Adding HISTORY record for correct_periscope_drift (6 Feb 2020) 
Adding history to driftcorr_asol1.fits
Running tool dmhistory using:
>>> dmhistory driftcorr_asol1.fits correct_periscope_drift action=put

Figure 2: The Periscope Drift

[plot of periscope drift]
[Print media version: plot of periscope drift]

Figure 2: The Periscope Drift

The periscope drift of the observation is plotted. The plots on the left are the angular drift of the mean aspect camera frame axes over the course of the observation, with the drift particularly apparent in the non-linear fit to the mean yag-axis.


Apply the New Aspect Solution and Verify the Outputs

To avoid problems and force chandra_repro to pick up the corrected aspect solution, first move the original aspect solution out of the primary directory and rename it, while copying the new aspect solution to the primary data directory.

unix% mv 17128/primary/pcadf17128_002N001_asol1.fits.gz 17128/pcadf17128_002N001_asol1.fits.gz.ORIG
unix% cp driftcorr_asol1.fits 17128/primary/pcadf557756838_driftcorr_asol1.fits
unix% chandra_repro indir=17128 check_vf_pha=yes

Since this observation was made in the VFAINT data mode, the check_vf_pha parameter is set.

Note that the duration of the event processing task in chandra_repro scales with the number of events. The long observations with bright sources for which this script is useful may take more than 30 minutes to run on a modern CPU.

Verifying that the corrections to the reprocessed events file can be checked by re-running the correct_periscope_drift script, recycling the previously used x, y, and radius parameters:

unix% pset correct_periscope_drift evtfile=17128/repro/acisf17128_repro_evt2.fits
unix% pset correct_periscope_drift infile=17128/primary/pcadf557756838_driftcorr_asol1.fits
unix% pset correct_periscope_drift outfile=already_fixed.fits
unix% pset correct_periscope_drift corr_plot_root="already_fixed"

unix% correct_periscope_drift mode=h

Running: correct_periscope_drift
  version = 0.2
with parameters:
  infile=17128/primary/pcadf557756838_driftcorr_asol1.fits
  evtfile=17128/repro/acisf17128_repro_evt2.fits
  outfile=already_fixed.fits
  verbose=2
  and ASCDS_INSTALL is /export/CIAOT/ciaot_install/20181205/ciao-4.11
------------------------------------------------------------
Fitting a line to the data to get reduced stat errors
Fitting a polynomial of degree 2 to the data
Fitting a line to the data to get reduced stat errors
Fitting a polynomial of degree 2 to the data
------------------------------------------------------------
Fit results
	Events show drift range of 0.01 arcsec in yag axis
	Max absolute correction of 0.01 arcsec for yag axis
	Events show drift range of 0.01 arcsec in zag axis
	Max absolute correction of 0.00 arcsec for zag axis
------------------------------------------------------------
Writing out corrected aspect solution file to already_fixed.fits
	To review fit see correction plots in:
		already_fixed_fit_yag.png
		already_fixed_data_yag.png
		already_fixed_fit_zag.png
		already_fixed_data_zag.png
Adding HISTORY record for correct_periscope_drift (0.2) 
Adding history to already_fixed.fits
Running tool dmhistory using:
>>> dmhistory already_fixed.fits correct_periscope_drift action=put

Looking at the plots, it's apparent that the correction has been applied to the events with.

Figure 3: Corrected Events for Periscope Drift

[plot of events corrected for periscope drift]
[Print media version: plot of events corrected for periscope drift]

Figure 3: Corrected Events for Periscope Drift

The periscope drift of the corrected events is plotted. The plots on the left of the mean Aspect Camera frame axes does not vary much over the course of the observation, verifying the corrections have been applied.


Summary

The correction and fitting routine extracts the X-ray events from the provided source region (a circle centered at the provided coordinates with the supplied radius) and converts the RA, Dec of the X-ray events into approximately Aspect Camera/PCAD frame Y and Z relative to the RA_PNT, DEC_PNT, and ROLL_PNT supplied in the event list.

We then fit two independent curves to the mean-subtracted Y and Z angle data using a Sherpa fit model. A polynomial is used as the fit model; users may specify the order of the desired polynomial as an option to the script. Advanced users may directly edit this contributed Python fitting script to use a custom model.

The Sherpa fit is then applied to the aspect solution's dy and dz columns and a new aspect solution file with those updated columns is written out.


History

01 Nov 2017 new for CIAO 4.9: original version
06 Dec 2018 Updated celldetect for changes in 4.11.
07 Feb 2022 Review for CIAO 4.14. Updated for Repro5 and CALDB 4.9.6