4.19. cosmic_clean¶
Clears cosmic rays from the fits file
- Fits.cosmic_clean(output=None, override=False, sigclip=4.5, sigfrac=0.3, objlim=5, gain=1.0, readnoise=6.5, satlevel=65535.0, niter=4, sepmed=True, cleantype='meanmask', fsmode='median', psfmodel='gauss', psffwhm=2.5, psfsize=7, psfk=None, psfbeta=4.765, gain_apply=True) Self¶
Clears cosmic rays from the fits file.
[1]: https://ccdproc.readthedocs.io/en/latest/api/ccdproc.cosmicray_lacosmic.html
Parameters
outputstr, optionalPath of the new FITS file.
overridebool, default=FalseIf
True, will overwrite theoutputpath if a file already exists.sigclipfloat, default=4.5Laplacian-to-noise limit for cosmic ray detection. Lower values will flag more pixels as cosmic rays.
sigfracfloat, default=0.3Fractional detection limit for neighboring pixels. For cosmic ray neighbor pixels, a Laplacian-to-noise detection limit of
sigfrac * sigclipwill be used.objlimint, default=5Minimum contrast between Laplacian image and the fine structure image. Increase this value if cores of bright stars are flagged as cosmic rays.
gainfloat, default=1.0Gain of the image (electrons / ADU). We always need to work in electrons for cosmic ray detection.
readnoisefloat, default=6.5Read noise of the image (electrons). Used to generate the noise model of the image.
satlevelfloat, default=65535.0Saturation level of the image (electrons). Pixels at or above this level are added to the mask.
niterint, default=4Number of iterations of the LA Cosmic algorithm to perform.
sepmedbool, default=TrueUse the separable median filter instead of the full median filter. The separable median is significantly faster and still detects cosmic rays well.
cleantypestr, default=’meanmask’Set which clean algorithm is used: - “median”: An unmasked 5x5 median filter. - “medmask”: A masked 5x5 median filter. - “meanmask”: A masked 5x5 mean filter. - “idw”: A masked 5x5 inverse distance weighted interpolation.
fsmodestr, default=’median’Method to build the fine structure image: - “median”: Use the median filter in the standard LA Cosmic algorithm. - “convolve”: Convolve the image with the PSF kernel to calculate the fine structure image.
psfmodelstr, default=’gauss’Model to use to generate the PSF kernel if fsmode == ‘convolve’ and psfk is None.
psffwhmfloat, default=2.5Full Width Half Maximum of the PSF to use to generate the kernel.
psfsizeint, default=7Size of the kernel to calculate. Returned kernel will have size psfsize x psfsize.
psfkAny, optionalPSF kernel array to use for the fine structure image if fsmode == ‘convolve’.
psfbetafloat, default=4.765Moffat beta parameter. Only used if fsmode`==’convolve’ and `psfmodel==’moffat’.
gain_applybool, default=TrueIf
True, return gain-corrected data with correct units; otherwise, do not gain-correct the data.
Returns
FitsCleaned FITS file.
4.19.1. Example:¶
from myraflib import Fits
fits = Fits.sample()
cleaned_fits = fits.cosmic_clean()