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. | |
This group implements a few functions to be used to remove artifacts from MUSE data at the level of single CCDs.
| 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.
| 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 |
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.
| 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().
1.6.1