Create a Clean Mask from Continuum Image or Moment Cube
If the morphology of your source is complicated, it can often be more efficient and reproducible to create a CLEAN mask from the data itself. This page outlines how to do this for continuum data (from the dirty image) and for spectral line data (from the moment 0 map of the dirty line cube).
Another useful resource is [[1][Masking Images for Analysis]]
Creating a Mask from Continuum Data
Supposing you have a dirty image called "calibrated_final_cont_dirty.image" and would like to create a CLEAN mask such that areas with intensities greater than 0.75 mJy/bm are CLEANed, you do the following:
ia.open('calibrated_final_cont_dirty.image') ia.calcmask('calibrated_final_cont_dirty.image > 7.5e-4',name='cont_dirty0p75mjy') ia.done() inp makemask mode='copy' inpimage='calibrated_final_cont_dirty.image' inpmask='calibrated_final_cont_dirty.image:cont_dirty0p75mjy' output='contDirtyMask0p75mjy' overwrite=True inp go
The choice of this threshold is critical --- you should choose it conservatively (on the high side) such that you are confident all emission contained is real