nabu.preproc.ccd
source module nabu.preproc.ccd
source class CCDFilter(radios_shape: tuple, kernel_size: int = 3, correction_type: str = 'median_clip', median_clip_thresh: float = 0.1, abs_diff=False, preserve_borders=False)
Filtering applied on radios.
Initialize a CCDCorrection instance.
Parameters
-
radios_shape : tuple — A tuple describing the shape of the radios stack, in the form
(n_radios, n_z, n_x)
. -
kernel_size : int — Size of the kernel for the median filter. Default is 3.
-
correction_type : str — Correction type for radios ("median_clip", "sigma_clip", ...)
-
median_clip_thresh : float, optional — Threshold for the median clipping method.
-
abs_diff : boolean — by default False: the correction is triggered when img - median > threshold. If equals True: correction is triggered for abs(img-media) > threshold
-
preserve borders : boolean — by default False: If equals True: the borders (width=1) are not modified.
Notes
A CCD correction is a process (usually filtering) taking place in the radios space. Available filters: - median_clip: if the value of the current pixel exceeds the median of adjacent pixels (a 3x3 neighborhood) more than a threshold, then this pixel value is set to the median value.
Methods
-
median_filter — Perform a median filtering on an image.
-
median_clip_mask — Compute a mask indicating whether a pixel is valid or not, according to the median-clip method.
-
median_clip_correction — Compute the median clip correction on one image.
-
dezinger_correction — Compute the median clip correction on a radios stack, and propagates the invalid pixels into vert and horiz directions.
source staticmethod CCDFilter.median_filter(img, kernel_size=3)
Perform a median filtering on an image.
source method CCDFilter.median_clip_mask(img, return_medians=False)
Compute a mask indicating whether a pixel is valid or not, according to the median-clip method.
Parameters
-
img : numpy.ndarray — Input image
-
return_medians : bool, optional — Whether to return the median values additionally to the mask.
source method CCDFilter.median_clip_correction(radio, output=None)
Compute the median clip correction on one image.
Parameters
-
radios : numpy.ndarray, optional — A radio image.
-
output : numpy.ndarray, optional — Output array
source method CCDFilter.dezinger_correction(radios, dark=None, nsigma=5, output=None)
Compute the median clip correction on a radios stack, and propagates the invalid pixels into vert and horiz directions.
Parameters
-
radios : numpy.ndarray — A radios stack.
-
dark : numpy.ndarray, optional — A dark image. Default is None. If not None, it is subtracted from the radios.
-
nsigma : float, optional — Number of standard deviations to use for the zinger detection. Default is 5.
-
output : numpy.ndarray, optional — Output array
Raises
-
ValueError
source class Log(radios_shape, clip_min=None, clip_max=None)
Helper class to take -log(radios)
Parameters
-
clip_min : float, optional — Before taking the logarithm, the values are clipped to this minimum.
-
clip_max : float, optional — Before taking the logarithm, the values are clipped to this maximum.
Methods
-
take_logarithm — Take the negative logarithm of a radios chunk. Processing is done in-place !
source method Log.take_logarithm(radios)
Take the negative logarithm of a radios chunk. Processing is done in-place !
Parameters
-
radios : array — Radios chunk.