imagename=imagename, niter=0, threshold='1000mJy', robust=0.5, gridder='mosaic', scales=[0,3,9,27], deconvolver='mtmfs', specmode='mfs', nterms=2, weighting='briggs', pblimit=0.2, interactive=False, outframe='LSRK', savemodel='none', ) makefits(imagename) # create a mask based on region selection (no thresholding here) dirtyimagename = imagename+".image.tt0.pbcor" exportfits(dirtyimagename, dirtyimagename+".fits", overwrite=True) reg = pyregion.open('cleanbox_regions_SgrB2.reg') imghdu = fits.open(dirtyimagename+".fits")[0] #mask = reg.get_mask(imghdu)[None, None, :, :] mask = reg.get_mask(header=wcs.WCS(imghdu.header).celestial.to_header(), shape=imghdu.data.shape[2:]) imghdu.data = mask.astype('int16') imghdu.header['BITPIX'] = 16 imghdu.writeto('cleanbox_mask_SgrB2.fits', clobber=True) cleanbox_mask_image = 'cleanbox_mask_SgrB2.image' importfits(fitsimage='cleanbox_mask_SgrB2.fits',
# re-clean a wider area now full_imagename = (imagename + "_{field}_r{robust}_allcont_clean1e4_{threshold}".format( field=selfcal_fields[0].replace(" ", "_"), robust=0.5, threshold='0.5mJy', )) os.system('rm -r {0}.mask'.format(full_imagename)) tclean( vis=cont_vis, field=selfcal_fields[0], spw='', imsize=2000, phasecenter='J2000 17h47m20.166 -28d23m04.968', cell='0.01arcsec', imagename=full_imagename, robust=0.5, nterms=2, deconvolver='mtmfs', specmode='mfs', gridder=gridder, niter=10000, threshold='3.5mJy', scales=[0, 3, 9, 27], savemodel='none', mask='', ) makefits(full_imagename, cleanup=False)
robust=0.0, phasecenter=phasecenter[field], imsize=imsize[field], cell=['0.01 arcsec'], threshold='1 Jy', niter=0, gridder='standard', specmode='mfs', deconvolver='mtmfs', outframe='LSRK', savemodel='none', scales=[0, 3, 9, 27], nterms=2, selectdata=True, ) makefits(imagename) if not os.path.exists('cleanbox_mask_{0}.fits'.format(field_nospace)): dirtyimage = imagename + '.image.tt0.pbcor' if not os.path.exists(dirtyimage): if os.path.exists(dirtyimage + ".fits"): importfits(fitsimage=dirtyimage + ".fits", imagename=dirtyimage) else: raise IOError("Missing dirty image file & dirty FITS image") ia.open(dirtyimage) ia.calcmask(mask=dirtyimage + " > {0}".format(mask_threshold[field] / 1e3), name='dirty_mask_{0}'.format(field_nospace))
imagename=imagename, niter=10000, threshold='1mJy', robust=0.5, gridder='mosaic', scales=[0, 3, 9, 27], deconvolver='mtmfs', specmode='mfs', nterms=2, weighting='briggs', pblimit=0.2, interactive=False, outframe='LSRK', savemodel='none', ) makefits('18A-229_mosaic_for_selfcal', cleanup=False) #myclean(['../'+x for x in good_Q_mses], # name='18A-229_combined_for_selfcal', # threshold='2mJy', # no signal at 5... # spws=[Qmses[x] for x in good_Q_mses], # ) # # myclean(['../'+x for x in Kamses], # name='18A-229_combined_for_selfcal', # threshold='2mJy', # cell='0.015arcsec', # fields=['Sgr B2 MN Ka', 'Sgr B2 MS Ka', 'Sgr B2 S Ka', 'Sgr B2 DS1 Ka', 'Sgr B2 DS2 Ka'], # spws=[x for x in Kamses.values()], # ) #
imagename=imagename, niter=0, threshold='1000mJy', robust=0.5, gridder='mosaic', scales=[0,3,9], deconvolver='mtmfs', specmode='mfs', nterms=2, weighting='briggs', pblimit=0.2, interactive=False, outframe='LSRK', savemodel='none', ) makefits(imagename) cleanbox_mask = 'cleanbox_mask.mask' cleanbox_mask_image = 'cleanbox_mask_SgrB2.image' if not os.path.exists(cleanbox_mask) or not os.path.exists(cleanbox_mask_image): # create a mask based on region selection (no thresholding here) dirtyimagename = imagename+".image.tt0.pbcor" exportfits(dirtyimagename, dirtyimagename+".fits", overwrite=True) reg = pyregion.open('cleanbox_regions_SgrB2.reg') imghdu = fits.open(dirtyimagename+".fits")[0] #mask = reg.get_mask(imghdu)[None, None, :, :] mask = reg.get_mask(header=wcs.WCS(imghdu.header).celestial.to_header(), shape=imghdu.data.shape[2:]) imghdu.data = mask.astype('int16') imghdu.header['BITPIX'] = 16