NRAO Home  >  Green Bank  |  Wiki Topic:    GB > Software > ModificationRequest3C706
   Changes | Index | Contents | Search | Statistics | Go

SDFits Changes - Add target position and CALTYPE keywords to sdfits and other requested sdfits changes

Modification Request #3 (C07 2006)



1. Introduction

The GBT spectrometer records correlation data for both auto-correlation (correlations between the same sampler) and cross-correlations (correlations between different samplers). In analyzing the output from the GBT spectrometer in cross-polarization mode, Robishaw and Heiles (GBT mem #244) made three recommendations for changes in the sdfits tool and it's output to ease reduction of the cross-polarization data taken with the GBT. The first of the recommendations, which involves the calculation of the sdfits spectra, is implemented in ModificationRequest2C706 although they recommend one change to that MR which is described here. The other two requests are handled here. Some additional recommendations have arisen in e-mail conversations with Robishaw. We also include one long standing sdfits request in this MR.

2. Background

These requests are from the Robishaw and Heiles GBT memo 244 The Proper Production of Full-Stokes Spectra Using the Fully-Functioning Full-Stokes Mode of the GBT Spectrometer:

  1. In the current SDFITS, the requested source position are not stored in SDFITS. This is a huge problem for any observing that uses position offsets. For example, for the Spider scan type, the user specifies a source, say 3C286, and the source’s position in the specified equinox is tracked. As this is happening, the telescope is driven through the source position in such a way as to create a straight line in a specified reference frame. Now, in order to analyze the polarized beam properties, we need to calculate the offsets in azimuth and elevation from the source position. However, all that SDFITS provides is the telescope’s current pointing direction; we cannot calculate the offsets because the source position is not provided. This is not peculiar to the Spider scan: many people make maps in an offset mode.
  2. In the current SDFITS, there is no indication of whether the high or low cal is used. We live and die by whether the high cal is set since we do not rely on the winking cal. We would really prefer if a binary keyword named HIGH CAL were stored in SDFITS. This can be set based on the value of the HIGH CAL header keyword of the IF instrument FITS file. It’s certainly been the case that we have accidentally observed with the low cal set. It might be true that we have access to the band-averaged cal value stored in the variable TCAL in SDFITS, but to know whether the high cal was set for any receiver based solely on this value would require a priori knowledge of what the typical values of the high cal are as a function of frequency; for instance, when observing at the high-frequency end of X band, the high-cal temperatures are not very much larger than the low-cal temperatures: how would we know from the TCAL value alone whether the high cal was set? Moreover, the band-averaged cal temperature might not be an appropriate value for a particular observing method and the user might wish to access the cal tables directly; in this case, we would need to know whether the high cal was set.

3. Requirements

These cover additional details revealed through e-mail exchanges with Robishaw in addition to the primary points raised in the Robishaw and Heiles memo.

  1. The GO FITS values for the target position need to be added. This should be generalized to use the target position in whatever form that it appears in the GO FITS file (e.g. GLON, GLAT). A separate MR describes a fix to a problem with the RA as stored in the GO FITS files written by Turtle also noticed by Robishaw and Heiles. The MR described here will be implemented assuming that that other MR has also been implemented. For tracking scan and for an spider scan, the GO FITS value for the target position is probably the source position. For a set of mapping scans, it may be the center of the region being mapped. "Target" seems like a more comprehensive word than "source" to describe the positions found in the GO FITS files.
  2. It must be possible to recover the value of the HIGH_CAL keyword from the SDFITS file. Other receivers have more complicated cal options (e.g. the Ka receiver has 3 possible options for firing the noise diodes). So, we will use a string keyword named CALTYPE to represent this information. The only recognized values at this time will be "HIGH" and "LOW" corresponding to the value of the HIGH_CAL column in the IF_FITS file (1 corresponds to "HIGH" anything else corresponds to "LOW"). A value of "HIGH" means that the high cal was use and a value of "LOW" means the high cal was not used. For any given switching state, the existing value of CAL should be used to determine whether the cal was firing for that row in the SDFITS file.
  3. ModificationRequest15C306 describes how the lag dropouts are handled and optionally "fixed". The original implementation treated the zero-lag and the low (<1024) lags in the cross-correlation case differently from the auto-correlation. Robishaw and Heiles have requested that they be treated the same.
  4. A "-timestamp" argument will be added to sdfits. This is necessary to help deal with inadvertent duplicate scan numbers within the same project directory. Currently, there is no way to avoid filling all data from all scans with the same scan number. If the scan number is reset during an observing session (as has happened at least once to Robishaw and Heiles) then it is awkward to fill the data from just one scan or to append new data without also getting a second copy of the old data. It would be useful if a range of timestamps could be entered. Timestamps here will only be used to compare against the timestamp encoded in the raw file names for each scan. They will not be used to select data from within a given scan. This is the same usage that the TIMESTAMP field has in the GBTIDL data container and selection.
  5. The OBSID will be added to the sdfits index. This value is already present in the sdfits files. A user has requested that this be added to the index so that selection can be done based on this value (GBTIDL bug number 1531901).
  6. The target position should also be added to the index so that selection can be done on those quantities using the same format as used for the existing LONGITUDE and LATITUDE fields.
  7. The documentation for the sdfits tool needs to be improved. A complete description of how sdfits arrives at each value in the output SDFITS file must be included in that improved documentation. Failure to fully finish the documentation improvements should not delay the release of the code changes described here if they are ready before the documentation work is done.

Both CALTYPE and the source position items need to also be available in the GBTIDL data container. GBTIDL will also need to be modified to understand and, as necessary, re-generate the index file with the two changes described here. The GBTIDL changes are described in ModificationRequest8C706.

4. Design

4.1 GO FITS Position Info

The position information recorded in the GO FITS file may be a source position or a center of a mapping region. The phrase "target position" seems more appropriate here than "source position". That usage is also consistent with that in the GO FITS file documentation. In order to fully convey that information, the SDFITS file must contain the longitude and latitude of the target position, an indication of the coordinate system, and possibly also an EQUINOX to fully describe that coordinate system. Indications are that the coordinate system and equinox found in the GO FITS file is equivalent to that used for the antenna positions already stored in the output SDFITS file. So, the only missing information is the actual target position. The information from the GO FITS file is gathered in ScanData.py. The target longitude and latitude positions need to be gathered and made available to the SDFITSWriter.py code. Checks should be added to make sure that the coordinate system and equinox found in the GO FITS file match that found Antenna FITS file for the MAJOR and MINOR columns and a warning printed out if they are not the same. The following new columns will be added to the SDFITS file:

4.2 CALTYPE column for SDFITS

A CALTYPE column will be added to the output SDFITS. The existing PortTable.py code has methods to determine the HIGH_CAL value by sampler name (bank and port). That simply needs to be used in SDFITSWriter.py in filling this column. The code should check that the HIGH_CAL value is the same for both samplers in the cross-correlation case and a warning printed out if they are not. If HIGH_CAL is 1 then then value of CALTYPE is "HIGH" otherwise it is "LOW".

4.3 Cross-correlation and bad-lags

The cross-correlation specific code in the bad-lags fix will be altered from the aips++ filler (GBTACSTable::checkForDiscontinuities) and the sdfits filler (gbt/lib/spectrometer/src/VanVleck.cpp::checkForDiscontinuities). The code will still look for bad 1024-lag blocks in the first 1024-lags, but when found, it will mark the entire result as bad and not attempt to "fix" the bad lags. This is similar to what is done in the auto-correlation case. In the auto-correlation case, the zero-lag must be tested to determine if it is within the expected limits. If it is not, then the van Vleck correction would fail, mathematically, if that zero-lag were used. In that case, the entire auto-correlation result is replaced with the blanked value (not a number, NaN). The fixbadlags code assumes, in the auto-correlation case, that if the zero-lag is within the expected limits that the entire first 1024-lags are also good. Since the zero-lag in the cross-correlation case does serve the same role in the van Vleck correction, it is not tested. So, the equivalent test in the cross-correlation case is to look for an offset in the first 1024-lags as described in the previous fixbadlags MR. This code will now be altered so that instead of attempting to fix those bad lags the entire cross-correlation result will be replaced with the blanked value if the first 1024-lags are identified as bad. This test will be done in all cases (as is the auto-correlation test). When a log file is produced, this information will be logged to that file to indicate that bad data was found but not fixed.

4.4 Timestamps and Scan Numbers

A new -timestamp argument will be recognized by sdfits. This argument needs to work with -scans (when supplied) to limit the actual scans used to only those that satisfy this new argument (when not supplied, all scans subject to the optional -scans argument will be used). The syntax is described below. This will require changes in a number of locations since the current code simply uses scan number to step through the data. Instead, the timestamp should be used throughout where scan number is used now. The user will still refer to items by scan number through the -scans argument but internally each scan number needs to be converted to one (or more) timestamps and the timestamps need to be used to process the data from each scan. GFM also gets confused when duplicate scan numbers are present. The listing of scans is correct on the left, but when a user selects a scan that appears more than once, the display shows data from the first instance of that scan number. The changes needed for sdfits to use the -timestamp argument should be directly usable by GFM to eliminate that confusion.

We will now describe the changes needed, organized by API and Applications:

4.5 Index File Additions

The following fields will be added to the index: OBSID, TRGTLONG, and TRGTLAT. There must be enough characters in each index column to preserve the precision of each value using what format as use for the existing LONGITUDE and LATITUDE fields.

5. Deployment Checklist

6. Test Plan

6.1 Internal Testing

6.2 Sponsor Testing

6.3 Integration/Regression Tests


Signatures

APPROVED: I acknowledge that my request is fully contained in this MR, and if the SDD delivers exactly what I specified, I will be happy.

ACCEPTED: I acknowledge that I have validated the completed code according to the acceptance tests, and I am happy with the results.

Written DONE - KarenONeil - 02 Nov 2006
Checked DONE - PaulMarganian - 03 Nov 2006
Approved by Sponsor DONE - KarenONeil - 03 Nov 2006
Approved by CCC DONE - AmyShelton - 01 Dec 2006
Accepted/Delivered by Sponsor DONE - KarenONeil - 23 Feb 2007

Symbols:


CCC Discussion Area

-- KarenONeil - 16 Oct 2006

Attachment: sort Action: Size: Date: Who: Comment:
ProjectAPIOnly.jpg action 22117 29 Dec 2006 - 21:06 PaulMarganian  
ProjectInitSeq.jpg action 53739 11 Jan 2007 - 21:05 PaulMarganian  

Topic ModificationRequest3C706 . { Edit | Attach | Ref-By | Printable | Diffs | r1.30 | > | r1.29 | > | r1.28 | More }
Revision r1.30 - 23 Feb 2007 - 11:16 GMT - KarenONeil Content copyright © 1999-2007 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.