Data Set Overview
===================
This collection contains shift and coadd images generated by the BOPPS Infra-Red Camera (BIRC)
during flight. This includes the flatfields generated from flight data, which
are coadded and normalized images.

The BOPPS Infrared Camera (BIRC) is a multispectral infrared imager designed to
operate in 8 wavelengths between 2.5 and 5.0 μm, with each spectral width being
~ 3% of the center wavelength, and the astronomical R-band near 640 nm. 
BIRC was designed to measure the water and CO2 emissions from comets at 2.73 
and 4.3 μm, respectively, and the water related infrared absorption feature
in asteroids and the Moon from ~ 2.5 to 3.2 μm. This capability is obtained 
with a Teledyne H2RG cryocooled HgCdTe detector and an 80 cm telescope. 
The system produces an f/4 image over a field of view of 3 arcminutes, 
which subtends approximately 151 pixels on the 2K x 2K array, and employs 
shift/co-add algorithms to increase signal-to-noise for the observation of dim objects.  
The BIRC is comprised of two subsystems, a collimator and a camera, which 
are designed to relay the primary image from the 80 cm telescope to the 
focal plane of the Teledyne H2RG after passing a collimated beam through the
cryogenically cooled nine-position filter wheel. The primary image propagates
through a CaF2 window on a ‘cold box’ that contains the collimating optics. 
This subsystem  consists of an enclosed cooled, nitrogen-purged box with a 
collimating  mirror and three fold mirrors, all of which are coated with 
protected gold to reduce thermal self emission. Upon exiting the box, the 
collimated beam passes through another CaF2 window between it and the evacuated,
cryogenically cooled nine-position filter wheel and then into a camera subassembly 
where the final image is formed on the detector via a small Ritchey-Critean telescope.  

Custom firmware provided by Teledyne Imaging Systems allows the BIRC flight 
software to readout a programmable area of interest, which was then defined to 
be the central 320 x 200 pixel region that contains the 3 arcmin field of view. 
It is this subframe that is generated by the BIRC instrument for all the image data.

The detector performs a 'non-destructive' read of the data in time units of 3.48ms,
such that the integration time for an individual image is N * 3.48ms. For any
commanded integration time the detector performs two reads. The first read 
is after 3.48ms, for which the bias image is generated. The second read is at
N * 3.48ms, for which the signal image is generated.

This collection includes the SHIFTED, COADDED, and FLATFIELD image product types.

Processing
==========
After unpacking the image data from the telemetry files, all bias and signal
image pairs are collated. The raw images are biased such that larger DN indicates
a lower signal strength. The signal image is subtracted from the bias image
to remove the bias contribution to the signal. This also inverts the DN values
such that larger DN now indicates higher signal strength. 

Images are then calibrated by removing "hot" pixels and "popcorn noise", then 
divided by a flat field to remove fixed-pattern noise. A DN to electron 
algorithm was applied to convert the pixel values to units of electrons. 

CALIBRATED products associated with a given observation, filter, and integration
time are collated in time order, as is pointing information consisting of the
instantaneous shift up/down and left/right in arcseconds required to point the
telescope boresight to the target. First order interpolation is used on the 
pointing records in order to get an estimate of telescope position for each 
image. A 2x2 rotation matrix was then used to transform the instantaneous shift
values into row, column shifts in the image reference frame. The assumption was
made that any swaying motion by the telescope (introducing tilt to the image) 
was negligible (being removed by the anti-pendulation flywheel on the gondola), 
hence the lack of a third rotation angle. The pipeline software then calculated 
the row,column image shifts with respect to the first image taken in the image set
, shifted successive images with respect to the first, and added all images together.
The image was then divided by the number of images shifted and added to produce an
averaged result. This is saved to a FITS file in 32-bit floating point data type
as a SHIFTED product.

In a few of the observations of dim targets, the pointing information was not
accurate enough to adjust for unexpected sharp changes in telescope or gondola
orientation. Unfortunately, since the target was usually too dim to be seen 
in an individual image there was no way to easily identify at what point to 
apply additional shift values and by how much. To mitigate this problem the 
initial image set was divided into subsets (an equal number of images in each subset),
and a shifted and co-added image was generated for each subset. 

A shift set number is included in the SHIFTED product file naming convention to
identify cases where multiple SHIFTED products were created for a given observation.
The shift set number is set to 0 for cases where only one SHIFTED product was 
created for an observation. The shift set number starts at 1 and goes to N, 
where N is the total number of shifted products created for an observation at a 
set filter and integration time.

For images taken with the CO2 filters (3 and 4), where the SNR was very small, 
and data was taken over several minutes, the inherent drift rate of the pointing 
system was utilized to identify and isolate the target. This was done by 
subdividing the image set into several subsets, shifting and co-adding each 
subset, then combining the shifted images into an animated gif. The target was
then identified since it was the only source in the image that moved in the 
same direction at a constant rate during the animation.

The COADDED data product is generated by collating CALIBRATED data products 
associated with a given observation, filter, and integration time in time order,
co-adding them, and dividing by the number of images to get an averaged result. 

The FLATFIELD data product is generated by collating BIAS SUBTRACTED data products
associated with a given observation, filter, and integration time in time order. 
The pipeline software then remove hot pixels and popcorn noise. The filtered
images are then co-added, divided by the number of images co-added, and 
normalized using the mean value of the averaged image in the 3 arcmin field of
view. The FLATFIELD product is used in the generation of the CALIBRATED products.

For observations conducted on targets during flight there were usually two
sets of observations done per target, designated set A and set B. The 
object was offset in the field of view between these two sets.  
Set A was the initial observation of the target with the telescope pointed 
to the commanded target location in RA and DEC. Set B was taken with the 
telescope shifted by XX arcseconds (“nodded”) in elevation resulting in the 
target located in a different part of the image. Images from set A were then 
used to create the FLATFIELD products for use in set B calibrated products, and 
vice versa. The target was not masked for the generation of the FLATFIELD product,
hence a “shadow” image of the other’s target sometimes appears in the SHIFTED or COADDED product.

Data
====

FITS Images and PDS Labels
	--------------------------
	Each shift and coadded BIRC image is stored in FITS file format with minimal FITS headers. 
	Any associated metadata is contained in the XML PDS label associated with the
	FITS file.

	File Naming Convention
	----------------------
    The file naming convention for a SHIFTED, COADDED, or FLATFIELD data product is:
    
	obsd_x_n_hhmmss_t_YYYY.ext

	where:

	obsd – 4 character string identifying the type of observation. See table 5
	 for a short description of each of the observation types identified

	x – a digit identifying the shift subset number. 
	
	n – single digit indicating filter used. See table 6 in the SIS
	for a list of filter number vs. wavelength. The filter wavelength is also noted
	in the XML label.
	
	hhmmss – two digit hour, two digit minute, two digit second 
	corresponding to the timetag of the first image in the set of images 
	used to generate the product.

	t – product type
     s – shifted and co-added
     c – coadded
     f – flat field. Normalized co-added image

	YYYY – the four digit integration time of the image in milliseconds, rounded
	to the nearest  millisecond.
 
	.ext is a three character file extension. Either ‘fit’ for the fits file 
	or ‘xml’ for the PDS4 XML label. An additional reference file ending in ‘txt’
	is also created and is referenced by the XML label. This reference file 
	contains the set of images that were used to generate the Level-2 image 
	product.

	File Organization
	-----------------
	The SHIFTED products are organized by product type, then by target, then by filter.
	Shift and coadd products were generated only for images that were taken 
	during H2O or CO2 observations, or with observations where all filters 
	were used, as these were the only observations where the telescope was
	commanded to a fixed RA and DEC for the entire observation.
	
	The FLATFIELD products are organized by target. There is only one flatfield
	created per filter and observation in each set. The flatfield in set A for
	a given observation was used to calibrate the images in set B for the same
	observation and vice versa. For example, the 'jaca' flatfields were used
	to calibrate the 'jacb' (Comet Jacques Co2 set A and set B) observations, 
	and not used as flatfields for any other observations. 
	
	One exception to this was the use of 1Ceres set B flatfields to calibrate the
	images from HD 163761. This was due to the fact that HD 163761 took only 
	one set	of observations due to time constraints on the mission.
	