WIRE ACS Data Processing Software


Introduction

Perl script ACSdataproc.pl computes improved estimates for master-frame FITS keywords CRVAL1, CRVAL2, and CROTA2 by ACS data averaging. In the DA pipeline, this software can be run after the stacker but prior to the coadder, so that the improved values can be propagated to the coadd images. The software uses as inputs the image registration data that are listed in the offset file computed by the stacker. It also requires FITS keyword values for the master and input frames, which are read from the FITS file headers, and were originally derived from the ACS data.

The software optionally modifies CRVAL1, CRVAL2, and CROTA2 in the headers of specified FITS files with the improved estimates. Thus, the software can also be executed after the coadder, in which case, the FITS headers of the 12-µm and 25-µm coadd images can be post-updated with better absolute pointing coordinates.

Description

The sofware requires the filename of the stacker offset file of interest; this must be specified on the command line. The pathname may also be included with the filename.

The algorithm employed by the software is described as follows:

  1. Read and store offset file data. This includes frame filenames (along with their pathnames), rotational center coordinates, x and y offsets, rotation angle, and x and y NLSQ-fit standard deviations. The inverse of the sum of the squares of the two latter quantities are used as weights in computing weighted averages and standard deviations of estimates of master-frame CRVAL1, CRVAL2, and CROTA2 values from input-frame data. Master-frame CRVAL1, CRVAL2, and CROTA2 values are included in the averaging with a default weight of 200 (unless overridden in the offset file).

  2. Read CRPIX1, CRPIX2, CRVAL1, CRVAL2, CDELT1, and CDELT2 from the FITS header of the current frame. A FORTRAN code called readfitsheader.f does this job. It assumed that CDELT1 and CDELT2 are the same for master and input frames, alike; an error message results otherwise.

  3. For a given input frame, the master-frame reference point (CRPIX1, CRPIX2) is transformed to the input frame's image reference frame using the image registration data from the offset file. It is assumed that the image registration data have been derived from source positions that have been corrected for WIRE image scale and distortion.

  4. The FITS keyword values for the input frame are used with FITS library software (the driver used is xytolonlat3.f) to convert the transformed master-frame reference point to equatorial coordinates (RA, Dec). Notice that these absolute coordinates are based on the ACS data of the current frame, rather than the master frame -- as well as the image registration data.

  5. The resulting RA and Dec values, which are estimates of CRVAL1 and CRVAL2 of the master frame, are averaged. CROTA2 of the input frames, after correction for rotation from the master frame, and for the convergence angle of the meridians in the TAN projection (which depends on the declination), become estimates of CROTA2 of the master frame and are also averaged. The weighted averages of these quantities are the improved values that the software computes.

  6. Account of angle wrap-around is taken for the averaged quantities. It is done explicitly for CROTA2 by shifting it into the appropriate angular range. It is done for CRVAL1 and CRVAL2 by averaging after direction-cosine matrix transforming to a point near the celestial equator and right ascension of -90 degrees; the resulting averages are inverse transformed prior to reporting.

    The software is now under both CVS version control (/proj/wire/cvsroot/da/russ/acs), and make control (makefile.p-bin). The executables have been delivered to /proj/wire/ops/bin. The source codes are located in /proj/wire/russ/acs.

    Required and Optional Inputs

    The following is a list of the required inputs for ACSdataproc.pl:

    1. Filename of an offset file. Pathname is required if source and current directories are different.
    2. Pathnames and filenames of master and input frames.
    3. Image registration data.
    4. Fits keyword values of master and input frames.

    The pathnames and filenames of master and input frames are read from the offset file.

    The image registration data are read from the offset file, and include x and y offsets, and rotation angle between the master frame and associated input frames, and associated coordinates of the rotational center.

    The FITS keyword values of master and input frames are read from the frames themselves. The image data in these files are not used.

    A sample offset file is given below:

    |frame                                                                          |ncol|nlin|nmat|  xcen|  ycen|    zoff|   theta|    xdel|    ydel| xmin| xmax| ymin| ymax| xsig| ysig|
    | c										|  i |  i |  i |    r |    r |      r |      r |      r |      r |   r |   r |   r |   r |   r |   r |
    /stage/wire-pit/tim/pipe/reduce//sws301500103                                     128  128   18   0.00   0.00    0.000    0.000    0.000    0.000     0   129     0   129 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500104                                     128  128   18   0.00   0.00    0.000    0.040   10.430    3.740    10   140     4   133 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500105                                     128  128   18   0.00   0.00    0.000    0.080    7.260   16.470     7   136    16   145 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500106                                     128  128   17   0.00   0.00    0.000    0.100  -16.870   -5.910   -17   112    -6   123 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500107                                     128  128   17   0.00   0.00    0.000    0.080   -3.020   14.970    -3   126    15   144 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500108                                     128  128   19   0.00   0.00    0.000    0.180   -2.760    6.360    -3   127     6   135 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500109                                     128  128   19   0.00   0.00    0.000    0.020   -1.210   17.390    -1   128    17   146 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500110                                     128  128   19   0.00   0.00    0.000    0.050   -0.580   -1.900    -1   129    -2   127 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500203                                     128  128   24   0.00   0.00    0.000   -0.865   14.753  -16.336    13   144   -16   115 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500204                                     128  128   24   0.00   0.00    0.000   -0.795    9.167  -16.650     7   138   -17   114 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500205                                     128  128   25   0.00   0.00    0.000   -0.855    5.562    6.868     4   135     7   138 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500206                                     128  128   21   0.00   0.00    0.000   -0.925  -15.780    9.466   -18   113     9   141 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500207                                     128  128   22   0.00   0.00    0.000   -0.855  -22.463  -18.228   -24   107   -18   113 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500208                                     128  128   27   0.00   0.00    0.000   -0.905   10.943  -11.723     9   140   -12   119 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500209                                     128  128   27   0.00   0.00    0.000   -0.845   14.369   -7.460    12   143    -7   123 0.000 0.000
    /stage/wire-pit/tim/pipe/reduce//sws301500210                                     128  128   20   0.00   0.00    0.000   -0.895  -11.685   16.439   -14   117    16   147 0.000 0.000
    \#SUMRY: #frames= 160  master= 1    maxdx= -24.1  maxdy= -24.2
    maxdtheta=-2.2 
    
    

    The table below describes the available command-line inputs. Note that only the first is required.

    Command-line input Definition
    -indat or -ind path and file name Offset file specification. Required.
    -outfits or -outf
    /path/FITSfilename1,/path/FITSfilename2,...
    FITS files whose headers are to be modified. No files are modified if this option is omitted. Multiple files are modified if specified with comma-separations (no spaces).
    -verbose or -v Verbose mode. Default is off.
    -test Execute in test mode? Default is no test mode. This switch sets the verbose switch, and causes image registration data to be derived from ground truth, instead of being read from the offset file (see outputs below of cases with and without the test switch invoked).
    -execPath or -xp path Pathname for the binaries used by ACSdataproc.pl.

    Outputs

    The outputs are improved values of CRVAL1, CRVAL2, and CROTA2 for the master frame, their standard deviations, and the differences between the input and improved values.

    The software has been recently upgraded to output quaternions that correspond to the initial and final CRVAL1, CRVAL2, and CROTA2 values, as well as delta quaternions that describe the rotation from initial to final states. The delta quaternions computed by this code are used by the WIRE boresight-calibration software to get more accurate star-tracker quaternions. This upgrade is not reflected in the sample outputs given below.

    Usage and Sample Outputs

    Example of how to execute ACSdataproc.pl for normal use:

         ACSdataproc.pl -ind /wire/pit/tim/pipe/reduce/zws301500120.of -outf out1.fits,out2.fits
    

    The corresponding output is

    ACSdataproc.pl version $Id: ACSdataproc.pl,v 1.1 1997/12/10 20:46:56 laher Exp $  update Wed_1997/12/10(344)_12:46:56 , PID=13485
    Date/time: Wed_1997/12/10(344)_12:53:13   PCPU: 1.04/0.21/2  CCPU: 0.05/0.04
    
    
    Named parameters for ACSdataproc.pl:
      indat = /wire/pit/tim/pipe/reduce/zws301500120.of; 
      outfits = out1.fits,out2.fits; debug = undef; execpath = undef; 
      verbose = undef; test = undef; log = undef; 
    
    Input FITS keywords for master frame /stage/wire-pit/tim/pipe/reduce//sws301500103:
       CRVAL1 (degrees) = 147.42259456010
       CRVAL2 (degrees) = 53.947477393860
       CROTA2 (degrees) = 0.97267680555560
    
    Improved FITS keywords for master frame /stage/wire-pit/tim/pipe/reduce//sws301500103:
       CRVAL1 (degrees) = 147.422766167163
       CRVAL2 (degrees) = 53.9474168679547
       CROTA2 (degrees) = 0.962519976562507
    
    Standard deviations of improved FITS keywords:
       Sigma for CRVAL1 (degrees) = 0.000124447839467292
       Sigma for CRVAL2 (degrees) = 0.000111011898470709
       Sigma for CROTA2 (degrees) = 0.0364872818376063
    
    Error check for improved values:
       Error in CRVAL1 (arcseconds)                         = 0.617785426118189
       Error in CRVAL2 (arcseconds)                         = -0.217893258968616
       Error in linear distance (arcseconds)                = 0.423875437980294
       Error in CROTA2 (arcseconds, 0.39 deg. from rot cen) = -0.248178150488088
    
    
    Modifying CRVAL1,CRVAL2, and CROTA2 in header of out1.fits.
    
    * * CROTA2 has changed by more than 1%.
    
    Modifying CRVAL1,CRVAL2, and CROTA2 in header of out2.fits.
    
    * * CROTA2 has changed by more than 1%.
    
    
    End of ACSdataproc.pl status 0, PID=13485
    Date/time: Wed_1997/12/10(344)_12:54:35   PCPU: 2.29/1.76/84  CCPU: 21.31/15.39
    
    
    

    For this case, although no ACS errors were injected into the simulated WIRE data, the images have been registered using NLSQ fits to fuzzy-extracted source positions. This process in itself introduces small errors into the calculation; however, spot testing shows that the errors are typically less than an arcsecond.

    Example of how to execute ACSdataproc.pl with the test switch invoked, and in a mode where FITS-file keyword values are not modified with the improved values (due to omission of the -outf option):

         ACSdataproc.pl -ind /wire/pit/tim/pipe/reduce/zws301500120.of -test 
    

    The corresponding output is

    ACSdataproc.pl version $Id: ACSdataproc.pl,v 1.1 1997/12/10 20:46:56 laher Exp $  update Wed_1997/12/10(344)_12:46:56 , PID=13972
    Date/time: Wed_1997/12/10(344)_12:57:34   PCPU: 1.02/0.23/2  CCPU: 0.05/0.09
    
    
    Named parameters for ACSdataproc.pl:
      indat = /wire/pit/tim/pipe/reduce/zws301500120.of; outfits = undef; 
      debug = undef; execpath = undef; verbose = undef; test = 1; log = undef; 
    
    Input FITS keywords for master frame /stage/wire-pit/tim/pipe/reduce//sws301500103:
       CRVAL1 (degrees) = 147.42259456010
       CRVAL2 (degrees) = 53.947477393860
       CROTA2 (degrees) = 0.97267680555560
    
    Improved FITS keywords for master frame /stage/wire-pit/tim/pipe/reduce//sws301500103:
       CRVAL1 (degrees) = 147.422594557496
       CRVAL2 (degrees) = 53.9474773958592
       CROTA2 (degrees) = 0.972676805555602
    
    Standard deviations of improved FITS keywords:
       Sigma for CRVAL1 (degrees) = 0
       Sigma for CRVAL2 (degrees) = 3.0357833849754e-08
       Sigma for CROTA2 (degrees) = 0
    
    Error check for improved values:
       Error in CRVAL1 (arcseconds)                         = -9.37418462854112e-06
       Error in CRVAL2 (arcseconds)                         = 7.19716126695857e-06
       Error in linear distance (arcseconds)                = 9.06841336177018e-06
       Error in CROTA2 (arcseconds, 0.39 deg. from rot cen) =
       4.34045857529963e-14
    
    
    
    End of ACSdataproc.pl status 0, PID=13972
    Date/time: Wed_1997/12/10(344)_12:58:45   PCPU: 2.72/1.85/73  CCPU: 21.14/14.41
    
    
    

    Note that the resulting errors are extremely small for this second case (cf. the first case). This is because no ACS errors were injected into the simulated WIRE data (as in the first case), and, with the test switch invoked, ground-truth data are used to register the images.

    Benchmark Results

    The software processes about 2 frames per second on a Sun Ultra 1.


    Last revised: February 23, 1998

    Software developer: Russ Laher (laher@ipac.caltech.edu)

    URL: http://spider.ipac.caltech.edu/staff/laher/ACSdataproc.html

    Return to Home Page