romanimpreprocess.utils.reference_subtraction

Simple reference subtraction utilities.

Functions

ref_subtraction_channel

Channel-based reference subtraction.

ref_subtraction_row

Row-based reference subtraction.

Functions

ref_subtraction_channel(image[, channel_start, ...])

Channel-based reference subtraction.

ref_subtraction_row(image[, use_ref_channel])

Row-based reference subtraction.

Module Contents

ref_subtraction_channel(image, channel_start=0, channel_end=128, use_ref_channel=False)[source]

Channel-based reference subtraction.

Performs a simple channel-wise reference pixel subtraction on the slopes image. Calculates a linear fit to the median pixel values at the top and bottom of each channel, and subtracts the fitted line from each column in the channel.

The image is updated in place; the updated image is also the return value.

Parameters:
  • image (np.array) – a 2D numpy array representing the slopes image.

  • channel_start (int, optional) – The starting index for the first channel.

  • channel_end (int, optional) – The ending index for the first channel.

  • use_ref_channel (bool, optional) – Whether to use the reference output.

Returns:

image – A 2D numpy array with the reference pixel values subtracted from each column in each channel. The image is expected to have 33 channels, each with 128 columns.

Return type:

np.array

ref_subtraction_row(image, use_ref_channel=False)[source]

Row-based reference subtraction.

Performs a simple row-wise reference pixel subtraction on the slopes image. Fits active-region median as a funciton of reference-region median, subtracts the fitted median from each row.

The image is updated in place; the updated image is also the return value.

Parameters:
  • image (np.array) – A 2D numpy array representing the slopes image.

  • use_ref_channel (bool, optional) – Whether to use the reference output for fitting.

Returns:

image – A 2D numpy array with the reference pixel values subtracted from each row.

Return type:

np.array