httm.transformations.raw_slices_to_calibrated

Transformation functions for processing slices contained in a SingleCCDRawConverter so that they are suitable for writing to a calibrated FITS file.

convert_slice_adu_to_electrons(gain_loss, number_of_exposures, video_scale, image_slice)[source]

Converts a slice from Analogue to Digital Converter Units (ADU) to electron counts.

Define the following values:

\(\displaystyle{\mathtt{FPE\_MAX\_ADU} := 65535}\)

\(\displaystyle{\mathtt{gain\_loss\_per\_adu} := \frac{\mathtt{gain\_loss}} {\mathtt{number\_of\_exposures}\times\mathtt{FPE\_MAX\_ADU}}}\)

\(\displaystyle{\mathtt{gain\_loss\_per\_electron} := \frac{\mathtt{gain\_loss\_per\_adu}} {\mathtt{video\_scale}}}\)

For each pixel \(p\), with units in ADU, this function applies the following transformation:

\(\displaystyle{\frac{\mathtt{video\_scale} \times p}{1 - \mathtt{gain\_loss\_per\_electron} \times \mathtt{video\_scale} \times p}}\)

This function is the inverse transform of convert_slice_electrons_to_adu().

Parameters:
  • gain_loss (float) – The relative decrease in video gain over the total ADC range
  • number_of_exposures (int) – The number of exposures the image comprises.
  • video_scale (float) – Constant for converting electron counts to Analogue to Digital Converter Units (ADU). Units: electrons per ADU
  • image_slice (Slice) – Input slice. Units: ADU
Return type:

Slice

remove_baseline_from_slice(early_dark_pixel_columns, late_dark_pixel_columns, image_slice)[source]

This function estimates baseline from the dark pixels of a slice and compensates for this effect.

This averages the pixels in the dark columns and subtracts the result from each pixel in the image.

Parameters:
  • early_dark_pixel_columns (int) – The number of dark pixel columns on the left side of the slice
  • late_dark_pixel_columns (int) – The number of dark pixel columns on the right side of the slice
  • image_slice (Slice) – Input slice. Units: electrons
Return type:

Slice

remove_pattern_noise_from_slice(pattern_noise, image_slice)[source]

This transformation corrects for a fixed pattern of noise on a Slice.

Parameters:
  • pattern_noise (numpy.ndarray) – 2d array of dimensions matching the pixel array of a slice
  • image_slice (Slice) – Input slice. Units: ADU
Return type:

Slice

remove_smear_from_slice(early_dark_pixel_columns, late_dark_pixel_columns, final_dark_pixel_rows, smear_rows, image_slice)[source]

This function estimates smear from the smear rows of a slice and compensates for this effect.

This averages the smear rows and subtracts the result from each row in the image.

Smear rows are then zeroed.

This transformation implicitly removes start of line ringing and the baseline electron count.

Parameters:
  • early_dark_pixel_columns (int) – The number of dark pixel columns on the left side of the slice
  • late_dark_pixel_columns (int) – The number of dark pixel columns on the right side of the slice
  • final_dark_pixel_rows (int) – The number of top dark pixel rows
  • smear_rows (int) – The number of smear rows
  • image_slice (Slice) – Input slice. Units: electrons
Return type:

Slice

remove_start_of_line_ringing_from_slice(final_dark_pixel_rows, image_slice)[source]

This function estimates start of line ringing from the upper dark rows of a slice and compensates for this effect.

This averages the upper dark rows and subtracts the result from each row in the image.

This will also implicitly remove the video bias.

This should not be necessary if smear is already being removed.

Parameters:
  • final_dark_pixel_rows (int) – Number of top dark pixel rows
  • image_slice (Slice) – Input slice. Units: electrons
Return type:

Slice

remove_undershoot_from_slice(undershoot_parameter, image_slice)[source]

When a CCD reads out a bright pixel, the pixel to the right of it appears artificially dimmer.

This is undershoot.

This function compensates for this effect on a slice.

This convolves the kernel \(\langle 1, \mathtt{undershoot\_parameter} \rangle\) with each row, yielding a row of the same length. The convolution is non-cyclic: the input row is implicitly padded with zero at the start to make this true. This undoes the slight “memory” the focal plane electronics exhibit for the signal in the previous pixel.

This transformation is the (approximate) inverse of simulate_undershoot_on_slice().

Parameters:
  • undershoot_parameter (float) – Undershoot parameter from parameter structure, typically ~0.001, dimensionless
  • image_slice (Slice) – Input slice. Units: electrons
Return type:

Slice