NAME
hsp  Calibration package for High Speed Photometer (HSP) observations.
INTRODUCTION
The hsp package consists of tasks used to calibrate the High Speed Photometer (HSP), monitor the instrument's health, and reduce its data. The tasks are divided into groups (below) based on their relation, or lack of relation, to the the Routine Science Data Processing (RSDP) which is automatically performed at STScI on all science data received from the spacecraft. RSDPrelated tasks include algorithms to generate the calibration coefficients for high voltage and gain factors, detector efficiency, dark signal, dead time, etc., as well as the calibration algorithm which applies all these correction factors to the observational data. Tasks not related to RSDP include those used to monitor the instrument's health (warmup time determination, detector linearity verification, etc.), calibrate the polarimeter, locate the apertures, and other general tasks (spacecraft velocity and position determination, polynomial fitting and evaluation, etc.).
RSDPRELATED CALIBRATION SOFTWARE
The Routine Science Data Processing is performed at STScI to calibrate all HSP observations in a consistent manner. The main purpose of the STSDAS calibration software is to provide the calibration parameters needed for the operations of RSDP. The following table summarizes all the HSP calibration parameters needed by RSDP. For each parameter the table lists the primary STSDAS task that is needed to generate the parameter, and the name of the calibration data base table (if any) that is used to store the parameter. A complete definition of the calibration data base tables can be found in the Calibration Data Base Data Design document.
Table 1. HSP Calibration Parameters Required by RSDP   Parameter Description  Primary STSDAS  Data Base   tasks  relation   aperture size  (none)  CCP0  high voltage factor  voltfac  CCP1  analog gain factor  gainfac  CCP2  preamplifier noise  twodpolyfit  CCP3  detector efficiency (relative  relsen  CCP4   sensitivity)    detector dark signal  darkv  CCP5  currenttovoltage convertor  twodpolyfit  CCP7   (CVC) offset    pairedpulse correction ("dead  deadtimev  CCP8   time")    dark aperture translation table (none)  CCP9  
Aperture sizes (CCP0) and dark aperture translations (CCP9) are quantities not to be "calibrated" with observational data. The rest of the above quantities, except pairedpulse correction (CCP8), have the identical formula in RSDP processing. They are expressed as a thirdorder, bidimensional polynomial function of temperature and time:
X = X0 * { [1. + a01 * (tt0) + a02 * (tt0)^2 + a03 * (tt0)^3] + [ a10 + a11 * (tt0) + a12 * (tt0)^2 + a13 * (tt0)^3] * (TT0) + [ a20 + a21 * (tt0) + a22 * (tt0)^2 + a23 * (tt0)^3] * (TT0)^2 + [ a30 + a31 * (tt0) + a32 * (tt0)^2 + a33 * (tt0)^3] * (TT0)^3 }
where X is a calibration quantity, X0 is X's "base value", t is the epoch of the observation, t0 is the reference epoch, T is the temperature, and T0 is the reference temperature.
Thus, sixteen coefficients are needed for each setup combination (for example, in the case of analog gain factor, each detector ID and gain setting combination has 16 polynomial coefficients) in each relation. Pairedpulse correction is calibrated as only a linear function of temperature for each setup combination (detector ID, voltage, and threshold setting).
NONRSDPRELATED CALIBRATION SOFTWARE
In addition to the calibration parameters needed by RSDP which are described above, there are other HSP calibration parameters which are needed to use the instrument's other functions, and to monitor its performance.
Table 2. Additional HSP Calibration Parameters (NonRSDP)   Parameter Description  Primary STSDAS  Database    tasks  relation   aperture location (phase I)  apercen  CVAPER1  aperture plate scale  imgscale  CVAPER2  large aperture center coordinate  lgaperloc  CVAP3L  small aperture center coordinate  smaperloc  CVAP3S  optimum discriminator threshold  phav  CVDISCR   setting (pulse height analysis)   polarization transmission  poleffv  CVPOLEF   coefficients    polarization position angle  polpav  CVPOLPA   offset    polarization verification  polverify  CVPOLVF  
NonRSDP tasks in this package fall into one of the following groups:
 (1) polarimetry calibrations:

poleffv: Determines the polarization transmission coefficients of each of the Polaroid analyzers in the polarization detector, i.e., the amount of observed polarization of an ideal, 100% linearly polarized target. The input data of this task are obtained by observing a target with different telescope roll angles. By comparing the result polarization with the target's "known" polarization value, the polarization transmission coefficients are acquired.
polpav: Determines the polarization position angle offset from the standard equatorial coordinate system. The input data of this task are obtained by observing a target with all four Polaroid analyzers. By comparing the result position angle with the target's "known" position angle, the position angle offsets are acquired.
polverify: Verifies the entire polarization data calibration procedure. A target is observed with one Polaroid analyzer at different roll angles and then corrected for the above two corrections. The result should agree with the "known" values.
 (2) aperture location calibration:

apercen: The first step ("Phase I") of aperture location calibration is to determine the aperture's center in the coordinate system of the image dissector tube (IDT) deflections. This is done by observing an extended target which fills the aperture and scanning the aperture. The center coordinate is then obtained by fitting a circle to the edge of this 2dimensional image.
imgscale: The second step ("Phase II") of aperture location calibration is to establish the transformation coefficients between the IDT deflection coordinate system and the V2V3 coordinate system. This is done by moving the pointing of V1 axis to a matrix of sky positions to locate a point source target. The deflection coordinate of the target is obtained by doing an area scan at each pointing.
lgaperloc and smaperloc: ("Phase III") The third stage of aperture location calibration is to obtain the aperture's center coordinate to a higher accuracy of 0.02 arc seconds in the V2V3 coordinate system. For small apertures (task smaperloc), this is done by moving the telescope pointing to a matrix of sky positions to locate a point source target. Then a circle is fit to the edge beyond which no flux can be obtained from the target. For large apertures the scheme is slightly different: an "open cross" pattern is used in place of a square matrix for pointings, and the center coordinate is similarly calculated from the edge coordinates.
 (3) Instrument health monitoring:

abssenv: Compares the digital count rates and known fluxes of standard targets. Such comparison verifies the linearity of the detectors and the correctness of the entire calibration procedure. It also ties the instrument count rates to the absolute unit of flux or magnitude.
analoglin: Verifies the linearity of analog data by comparing the analog measurements and known fluxes of standard targets. This task functions much like abssenv.
flex: Determines the HSP optical bench flexure due to temperature differences within HSP, also known as the "banana mode correction". A 1dimensional polynomial is used to fit the deflection coordinate deviation as a function of temperature differences.
focusv: Determines the best HSP electronic focus setting by observing the same target with different focus settings. The setting having the highest count rate presumably has the least beam spreading and therefore is the optimum setting.
phav: Determines the optimum threshold setting for the pulse amplifier/discriminator (PAD). A twocomponent (Gaussian and exponential) model is assumed to represent the noise generated from the detectors and a least squares fitting is used to obtain the model coefficients.
scatterv: Determines the amount of scattered light from a bright source near but outside an aperture's view. The result of this task will be a table of count rates from scattered light as a function of angular distances from the aperture center.
taflat: Calibrates the flat field of HSP target acquisition apertures. A presumably uniform extended target is used to do this calibration.
warmup: Determines the elapsed time a detector takes to stablize after its high voltage power supply is turned on. This quantity can help the schedule planning of the instrument.
 (4) General tools:

monitor: This task reduces the data obtained when HSP is operated as a space particle monitor. The result will primarily be used to delineate the South Atlantic Anomaly (SAA).
parthitv: Removes particle events (data of abnormally high counts compared to their neighboring pixels) and calculates the mean count rate of a data file.
polyeval: Evaluates the polynomials which represent the quantities required in RSDP. This is a general tool used in many calibration scripts in order to carry out partial calibrations.
polyfit: Performs 1dimensional polynomial fitting. It can fit any order of polynomial (up to 9) and it does the fitting by using a set of orthogonal polynomials.
posvel: Produces the position and velocity of the spacecraft. The calculation is based on a fitted model from the flight ephemeris.
twodpolyfit: Performs 2dimensional polynomial fitting. This is to be used to generate the final coefficients of the RSDP relations described above. This is a general tool which can fit any order of polynomials (up to 9 by 9) and it uses the singular value decomposition (SVD) algorithm.