Destreaking#

De-streaking accounts for smearing effects from the PUNCH shutterless frame transfer mode of operation. Each detector continues exposing during readout as the science image is moved off of the active detector area and onto the storage area.

Concept#

First, we construct a matrix that contains the streaking operation. It is inverted and returned by punchbowl.level1.destreak.streak_correction_matrix. This is multiplied into the image by the punchbowl.level1.destreak.correct_streaks function. Note that this requires that the image is square; a check is carried out at the beginning of the correction to require this.

Applying correction#

The correction is carried out primarily in the punchbowl.level1.destreak.correct_streaks function:

punchbowl.level1.destreak.correct_streaks(image: ndarray, exposure_time: float, readout_line_time: float, reset_line_time: float, max_workers: int | None = None) ndarray

Corrects an image for streaks.

Parameters:
  • image (np.ndarray (2D)) – image to be corrected

  • exposure_time (float) – exposure time in consistent units (e.g. milliseconds) with readout_line_time and reset_line time

  • readout_line_time (float) – time to read out a line in consistent units (e.g. milliseconds) with exposure_time and reset_line time

  • reset_line_time (float) – time to reset CCD in consistent units (e.g. milliseconds) with readout_line_time and exposure_time

  • max_workers (int) – the number of worker threads to use. If None, defaults to the system CPU count

Returns:

a streak-corrected image

Return type:

np.ndarray

Raises:
  • ValueError – If the image is not 2D or not square

  • TypeError – If the image is not a numpy array

  • np.linalg.LinAlgError – Singular matrix: Matrix isn’t invertible

Examples

>>> correct_streaks(np.arange(9).reshape(3,3), 1, 2, 3)
array([[ 3.46153846,  3.76923077,  4.07692308],
   [ 0.23076923,  0.38461538,  0.53846154],
   [-1.38461538, -1.30769231, -1.23076923]])

If you wish to incorporate this as a Prefect task in a custom pipeline, using something like the punchbowl.level1.destreak.destreak_task is recommended.