@@ -60,4 +60,4 @@ If you would like use the native training model of deepCR, which are obtained fr
# Bugs
Please contact **_HU Yi_** (huyi.naoc@gmail.com) to report bugs.
Bugs can be reported and filed at https://csst-tb.bao.ac.cn/code/huyi/csst-commom-crmask/-/issues. Alternatively, you can contact **_HU Yi_** (huyi.naoc@gmail.com) to report bugs.
Instantiation of CRMask with specified model configuration.
Parameters
----------
obj : string, Path, astropy.io.fits.HDUList, numpy.ndarray, astropy.nddata.CCDData or list of string
if model is ``deepCR``, ``lacosmic``, obj is input image to be cosmic-ray masked
if model is ``deepCR_train``, obj is input training and validating images
flag : (optional) string, Path, astropy.io.fits.HDUList, numpy.ndarray or astropy.nddata.CCDData
flag image(s), default is None
mask : (optional) string or list of string
mask image(s), default is None, necessary when model is ``deepCR_train`` or ``benchmark``, otherwise, let it alone
sky : (optional) string or list of string
sky image(s), default is None, optional when model is ``deepCR_train``, otherwise, let it alone
save_flag : (optional) boolean
whether save CR mask (and cleaned) image, default is True
update_flag : (optional) boolean
whether update flag image, default is True
save_name : (optional) string
output mask, cleaned and flag filename. default is None. If save_name is None, use the filename as the input. And if save_flag is True, save_name is None, and obj is a numpy.ndarray or a astropy.nddata.CCDData, cr_mask will raise a ValueError exception
flag_suffix : (optional) string
suffix name of flag file, if flag is a numpy.ndarray or a astropy.nddata.CCDData, default is ``flg``
mask_suffix : (optional) string
suffix name of mask file, default is ``crmask``
clean_suffix : (optional) string
suffix name of cleaned file, default is ``crclean``
model : (optional) string
model type, can be ``deepCR``, ``lacosmic``, ``deepCR_train`` or ``benchmark`` default is ``deepCR``
fill_flag : (optional) boolean
whehter generate cleaned image, default is True
fill_method : (optional) string
fill method for CR contaminated pixel, can be ``inpainting``, ``meanmask``, ``meanmed``, default is ``inpainting``
gpu_flag : (optional) boolean
whether use GPU, default is False
config_path : (optional) string
configuration file path, default is ``./crmask.ini``
Instantiation of CRMask with specified model configuration.
Parameters
__________
obj : string, Path, astropy.io.fits.HDUList, numpy.ndarray, astropy.nddata.CCDData or list of string
if model is ``deepCR``, ``lacosmic``, obj is input image to be cosmic-ray masked, if model is ``deepCR_train``, obj is input training and validating images
flag : (optional) string, Path, astropy.io.fits.HDUList, numpy.ndarray or astropy.nddata.CCDData
flag image(s), default is None
mask : (optional) string or list of string
mask image(s), default is None, necessary when model is ``deepCR_train`` or ``benchmark``, otherwise, let it alone
sky : (optional) string or list of string
sky image(s), default is None, optional when model is ``deepCR_train``, otherwise, let it alone
save_flag : (optional) boolean
whether save CR mask (and cleaned) image, default is True
update_flag : (optional) boolean
whether update flag image, default is True
save_name : (optional) string
output mask, cleaned and flag filename. default is None. If save_name is None, use the filename as the input. And if save_flag is True, save_name is None, and obj is a numpy.ndarray or a astropy.nddata.CCDData, cr_mask will raise a ValueError exception
flag_suffix : (optional) string
suffix name of flag file, if flag is a numpy.ndarray or a astropy.nddata.CCDData, default is ``flg``
mask_suffix : (optional) string
suffix name of mask file, default is ``crmask``
clean_suffix : (optional) string
suffix name of cleaned file, default is ``crclean``
model : (optional) string
model type, can be ``deepCR``, ``lacosmic``, ``deepCR_train`` or ``benchmark`` default is ``deepCR``
fill_flag : (optional) boolean
whehter generate cleaned image, default is True
fill_method : (optional) string
fill method for CR contaminated pixel, can be ``inpainting``, ``meanmask``, ``meanmed``, default is ``inpainting``
gpu_flag : (optional) boolean
whether use GPU, default is False
config_path : (optional) string
configuration file path, default is ``./crmask.ini``
"""
self.model=model
ifmodel=='deepCR_train':
self.image_sets=obj
...
...
@@ -440,18 +440,19 @@ class CRMask:
defcr_mask(self):
"""
Cosmic ray detection and mask.
Cosmic ray detection and mask.
Returns
-------
Returns
-------
masked : numpy.ndarray
cosmic ray masked image.
cleaned : numpy.ndarray, optional
Only returned if `fill_flag` is True
cosmic ray cleaned image.
Examples
-------
Examples
--------
>>> from crmask import CRMask
>>> crobj = CRMask('xxxx.fits', 'deepCR')
>>> crobj.cr_mask()
...
...
@@ -710,21 +711,44 @@ class CRMask:
defcr_train(self):
"""
Training models, only support ``deepCR_train``. It will generate pytorch's *.pth file.
The train is very painful and time consuming, do NOT use it in pipelines.
Training models, only support ``deepCR_train``. It will generate pytorch's \*.pth file. The train is very painful and time consuming, do NOT use it in pipelines.