punchbowl.level1.despike#
Functions#
|
Create radial array. |
|
Remove cosmic ray spikes from an image using spikejones algorithm. |
|
Despike an image using astroscrappy.detect_cosmics. |
|
Prefect task to perform despiking. |
Module Contents#
- punchbowl.level1.despike.radial_array(shape: tuple[int], center: tuple[int] | None = None) numpy.ndarray[source]#
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][source]#
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, sigclip: float = 50, sigfrac: float = 0.25, objlim: float = 160.0, niter: int = 10, gain: float = 4.9, readnoise: float = 17, cleantype: str = 'meanmask', max_workers: int | None = None) ndcube.NDCube[source]#
Despike an image using astroscrappy.detect_cosmics.
- Parameters:
data_object (NDCube) – Input image to be despiked.
sigclip (float, optional) – Laplacian-to-noise limit for cosmic ray detection.
sigfrac (float, optional) – Fractional detection limit for neighboring pixels.
objlim (float, optional) – Contrast limit between Laplacian image and the fine structure image.
niter (int, optional) – Number of iterations.
gain (float, optional) – Gain of the image (electrons/ADU).
readnoise (float, optional) – Read noise of the image (electrons).
cleantype (str, optional) – Type of cleaning algorithm: ‘meanmask’, ‘medmask’, or ‘idw’.
max_workers (int, optional) – Max number of threads to use
- Returns:
Despiked cube.
- Return type:
NDCube
- punchbowl.level1.despike.despikejones_task(data_object: ndcube.NDCube, unsharp_size: int = 3, method: str = 'convolve', alpha: float = 1, dilation: int = 0) ndcube.NDCube[source]#
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