prepare_frames

The purpose of prepare_frames is to prepare the raw SOXS frames for data reduction.

Here’s the typical workflow for preparing the raw frames:

1. Trim Overscan

The first thing we need to do is trim off the overscan area of the image. The science-pixel regions for the detectors are read from the Detector Parameters file.

2. ADU to Electrons

Next the pixel data is converted from ADU to electron counts by multiplying each pixel value in the raw frame by the detector gain (the gain is read in units of electrons/ADU).

\[\rm{electron\ count} = \rm{adu\ count} \times \rm{gain}\]

3. Generating an Uncertainty Map

Next an uncertainty map is generated for the raw image and added as the ‘ERR’ extension of the image.

4. Bad Pixel Mask

The default detector bitmap is read from the static calibration suite and converted to a boolean mask, with values >0 becoming TRUE to indicate these pixels need to be masks. All other values are set to FALSE. This map is add as the ‘QUAL’ extesion of the image.

Finally the prepared frames are saved out into the intermediate frames location with the prefix pre_.

Viewing the image in DS9 (using the command ds9 -multiframe -tile columns pre_filename.fits to show all extensions as tiled frames) we can see the ‘FLUX’, ‘QUAL’ and ‘ERR’ extensions are now all present.

_base_recipe_.prepare_frames(save=False)[source]

prepare raw frames by converting pixel data from ADU to electrons and adding mask and uncertainty extensions

Key Arguments:
  • save – save out the prepared frame to the intermediate products directory. Default False.

Return:
  • preframes – the new image collection containing the prepared frames

Usage

Usually called within a recipe class once the input frames have been selected and verified (see soxs_mbias code for example):

self.inputFrames = self.prepare_frames(
    save=self.settings["save-intermediate-products"])