punchbowl.level1.despike#

Functions#

radial_array(→ numpy.ndarray)

Create radial array.

spikejones(→ tuple[numpy.ndarray, numpy.ndarray])

Remove cosmic ray spikes from an image using spikejones algorithm.

despike_task(→ ndcube.NDCube)

Prefect task to perform despiking.

Module Contents#

punchbowl.level1.despike.radial_array(shape: tuple[int], center: tuple[int] | None = None) numpy.ndarray#

Create radial array.

punchbowl.level1.despike.spikejones(image: numpy.ndarray, unsharp_size: int = 3, method: str = 'convolve', alpha: float = 1, dilation: int = 0) tuple[numpy.ndarray, numpy.ndarray]#

Remove cosmic ray spikes from an image using spikejones algorithm.

This code is based on drzowie/solarpdl-tools

Parameters:
  • image (np.ndarray) – an array representing an image

  • unsharp_size (int) – half window size in pixels for unsharp mask

  • method (str (either "convolve" or "median")) – method for applying the unsharp mask

  • alpha (float) – threshold for deciding a pixel is a cosmic ray spike, i.e. difference between unsharp and smoothed image

  • dilation (int) – how many times to dilate pixels identified as spikes, allows for identifying a larger spike region

Returns:

an image with spikes replaced by the average of their neighbors and the locations of all spikes

Return type:

(np.ndarray, np.ndarray)

punchbowl.level1.despike.despike_task(data_object: ndcube.NDCube, unsharp_size: int = 3, method: str = 'convolve', alpha: float = 1, dilation: int = 0) ndcube.NDCube#

Prefect task to perform despiking.

Parameters:
  • data_object (NDCube) – data to operate on

  • unsharp_size (int) – half window size in pixels for unsharp mask

  • method (str (either "convolve" or "median")) – method for applying the unsharp mask

  • alpha (float) – threshold for deciding a pixel is a cosmic ray spike, i.e. difference between unsharp and smoothed image

  • dilation (int) – how many times to dilate pixels identified as spikes, allows for identifying a larger spike region

Returns:

a modified version of the input with spikes removed

Return type:

NDCube