L.A. Cosmic¶
Welcome to the documentation for the ‘lacosmic.py’ module, which contains the core function for cosmic ray clean-up of the WiFeS data.
- pywifes.lacosmic.lacos_spec_data(data, input_dq=None, gain=1.0, rdnoise=0.0, wave=None, sig_clip=4.0, sig_frac=0.5, obj_lim=1.0, niter=4, n_nx=1, n_ny=5, verbose=True)¶
Perform cosmic ray rejection on spectroscopic data using the L.A.Cosmic algorithm. The L.A.Cosmic algorithm is a Laplacian cosmic ray detection algorithm that uses a noise model to identify cosmic rays. The algorithm is described in van Dokkum (2001, PASP, 113, 1420).
- Parameters:
data (ndarray) – The input spectroscopic data.
input_dq (ndarray) – An optional input pixel mask array. Default: None.
gain (float, optional) – The gain of the detector. Default is 1.0.
rdnoise (float, optional) – The read noise of the detector. Default is 0.0.
wave (ndarray, optional) – The wavelength array. Default is None.
sig_clip (float, optional) – The sigma clip threshold for identifying cosmic rays. Default is 4.0.
sig_frac (float, optional) – The fraction of the sigma clip threshold used for identifying neighboring pixels. Default is 0.5.
obj_lim (float, optional) – The object flux limit used for identifying cosmic rays. Default is 1.0.
niter (int, optional) – The number of iterations for the cosmic ray rejection. Default is 4.
n_nx (int, optional) – The number of neighboring pixels to consider in the x-direction. Default is 1.
n_ny (int, optional) – The number of neighboring pixels to consider in the y-direction. Default is 5.
verbose (bool, optional) – Whether to print verbose output. Default is True.
- Returns:
clean_data (ndarray) – The cosmic ray cleaned spectroscopic data.
global_bpm (ndarray) – The bad pixel mask indicating the locations of cosmic rays.
- pywifes.lacosmic.lacos_wifes(inimg, outimg, gain=1.0, rdnoise=5.0, wsol_fn=None, sig_clip=4.0, sig_frac=0.5, obj_lim=1.0, niter=4, n_nx=1, n_ny=5, is_multithread=False, max_processes=-1, debug=False)¶
Performs cosmic ray rejection on spectroscopic data using the L.A.Cosmic algorithm. The L.A.Cosmic algorithm is a Laplacian cosmic ray detection algorithm that uses a noise model to identify cosmic rays. The algorithm is described in van Dokkum (2001, PASP, 113, 1420). If the user aims to run in multi-threaded mode, the number of processes to use can be specified. If the user does not specify the number of processes, the function will use all available processes.
- Parameters:
inimg (str) – Input image file path.
outimg (str) – Output image file path.
gain (float, optional) – Gain of the data (default is 1.0).
rdnoise (float, optional) – Read noise of the data (default is 5.0).
wsol_fn (str, optional) – File path to the wavelength solution file (default is None).
sig_clip (float, optional) – Sigma clip threshold for cosmic ray detection (default is 4.0).
sig_frac (float, optional) – Fractional detection threshold for cosmic ray detection (default is 0.5).
obj_lim (float, optional) – Object detection limit for cosmic ray detection (default is 1.0).
niter (int, optional) – Number of iterations for cosmic ray detection (default is 4).
n_nx (int, optional) – Number of pixels to use in the x-direction for cosmic ray detection (default is 1).
n_ny (int, optional) – Number of pixels to use in the y-direction for cosmic ray detection (default is 5).
is_multithread (bool, optional) – Flag indicating whether to use multi-threading (default is False).
max_processes (int, optional) – Maximum number of processes to use for multi-threading (default is -1, which uses all available processes).
debug (bool) – Whether to report the parameters used in this function call. Default: False.
- Return type:
None