Artifact handling

Functions

int muse_cosmics_dcr (muse_image *aImage, unsigned int aXBox, unsigned int aYBox, unsigned int aPasses, float aThres)
 Quickly mark cosmic rays in an image using the DCR algorithm.

Detailed Description

This group implements a few functions to be used to remove artifacts from MUSE data at the level of single CCDs.


Function Documentation

int muse_cosmics_dcr ( muse_image aImage,
unsigned int  aXBox,
unsigned int  aYBox,
unsigned int  aPasses,
float  aThres 
)

Quickly mark cosmic rays in an image using the DCR algorithm.

Parameters:
aImage image on which to replace cosmic rays
aXBox search box size in x
aYBox search box size in y
aPasses maximum number of cleaning passes
aThres detection gap threshold in factors of standard deviation
Returns:
the integer number of cosmic rays found or a negative value on error
Remarks:
The result is directly applied to the input image: the cosmic rays are marked in the dq extension of the input image. The data and stat components of the input image are not changed.
This routine should only be used for quick reduction or in the case that only a single exposure of one target is available.

This uses the DCR algorithm of Pych, 2004, PASP, 116, 148. From Sect. 2 ("The Algorithm") of the paper:

1. Select small sized subframes that cover the whole frame, with substantial overlap. (This implementation overlaps 50% of each subframe with the next subframe, more around the top and right edges of the image. Pych recommends to have at least 100 pixels within each subframe for good statistics.)

In each subframe:

2. Calculate the standard deviation of the distribution of counts: sigma = sqrt((sum(ci^2) - (sum(ci))^2 / n) / n)

3. Apply a single sigma-clipping step to correct the estimate of standard deviation for outlying pixels.

4. Construct a histogram of the distribution of counts.

5. Find the mode of the distribution of counts (i.e., the peak of the histogram).

6. In the interval of counts higher than the mode, find gaps in the histogram (i.e., bins with zero data points).

7. Find the first gap that is wider than a threshold, which is the standard deviation multiplied by an arbitrary number (usually 3.0).

8. If such a gap exists, flag pixels with counts lying above the gap as affected by cosmic rays.

Exceptions:
set CPL_ERROR_NULL_INPUT, return -1 input image is NULL
set CPL_ERROR_ILLEGAL_INPUT, return -2 aThres is not positive
set CPL_ERROR_ILLEGAL_INPUT, return -3 aPasses is not positive
set CPL_ERROR_ILLEGAL_INPUT, return -4 aXBox is larger than the horizontal image size
set CPL_ERROR_ILLEGAL_INPUT, return -5 aYBox is larger than the horizontal image size
print warning size of a subframe is less than 100pix

Definition at line 275 of file muse_artifacts.c.

References muse_image::data.

Referenced by muse_quadrants_overscan_stats().


Generated on 26 Jan 2017 for MUSE Pipeline Reference Manual by  doxygen 1.6.1