Frfread Manual for Versions 4.0 and Later
Introduction
Frfread is the official program which converts ASCA telemetry into FITS
format event lists and HK files. It was originally written at Pennsylvania
State University, and distributed by that institution, but as of the Fall
of 1998 is now maintained by the ASCA Data Processing Team at GSFC. All
questions, comments, and bug reports should be sent to ascahelp@athena.gsfc.nasa.gov.
Note that the Processing Team has made significant changes to the code
in version 4.0. You should read this document even if you a familiar with
earlier versions of frfread. The changes in version 4.0 are detailed in
the file changes4.html.
Obtaining Frfread
Source code for frfread is available
here.
The current (and probably final) version is 4.5.
Compiling and Installing Frfread
The frfread source code is contained in the src directory. We
do not currently provide pre-compiled binaries, so you will have to compile
the code yourself.
Requirements
You will need an ANSI C compiler, such as gcc. You will also need an up-to-date
installation of the FTOOLS. This last requirement should not be burdensome
since any in-depth ASCA data analysis requires the FTOOLS.
Compiling
Before compiling you need to edit the Makefile in the src
directory as described below. Comments in that file should help you do
this.
First, set CC to choose your C compiler. We recommend gcc,
but any ANSI-compliant compiler should work.
Then set FTOOLS to the machine-dependant
directory of your FTOOLS installation. If your FTOOLS are correctly installed
and initialized, then this will be the value of your FTOOLS
environment variable.
The basic FTOOLS libraries needed
are the FITS I/O routines in CFITSIO and the parameter (.par) file I/O
routines in xanlib. Xanlib in turn needs a number of other FTOOLS libraries
and FORTRAN system libraries.
Next, choose a set of platform-dependant compilation options. By setting
MACHINE, FTOOLSLIB, and FTOOLSINC.
We have tested frfread under Sun/Solaris and Dec Alpha/OSF, and have provided
FTOOLSLIB definitions which should work for these. If you want
to compile on some other platform you may need to be a bit more creative
with the FTOOLSLIB definition.
If installing under Solaris, you may need to modify -L/opt/SUNWspro/SC3.0
to point to the correct directory for your compiler version. You can get
the correct directory name from ls -d /opt/SUNWspro/SC*.
Finally, if you are using an old (before FTOOLS 4.1 ) version of the
FTOOLS, then you will need to uncomment the definition:
FTOOLS4_0=-DOLD_FITSIO.
This is to accomodate older versions of CFITSIO which do not have the
fits_report_error function.
After making these modifications the program should compile simply by
typing make.
Installing
Before installing you need to set the Makefile BIN variable
to the directory where you want to install frfread. The installer must
be able to create files in this directory.
We recommend that you set BIN to the FTOOLS bin directory.
This is the simplest option for users who are correctly configured to run
the FTOOLS. The reason is that frfread checks the SYSPFILES and
PFILES environment variables in order to find its .par file. With
a normal FTOOLS setup, these environment variables point to the FTOOLS
bin directory.
Another option would be to install frfread elsewhere, but then copy
frfread4.par to the FTOOLS bin directory. If this is not possible, we provide
a borne shell script run_frfread in the frfread bin directory
This script resets the environment variables before running frfread, without
affecting the calling shell.
After setting the installation directory, type make install.
Running Frfread
The name of the frfread executable is "frfread4". Before version 4.0 it
was possible to build either a GUI version of frfread, "frfread", or a
command-line driven non-GUI version "frfreadng". With frfread versions
4.0 and later, the GUI is no longer available and "frfread4" behaves most
like "frfreadng". The name of the executable was changed to emphasize the
differences between frfread4 and frfreadng and to avoid confusion with
the older frfread.par.
Parameters
Frfread4 uses the same XPI parameter file interface library as the FTOOLS.
Therefore, parameters may be supplied on the command line or when prompted
using the same syntax as the FTOOLS. Previous versions of frfread used
an FTOOLS/IRAF-style parameter file but did not employ the full XPI interface.
The following parameters are available:
-
frf_file - This is the name of the input FRF telemetry file. Frfread
can only read one telemetry file at a time, and must be run once for each
FRF file in a given sequence. Note that frfread can only read FITS-wrapped
FRF format files. Quick look format files, and pre-launch telemetry formats
are no longer supported. To read these files you should use frfread 3.032.
Note previous versions of frfread used a different method for specifying
the input file(s).
-
origin - This is the value of the "ORIGIN" keyword in the output
FITS file headers. The automated processing at GSFC sets this to "GSFC".
Other sites may wish to use a different value to distinguish their files.
The value of this keyword is not currently used by the analysis software.
-
object - This is the value of the "OBJECT" keyword in the output
FITS file headers. This should be set to the name of the target. Some software
such as ximage reads this value to use as a label.
-
seqpi - This is the value of the "OBSERVER" keyword in the output
FITS file headers. The automated processing at GSFC sets this to the name
of the PI for this sequence. The analysis software does not currently read
this keyword, but it can be used to mark files which may be shared with
others.
-
ranom and decnom - This is the value of the "RANOM" and "DECNOM"
keywords in the output FITS file headers. This gives the "nominal" pointing
of the observation.
-
hkbuffer, gisbuffer, sisbuffer, gtibuffer (all
hidden) - These parameters set the sizes (in rows) of various buffers used
to output data efficiently. The general user should not have to adjust
these parameters.
-
bin_size (hidden) - A number of HK parameters are written at certain
intervals regardless of whether their value has changed. This parameter
sets the length of this interval in seconds.
-
clobber (hidden) - This parameter sets whether frfread will overwrite
an existing file. Even if clobber is set to "yes", frfread will
only delete FITS files. Attempts to clobber non-FITS files or incorrectly
formatted FITS files will result in an error. Such files must be deleted
before running frfread.
-
sf_processed (hidden) - When frfread is done, it writes the number
of telemetry super frames which have been decoded. Note that this can be
less than the total number of super frames in the FRF file, since frfread
skips super frames which have been corrupted in transmission to the ground.
FITS Output
Frfread produces five Housekeeping (HK) files - one for each instrument
and one common HK file. These files are typically used as input to the
mkfilter2 FTOOL to create the filter (.mkf) file used to screen the data.
The GIS HK files may also be used by the ghkcurve FTOOL to produce monitor
count light curves.
Frfread also creates a large number of FITS event files. Each time a
minor mode changes for one of the instruments, frfread closes the current
file and opens a new one. Since minor modes tend to change a few times
per orbit (~6 kiloseconds), it is not uncommon for frfread to produce over
a hundred event files for a single observation. The standard processing
done at GSFC combines event files with identical modes to produce a more
manageable set of unfiltered (.unf) files. The FTOOL script ascascreen
-e fits will also conveniently handle the large number of files created
by frfread . Note frfread does not fill the PI, DETX, DETY, X, or Y columns.
The ascalin FTOOL must be used to do that. For more on ASCA data analysis
see the ASCA Data Reduction (ABC) Guide at http://heasarc.gsfc.nasa.gov/docs/asca/abc/abc.html.
The file names for HK files have the following form: [base name][inst]HK.fits,
where
-
[base name] is the input FRF file name with dots "." changed to
underscores "_".
-
[inst] is the instrument name: S0, S1, G2, G3, or CM.
For example, the common HK file created from frf file ft940408_1555.1729
is ft940408_1555_1729CMHK.fits.
Event file names have the form [base name][inst][index][mode][bitrate].fits,
where
-
[index] is a three digit number used to keep file names unique.
-
[mode] is the two digit code of the major mode: 01=FAINT, 02=BRIGHT,
03=FAST, 70=PH, 71=MPC.
-
[bitrate] is the bit rate H, M, or L.
For example the second SIS 1 event file generated from FRF file ft940408_1555.1729,
with BRIGHT mode and HIGH bit rate would be called ft940408_1555_1729S100202H.fits
Terminal Output
Frfread 4.0 and later is considerably more verbose than earlier versions.
You may wish to
redirect stdout to a log file. In general, messages written to stdout
do not indicate serious problems, and messages to stderr, indicate errors
which may affect the data.
Telemetry Corruption and Dropouts
ASCA telemetry is often garbled or lost in transmission to the ground.
The telemetry format does not include a checksum, so there is no foolproof
way to detect corrupted sequences. Instead, frfread checks a number of
telemetry bytes with predictable values. If any of these bytes is corrupted,
the entire super frame is ignored. Typically less than 1% of all super
frames in a given FRF file are rejected this way.
The following messages to stdout report instances of telemetry corruption.
Most indicate that a super frame has been ignored.
-
Dropping SF %d which overlaps by %g seconds
indicates a super frame whose start time occurs before the end time
of the previous super frame.
-
Dropping SF %d which is %g seconds out of synch
indicates the current super frame is not an integer multiple of two
seconds after the previous super frame.
-
Dropping SF %d with invalid bit rate %d
indicates more than one of the three bit rate indicator bits is turned
on.
-
Dropping SF %d with inconsistent datamode %d/%d
indicates redundant values of the data mode are not identical.
-
Dropping SF %d with corrupted frame indicator
indicates the frame indicator byte does not correctly count the frames.
-
Dropping SF %d with synch code word %d = %d not %d
indicates one of the three synch code bytes does not have the correct
value. The value of these bytes is fixed at FA, F3, and 20 in hexadecimal
notation.
-
Dropping SF %d with incorrect SIS0/1 alternation
indicates two adjacent CCD exposures from the same instrument which
are not marked by a continuation (inheritance) flag.
-
Dropping SF %d with inconsistent SIS ID
indicates redundant values of the SIS instrument ID are not identical.
-
Dropping SF %d with inconsistent SIS mode %d/%d
indicates redundant values of the SIS observation mode (FAINT, BRIGHT,
FAST, etc.) are not identical.
-
Dropping SF %d with inconsistent CCD ID %d/%d
indicates redundant values of the CCD ID are not identical.
-
Dropping SF %d with inconsistent continuation flag
indicates redundant values of the continuation (inheritance) flag are
not identical.
-
%g second gap between super frames %d and %d
indicates a piece of telemetry is missing from the FRF file.
Dropped Events
The method described above removes the most seriously corrupted super
frames, but leaves some corrupted data. Frfread also removes individual
events which appear to be corrupted. Nearly all of these are null events
which have had one or more of their zero bits switched to 1.
All dropped events are reported to stdout with one of the following
messages:
-
GIS%d coordinate error time=%.14g x=%d y=%d pha=%d ...
indicates either RAWX=0 or RAWY=0 and fewer that five of the 32 bits
in the event are equal to 1.
-
GIS%d PHA error time=%.14g x=%d y=%d pha=%d ...
indicates PHA=0 and fewer than five of the 32 event bits are equal
to 1.
-
SIS%d coordinate error time=%.14g x=%d y=%d pha=%d grade=%d
indicates RAWX<6, RAWX>426, RAWY<1, or RAWY>422.
-
SIS%d PHA error time=%.10e x=%d y=%d pha=%d grade=%d
indicates PHA>2047 for BRIGHT mode, or PHA>4095 for FAST mode.
-
SIS%d peak error time=%.14g x=%d y=%d ph0=%d ...
indicates a FAINT mode event where the central pixel does not have
the highest PHA value. This is due to corruption of one or more of the
nine PHA values, but unlike the above messages, generally signals a real
event has been dropped.
Other Messages to stdout
There are a number of other messages which may appear on stdout:
-
GTI dropped in %s, %g = %g
indicates a good time interval with start time = stop time that has
not been written to the named output file. These messages are rare.
-
Allocated more space for GTIS in %s
indicates that the number of good time intervals in a given file is
greater than the gtibuffer parameter. This does not affect the output,
but the code may run more efficiently with a larger value of gtibuffer.
-
Deleting %d events from %s (followed by a list of events)
indicates a super frame of events has been deleted from the GIS data.
You should never see this message, since it is in an unused part of the
code.
-
Warning: GIS%d bit assignment changed between %.14g and %.14g
indicates that some of the events between the indicated time intervals
may have been interpreted incorrectly by frfread. This is because changes
to the GIS event bit assignment are signaled once per super frame, but
the actual change may have occurred anywhere in the previous super frame.
Any events in the indicated interval should be treated with caution.
-
Dropped 1st C%d read after clocking change in %s
indicates frfread has ignored the first CCD readout after a clocking
mode change (e.g. 4CCD to 1CCD mode ). This is done because the first readout
is needed to clear charge accumulated in the previous mode.
-
%d of %d super frames processed
indicates the number of super frames decoded and the total number of
super frames in the FRF file. This message appears at the end of every
frfread run. The first value is also written to the sf_processed parameter.
The second number should equal the NAXIS2 keyword in the first extension
of the FRF file.
Error Messages to stderr
The following error messages are rare and probably indicate a significant
problem which could affect the data integrity. You can send questions about
these messages or report their occurance to ascahelp@athena.gsfc.nasa.gov.
-
Unusual CCD readout pattern %d %d %d %d
indicates the SIS CCD readout order has been corrupted in the telemetry.
It is safest to ignore data with this readout pattern, though in some cases
it may be possible to fix the problem. This generally only affects a small
amount of data.
-
Invalid CCDID %d in %s at %.14g
Indicates either the CCD ID value or the CCD readout order has been
corrupted in the telemetry. You should treat the corresponding data with
caution.
-
Event time %.14g occurred before the buffer for %s
indicates that the value of the hkbuffer parameter is too small. HK
events are held in a buffer where they are sorted before being written
to the output file. If the buffer is not large enough, the correct place
for an event may have already been written to the file.
-
Event %s is not in the buffer for %s
indicates that the value of the hkbuffer parameter is too small. This
message is given when an attempt was made to change the value of an HK
event which has already been written to the file.
-
Unknown instrument %d in get_raw_ccd_list
indicates an internal code error which should be reported.
-
Error: need to increase size of PH buffer
indicates an internal code error which should be reported.
-
Invalid bit rate %d in add_mode
indicates an internal code error which should be reported.
-
Invalid mode %d in add_mode
indicates an internal code error which should be reported.
-
ERROR: hk: no gis mode %d
indicates an internal code error which should be reported.
-
Superframe %d starts with an S1 image or ends with an S0 image
indicates either uncaught telemetry corruption, or an internal code
error. The affect of this error is to drop a small segment of the SIS HK
data, which probably has no serious consequences. However, this error is
unusual enough that it should be reported.
-
GIS%d event at %.14g %g seconds behind %.14g
indicates events out of time order. This is most likely because of
telemetry corruption of data with a non-zero number of GIS timing bits.
The events are written to the event file in the order which they occurred,
but one or more of their time tags has been corrupted. Note that it is
not correct to simply sort the event file. If high timing accuracy
is required, the events affected by this error should be screened out (e.g.
using xselect).
-
GTI starting at %.14g in %s overlaps previous by %g seconds
indicates an incorrect good time interval. This is probably an internal
code error and should be reported.
-
GTI error in %s, %.14g < %.14g
indicates a good time interval stop time occurring before the start
time of that interval. This is probably an internal code error and should
be reported.
-
%s (pre-launch?) telemetry format not supported
indicates the TELESCOP keyword of the FRF file is not equal to "ASCA",
indicating an incompatible telemetry format. Frfread 4.0 and later cannot
read pre-launch format telemetry. You must use frfread 3.032 to do so.
-
%d sec gap between %.14g and %.14g in SIS%d
indicates a timing error for an SIS CCD exposure. Specifically, the
current event time is not an integer multiple of 4 seconds after the previous
exposure. You should screen out the affected data if you require high timing
accuracy.
-
Warning: lost chip exposure has gone unmarked
You should never see this error since it occurs in an unused section
of code.
-
FITSIO error while...
indicates an error from one of the FITSIO library routines. The most
common causes for this are
-
The named FRF input file does not exist.
-
The disk filled up while running frfread.
-
You attempted to overwrite a non-FITS file.
If none of these have caused the error, then there may be an internal problem
which should be reported.
-
Couldn't %s parameter %s from parfile
indicates an error from the XPI parameter file library routines. Check
the frfread4.par file syntax. If this is not the cause, then report the
error.
A Note About Date Formats
Frfread 4.0 (and later versions) writes DATE-OBS and DATE-END keywords
in "yyyy-mm-dd" format. However, some of the FTOOLS before FTOOLS version
4.2 may not be able to handle this format. If possible, we strongly recommend
installing the latest version of the FTOOLS. However, since beta versions
of frfread 4.0 may be available before the release of FTOOLS 4.2, we have
provided a script old_style_dates which will convert the dates
in all the event and HK files to the older dd/mm/yy format. This script
is installed in the frfread bin directory. To run, simply invoke it in
the directory containing the frfread output. The script requires the FTOOLS
to work.
Note that the FITS standard requires that software be backwards compatible
with the old style dates. However, it also specifies that the old style
dates can only be used to represent dates between 1900 and 1999. Using
old_style_dates on post 2000 data will give incorrect results.
This manual was last revised 1998-10-15 by Edward A. Pier of the ASCA
Data Processing Team. Minor revisions 2003-06-13.