CDS Telemetry Software Last updated: 6 February 1995 The FITSGEN procedure is a widget-based interface to converting CDS science telemetry data into FITS files. This software is written against version 3.0 of the telemetry packet format. Telemetry processing The following routines are used to read in and organize the science telemetry. Although they are designed to be used by FITSGEN, they are applicable to other telemetry processing situations: TM_DEFINE_STRUC Defines structures used in telemetry software READ_PACKET() Read a telemetry packet TEST_SCI_PKT() Tests if packet is a science packet FORM_RASTER() Sets up the structure of a raster TEST_CURR_EXP() Tests if packet is part of the current exposure LOAD_EXPOSURE Loads exposure information into raster arrays LOAD_SCIENCE Stores science data from packet stream into array DECOMP_SCIENCE Decompress science telemetry data LOAD_DATA Loads science data into raster arrays OPEN_NEXT() Opens the next CDS science telemetry stream file OPEN_TM_FILE() Opens a stored telemetry file SPS_DECODE Decodes science process status telemetry words OPS_DECODE Decodes offset pointing system telemetry words SLITPOS_DECODE Decodes slit position telemetry words SENSOR_DECODE Decodes sun sensor telemetry words EVS_DECODE Decodes the event status byte in the telemetry VDS_PACK Packs 12-bit VDS values into 16 bit telemetry words VDS_UNPACK Unpacks 12-bit VDS values from 16 bit telemetry words VBWL_UNPACK Unpacks VBWL compressed data from the telemetry SUMWIN_UNPACK Unpacks SUMWIN compressed data from the telemetry CDS_MESSAGE Writes error messages to the log file and/or screen CDS_ATTENTION Brings a severe error to the operator's attention. The following high level routines call the above. They differ from the above in that they are not appropriate for use within an event driven environment such as the Science Telemetry Monitor (STM) program: GET_SCI_PKT() Get a science packet from the telemetry stream. FIND_RASTER() Finds the next raster header in the telemetry. READ_RASTER() Reads a complete VDS or GIS raster. READ_EXPOSURE Reads the packets making up a VDS or GIS exposure. The following software tree shows how the telemetry reading routines relate to each other. Before calling READ_RASTER, one must first use OPEN_TM_FILE and GET_SCI_PKT to open the telemetry file and point to the first science packet. READ_RASTER---FIND_RASTER---GET_SCI_PKT* |-FORM_RASTER---SPS_DECODE | \-EVS_DECODE |-GET_SCI_PKT* \-READ_EXPOSURE---GET_SCI_PKT* |-TEST_CURR_EXP |-LOAD_EXPOSURE---EVS_DECODE |-LOAD_SCIENCE |-DECOMP_SCIENCE---SUMWIN_UNPACK | |-VBWL_UNPACK | \-VDS_UNPACK \-LOAD_DATA The GET_SCI_PKT subtree occurs in several places, and has the structure: GET_SCI_PKT---OPEN_NEXT---OPEN_TM_FILE |-READ_PACKET \-TEST_SCI_PKT The CDS_MESSAGE/CDS_ATTENTION tree is called in several places in the code, and has the structure CDS_MESSAGE---CDS_ATTENTION TELEMETRY MODES: The following telemetry modes are currently defined: 0: Replay stored telemetry 1: Realtime telemetry 2: Quicklook tape recorder dumps 3: Realtime telemetry archived by ECS 4: Final distribution It is anticipated that another mode will be defined for the final distribution data on CDROM. When additional compression modes are defined, DECOMP_SCIENCE will be upgraded to support them. FITS file generation The FITSGEN and FITSGEN_EVENT widget programs are the user interface to the FITS generation software. The FITS files are generated by the routine MAKECDSFITS, which uses a number of subroutines. The following routines are used to calculate the pointing of the CDS instrument from the telemetry data: CDS_POINT Calculate CDS pointing information for FITS header OPS_POINT Calculate the pointing based on the OPS data SENSOR_POINT Calculate the pointing based on the sun sensor data MECH_POINT Modify pointing based on the slit/mirror mechanisms Other subroutines of MAKECDSFITS are: GETCDSTIMES Gets the time information from the telemetry CDS_WAVE Calculates CDS wavelength information FIND_IN_PLAN Finds the current raster in the science plan MATCH_PLAN() Matches telemetry against the science plan GUESS_STEP Guesses the step size from the telemetry MAKECDSHEADER() Creates primary FITS header from telemetry MAKECDSQLI Makes CDS quick-look image files CDS_TTYPE Determines labels for data window columns CDSWINEXTR Extracts data windows with proper dimensions CDSAUXEXTR() Extracts auxilliary data windows CDSADDCOL Adds a column to a CDS FITS binary table CDS_TCUNI() Forms TCUNI based on TDESC CDS_TRPIX Forms pixel reference keywords The structure of the FITSGEN and FITSGEN_EVENT software trees are as follows: FITSGEN---TM_DEFINE_STRUC FITSGEN_EVENT---OPEN_TM_FILE |-GET_SCI_PKT* |-READ_RASTER* \-MAKECDSFITS---GETCDSTIMES |-CDS_POINT---OPS_POINT---OPS_DECODE | \-MECH_POINT---SLITPOS_DECODE |-CDS_WAVE |-FIND_IN_PLAN---MATCH_PLAN |-GUESS_STEP |-MAKECDSHEADER |-CDS_TTYPE |-CDSWINEXTR |-CDSAUXEXTR |-CDSADDCOL---CDS_TCUNI | \-CDS_TRPIX |-SENSOR_DECODE \-MAKECDSQLI A software tree that hasn't been implemented yet is SENSOR_POINT---SENSOR_DECODE but which will eventually be called from CDS_POINT. ---------------------------------------------------------------------------- Routines in directory as of 21-Apr-1995 Directory: /cds/data_handling/telem/science/ Directory: /sohos1/cds/soft/ops/data_handling/telem/science/ CDS_ATTENTION - Bring a severe error to the operator's attention. CDS_MESSAGE - Writes error messages to the log file. CDS_POINT - Calculate CDS pointing information for FITS header CDS_TCUNI() - Forms TCUNI based on TDESC. CDS_TRPIX - Forms pixel reference keywords for CDS binary table. CDS_TTYPE - Determines labels for data window columns in binary tables CDS_WAVE - Calculate CDS wavelength information for FITS header CDSADDCOL - Add a column to a CDS FITS binary table. CDSAUXEXTR() - Extract auxilliary data windows with proper dimensions CDSWINEXTR - Extract data windows with proper dimensions DECOMP_SCIENCE - Decompress science telemetry data. EVS_DECODE - Decode the event status byte in the telemetry. FIND_IN_PLAN - Finds the current raster in the science plan FIND_RASTER() - Finds the next raster header in the telemetry. FITSGEN - Widget interface to FITS generation from telemetry FITSGEN_EVENT - Widget interface to FITS generation from telemetry FORM_RASTER() - Sets up the structure of a raster. GET_SCI_PKT() - Get a science packet from the telemetry stream. GETCDSTIMES - Get the times for the FITS files from the telemetry. GUESS_STEP - Guess the step size from the telemetry. LOAD_DATA - Loads science data into raster arrays. LOAD_EXPOSURE - Loads exposure information into raster arrays. LOAD_SCIENCE - Stores science data from packet stream into array. MAKECDSFITS - Write CDS telemetry data to a FITS file. MAKECDSHEADER() - Creates primary header from telemetry for CDS FITS file MAKECDSQLI - Makes CDS quick-look image files MATCH_PLAN() - Matches telemetry against the science plan. MECH_POINT - Calculate pointing mods from slit and mirror mechanisms OPEN_NEXT() - Opens the next CDS science telemetry stream file. OPEN_TM_FILE() - Opens a stored telemetry file. OPS_DECODE - Decode MCU telemetry format for the OPS L or R position. OPS_POINT - Calculate pointing from OPS data in the telemetry. READ_EXPOSURE - Reads the packets making up a NIS or GIS exposure. READ_PACKET() - Read a telemetry packet READ_RASTER() - Reads a complete NIS or GIS raster. SENSOR_DECODE - Decode MCU telemetry format for sun sensor pitch or yaw. SENSOR_POINT - Calculate pointing from sun sensor data in the telemetry. SLITPOS_DECODE - Decode MCU telemetry format for slit position. SPS_DECODE - Decode the science process status word in the telemetry. SUMWIN_UNPACK - Unpack 64-bit summed window data from 8 bit telemetry words. TEST_CURR_EXP() - Tests if packet is part of the current exposure. TEST_SCI_PKT() - Tests if packet is a science packet. TM_DEFINE_STRUC - Defines structures used in telemetry software. VBWL_UNPACK - Unpack VBWL compressed telemetry data VDS_PACK - Packs 12-bit VDS values into 16 bit telemetry words. VDS_UNPACK - Unpacks 12-bit VDS values from 16 bit telemetry words.