Yclean is an automatic cleaning algorithm for data cubes called that creates individual masks for every channel of a line data cube, through an iterative process in order to obtain the optimal mask per channel for the cleaning process.
The yclean algorithm determines a threshold to mask every channel that depends on the value of the secondary lobe of the PSF, the rms of the image, and the maximum value of the image residual. First, it creates a dirty beam image with the tclean task in CASA. From the dirty .psf image, the algorithm determines the value of the secondary lobe (secondaryLobe) of the PSF map. From the .im image, it calculates the rms of the map (rmsMap) by computing the average rms value (using CASA imstat task) of a subset of channels located in a line free region of the map (usually near the edges of the spectral window). Finally, from the .residual image we obtain the maximum value (maxResidual). With the values of secondaryLobe, rmsMap, and maxResidual, a threshold is defined to create a mask that will be used with tclean (limitLevelSNR).
The limitLevelSNR is given by:
limitLevelSNR = maxResidual /(rmsMap x secondaryLobe)
After computing the first mask, a loop begins that finishes when the measured value of limitLevelSNR is greater than 2. In each loop, the following actions are performed:
1) Create a mask.
2) Combine the new mask with the mask used in the previous iteration.
3)Use tclean to clean the image using the mask previously created. In this step, the image is cleaned until it reaches a threshold given by (limitLevelSNRxrmsMap).
4)Calculate a new value of limitLevelSNR.
Once the loop ends, the yclean script performs a final clean using tclean with a cleaning stopping threshold given by 2xrmsMap and using a final mask that combines the previous mask with a new mask created with a threshold of 4xrmsMap. Finally, after the cleaning is done, all the products are exported into fits format.
The script has to be run in CASA. Currently it only works in CASA 4.7.2. The script can be found here. And an example on how to use is here. If you need more info abot the yclean script please contact me at:
ycontreras [at] strw.leidenuniv.nl
Here is the paper associated to this script Contreras et al. 2018