Identify cosmic rays through median technique. The median technique identifies cosmic rays by identifying pixels by subtracting a median image from the initial data array.
Parameters: | ccd : CCDData or numpy.ndarray or numpy.MaskedArary
thresh : float
error_image : None, float, or ndarray
mbox : int
gbox : int
rbox : int
{log} |
---|---|
Returns: |
nccd : ndarray
|
Notes
Similar implementation to crmedian in iraf.imred.crutil.crmedian
Examples
Given an numpy.ndarray object, the syntax for running cosmicray_median would be:
>>> newdata, mask = cosmicray_median(data, error_image=error,
thresh=5, mbox=11, rbox=11, gbox=5)
where error is an array that is the same shape as data but includes the pixel error. This would return a data array, newdata, with the bad pixels replaced by the local median from a box of 11 pixels; and it would return a mask indicating the bad pixels.
Given an CCDData object with an uncertainty frame, the syntax for running cosmicray_median would be:
>>> newccd = cosmicray_median(ccd, thresh=5, mbox=11, rbox=11, gbox=5)
The newccd object will have bad pixels in its data array replace and the mask of the object will be created if it did not previously exist or be updated with the detected cosmic rays.