reduction.crrej.medfilt_bpm
reduction.crrej.medfilt_bpm(
ccd,
cadd=1e-10,
std_model='std',
gain=1.0,
rdnoise=0.0,
snoise=0.0,
size=5,
sigclip_kw=None,
std_section=None,
footprint=None,
mode='reflect',
cval=0.0,
origin=0,
med_sub_clip=None,
med_rat_clip=None,
std_rat_clip=None,
dtype='float32',
update_header=True,
verbose=False,
logical='and',
full=False,
)Find bad pixels from median filtering technique (non standard..?)
Parameters
ccd :~astropy.nddata.CCDData-
The CCD to find the bad pixels.
cadd :float, optional. = 1e-10-
A very small const to be added to the input array to avoid resulting value of 0.0 in the median filtered image which raises zero-division in median ratio
(image/|median_filtered|). std_model :{\"std\", \"ccd\"},~numpy.ndarray, numeric, optional. = 'std'-
The model used to calculate the std (standard deviation) map.
"std": Simple standard deviation is calculated."ccd": Using CCD noise model (``sqrt{(1 + snoise)*med_filt/gain- (rdnoise/gain)**2}``)
ndarray: A pre-calculated std map to be used as the std map.
For
'std', the argumentsstd_sectionandsigclip_kware used, while if'ccd', argumentsgain,rdnoise,snoisewill be used. size : optional. = 5-
The parameters to obtain the median-filtered map. See
~scipy.ndimage.median_filter. footprint : optional. = 5-
The parameters to obtain the median-filtered map. See
~scipy.ndimage.median_filter. mode : optional. = 5-
The parameters to obtain the median-filtered map. See
~scipy.ndimage.median_filter. cval : optional. = 5-
The parameters to obtain the median-filtered map. See
~scipy.ndimage.median_filter. origin : optional. = 5-
The parameters to obtain the median-filtered map. See
~scipy.ndimage.median_filter. sigclip_kw :dict, optional. = None-
The scalar sigma-clipping parameters used when estimating the sky standard deviation at
std_section. Supported keys aresigma,sigma_lower,sigma_upper,maxiters,cenfunc,stdfunc, andstd_ddof. This is ignored ifstd_model='ccd'. Default isdict(sigma=3.0, maxiters=5, std_ddof=1). std_section :str, optional. = None-
The region in FITS standard (1-indexing, end-inclusive, xyz order) to estimate the sky standard deviation to obtain the
std_ratio. IfNone(default), the full region of the given array is used, which is many times not desirable due to the celestial objects in the FOV and computational cost. This is ignored ifstd_model='ccd'. gain :float, optional. = 1.0-
The gain (electrons/ADU), readout noise (electrons), and sensitivity noise (fractional error from flat fielding) of the frame. These are ignored if
std_model="std". rdnoise :float, optional. = 1.0-
The gain (electrons/ADU), readout noise (electrons), and sensitivity noise (fractional error from flat fielding) of the frame. These are ignored if
std_model="std". snoise :float, optional. = 1.0-
The gain (electrons/ADU), readout noise (electrons), and sensitivity noise (fractional error from flat fielding) of the frame. These are ignored if
std_model="std". med_sub_clip :listof twofloatorNone, optional. = None-
The thresholds to find bad pixel by
med_sub = ccd.data - median_filter(ccd.data). The clipping will be turned off if it isNone(default). If alist, must be in the order of[lower, upper]and at most two of these can beNone. med_rat_clip :listof twofloatorNone, optional. = None-
The thresholds to find bad pixel by
med_ratio = ccd.data/np.abs(median_filter(ccd.data)). The clipping will be turned off if it isNone(default). If alist, must be in the order of[lower, upper]and at most two of these can beNone. std_rat_clip :listof twofloatorNone, optional. = None-
The thresholds to find bad pixel by
std_ratio = (ccd - median_filter(ccd))/std. The clipping will be turned off if it isNone(default). If alist, must be in the order of[lower, upper]and at most two of these can beNone. logical : ('and', '&', 'or', '|') = 'and'-
The logic to propagate masks determined by the
_clip’s. The mask is propagated such asposmask = med_sub > med_sub_clip[1] &/| med_ratio > med_rat_clip[1] &/| std_ratio > std_rat_clip[1]. If alist, it must contain twostrof these, in the order of[logical_negmask, logical_posmask].
Returns
ccd :~astropy.nddata.CCDData-
The badpixel removed result.
: The followings are returned asdictonly iffull=True.: posmask, negmask : ndarray ofbool-
The masked pixels by positive/negative criteria.
sky_std :float-
The (sigma-clipped) sky standard deviation. Returned only if
full=True.
Notes
med_sub_clip is usually unnecessary, but can be useful for detecting hot pixels in dark frames. The method generates median-subtracted, median-ratio, and stddev-ratio maps, combines the positive and negative masks with the requested logic, and replaces masked pixels with the median filtered frame.