def gridtemplate(imagename10, image_length, direction_ra, direction_dec): """ myim02 """ # get native grid information num_x_pix = imhead(imagename10, mode="list")["shape"][0] num_y_pix = imhead(imagename10, mode="list")["shape"][1] pix_radian = imhead(imagename10, mode="list")["cdelt2"] obsfreq = 115.27120 # imhead(imagename10,mode="list")["restfreq"][0]/1e9 pix_arcsec = round(pix_radian * 3600 * 180 / np.pi, 3) # create tempalte image blc_ra_tmp = imstat(imagename10)["blcf"].split(", ")[0] blc_dec_tmp = imstat(imagename10)["blcf"].split(", ")[1] blc_ra = blc_ra_tmp.replace(":", "h", 1).replace(":", "m", 1) + "s" blc_dec = blc_dec_tmp.replace(".", "d", 1).replace(".", "m", 1) + "s" beamsize = round(imhead(imagename10, "list")["beammajor"]["value"], 2) pix_size = round(beamsize / 4.53, 2) size_x = int(image_length / pix_size) size_y = size_x c = SkyCoord(blc_ra, blc_dec) ra_dgr = str(c.ra.degree) dec_dgr = str(c.dec.degree) direction = "J2000 " + direction_ra + " " + direction_dec mycl.done() mycl.addcomponent(dir=direction, flux=1.0, fluxunit="Jy", freq="230.0GHz", shape="Gaussian", majoraxis="0.1arcmin", minoraxis="0.05arcmin", positionangle="45.0deg") myia.fromshape("template.im", [size_x, size_y, 1, 1], overwrite=True) mycs = myia.coordsys() mycs.setunits(["rad", "rad", "", "Hz"]) cell_rad = myqa.convert(myqa.quantity(str(pix_size) + "arcsec"), "rad")["value"] mycs.setincrement([-cell_rad, cell_rad], "direction") mycs.setreferencevalue([ myqa.convert(direction_ra, "rad")["value"], myqa.convert(direction_dec, "rad")["value"] ], type="direction") mycs.setreferencevalue(str(obsfreq) + "GHz", "spectral") mycs.setincrement("1GHz", "spectral") myia.setcoordsys(mycs.torecord()) myia.setbrightnessunit("Jy/pixel") myia.modify(mycl.torecord(), subtract=False) exportfits(imagename="template.im", fitsimage="template.fits", overwrite=True) os.system("rm -rf template.image") importfits(fitsimage="template.fits", imagename="template.image") myia.close() mycl.close()
def rebinpix(imagename, output, blc_ra, blc_dec): """ change pixel size to bmaj/4.53 """ # get native grid information num_x_pix = imhead(imagename, mode="list")["shape"][0] num_y_pix = imhead(imagename, mode="list")["shape"][1] pix_radian = imhead(imagename, mode="list")["cdelt2"] pix_arcsec = round(pix_radian * 3600 * 180 / np.pi, 2) # create tempalte image beamsize = round(imhead(imagename, "list")["beammajor"]["value"], 2) pix_size = round(beamsize / 4.53, 2) size_x = max( int(num_x_pix * pix_arcsec / pix_size) + 4, int(num_y_pix * pix_arcsec / pix_size) + 4) size_y = size_x c = SkyCoord(blc_ra, blc_dec) ra_dgr = str(c.ra.degree) dec_dgr = str(c.dec.degree) direction_ra = str(ra_dgr) + "deg" direction_dec = str(dec_dgr) + "deg" direction = "J2000 " + direction_ra + " " + direction_dec mycl.done() mycl.addcomponent(dir=direction, flux=1.0, fluxunit="Jy", freq="230.0GHz", shape="Gaussian", majoraxis="0.1arcmin", minoraxis="0.05arcmin", positionangle="45.0deg") myia.fromshape(output + "_tmp_", [size_x, size_y, 1, 1], overwrite=True) mycs = myia.coordsys() mycs.setunits(["rad", "rad", "", "Hz"]) cell_rad = myqa.convert(myqa.quantity(str(pix_size) + "arcsec"), "rad")["value"] mycs.setincrement([-cell_rad, cell_rad], "direction") mycs.setreferencevalue([ myqa.convert(direction_ra, "rad")["value"], myqa.convert(direction_dec, "rad")["value"] ], type="direction") mycs.setreferencevalue("230GHz", "spectral") mycs.setincrement("1GHz", "spectral") myia.setcoordsys(mycs.torecord()) myia.setbrightnessunit("Jy/pixel") myia.modify(mycl.torecord(), subtract=False) exportfits(imagename=output + "_tmp_", fitsimage=output + "_tmp_.fits", overwrite=True) importfits(fitsimage=output + "_tmp_.fits", imagename=output) myia.close() mycl.close() os.system("rm -rf " + output + "_tmp_") os.system("rm -rf " + output + "_tmp_.fits")
def _make_canvas(self, name="model_input"): fitsimage = name + '.fits' tclean(vis=self.inputvis, imagename=name, specmode='mfs', niter=0, deconvolver='hogbom', interactive=False, cell=self.cell, stokes=self.stokes, robust=self.robust, imsize=[self.M, self.N], weighting='briggs') exportfits(imagename=name + '.image', fitsimage=fitsimage, overwrite=True) return fitsimage
def test_fits_image(self): """test_fits_image: input image is FITS cube""" self.skip_if_darwin() # convert input image to FITS self.assertFalse(os.path.exists(self.fitsimage)) exportfits(imagename=self.imagename, fitsimage=self.fitsimage) self.assertTrue(os.path.exists(self.fitsimage)) imagename = self.fitsimage numpanels = '5,5' res = self.run_task(imagename=imagename, numpanels=numpanels) self.verify(numpanels)
def _restore(self, model_fits="", residual_ms="", restored_image="restored"): qa = casacore.casac.quanta ia = casacore.casac.image residual_image = "residual" os.system("rm -rf *.log *.last " + residual_image + ".* mod_out convolved_mod_out convolved_mod_out.fits " + restored_image + " " + restored_image + ".fits") importfits(imagename="model_out", fitsimage=self.model_fits) shape = imhead(imagename="model_out", mode="get", hdkey="shape") pix_num = shape[0] cdelt = imhead(imagename="model_out", mode="get", hdkey="cdelt2") cdelta = qa.convert(v=cdelt, outunit="arcsec") cdeltd = qa.convert(v=cdelt, outunit="deg") pix_size = str(cdelta['value']) + "arcsec" tclean(vis=residual_ms, imagename=residual_image, specmode='mfs', deconvolver='hogbom', niter=0, stokes=self.stokes, weighting='briggs', nterms=1, robust=self.robust, imsize=[self.M, self.N], cell=self.cell, datacolumn='RESIDUAL') exportfits(imagename=residual_image + ".image", fitsimage=residual_image + ".image.fits", overwrite=True, history=False) ia.open(infile=residual_image + ".image") rbeam = ia.restoringbeam() ia.done() ia.close() bmaj = imhead(imagename=residual_image + ".image", mode="get", hdkey="beammajor") bmin = imhead(imagename=residual_image + ".image", mode="get", hdkey="beamminor") bpa = imhead(imagename=residual_image + ".image", mode="get", hdkey="beampa") minor = qa.convert(v=bmin, outunit="deg") pa = qa.convert(v=bpa, outunit="deg") ia.open(infile="model_out") ia.convolve2d(outfile="convolved_model_out", axes=[ 0, 1], type='gauss', major=bmaj, minor=bmin, pa=bpa) ia.done() ia.close() exportfits(imagename="convolved_model_out", fitsimage="convolved_model_out.fits", overwrite=True, history=False) ia.open(infile="convolved_model_out.fits") ia.setrestoringbeam(beam=rbeam) ia.done() ia.close() imagearr = ["convolved_model_out.fits", residual_image + ".image.fits"] immath(imagename=imagearr, expr=" (IM0 + IM1) ", outfile=restored_image) exportfits(imagename=restored_image, fitsimage=restored_image + ".fits", overwrite=True, history=False) return residual_image + ".image.fits", restored_image + ".fits"
clean(vis=vis, imagename=imagename, field=target,spw='', mode='mfs', # use channel to get cubes niter=5000, gain=0.1, threshold='1.0mJy', psfmode='clark', multiscale=[0], interactive=False, imsize=[2560,2560], cell=['0.1arcsec','0.1arcsec'], stokes='I', weighting='uniform', allowchunk=True, mask=[[1041,1271,1100,1394],[1500,1750,1600,1800],[1014,1150,1525,1701]], usescratch=True) exportfits(imagename=imagename+".image", fitsimage=imagename+".fits") # imagename = prefix+"_mfs_uni" # clean(vis=vis, # imagename=imagename, # field=target,spw='', # mode='mfs', # use channel to get cubes # nterms=2, # niter=5000, # gain=0.1, threshold='1.0mJy', # psfmode='clark', # multiscale=[0], # interactive=False, # imsize=[2560,2560], cell=['0.1arcsec','0.1arcsec'], # stokes='I', # mask=[[1041,1271,1100,1394],[1612,1692,1670,1760]],
immath(imagename=[ dir_image + name_line + ".moment0_tmp", dir_image + name_line + ".moment1_tmp" ], expr="iif( IM0>=" + str(peak * percents[i]) + ", IM1, 0.0)", outfile=dir_image + name_line + ".moment1") immath(imagename=[ dir_image + name_line + ".moment0_tmp", dir_image + name_line + ".moment8_tmp" ], expr="iif( IM0>=" + str(peak * percents[i]) + ", IM1, 0.0)", outfile=dir_image + name_line + ".moment8") exportfits(imagename=dir_image + name_line + ".moment0", fitsimage=dir_image + name_line + ".moment0.fits") exportfits(imagename=dir_image + name_line + ".moment1", fitsimage=dir_image + name_line + ".moment1.fits") os.system("rm -rf " + cubeimage + ".pbcor.maskedTF") os.system("rm -rf " + dir_image + name_line + ".moment0.noise_tmp") os.system("rm -rf " + dir_image + name_line + ".moment0_tmp") os.system("rm -rf " + dir_image + name_line + ".moment1_tmp") os.system("rm -rf " + dir_image + name_line + ".moment8_tmp") # other images, not cubes imagenames = glob.glob(dir_proj + "*image*") imagenames.sort() dir_image = dir_proj + "../image_others/" os.system("rm -rf " + dir_image)
def makefits(myimagebase, cleanup=True): if os.path.exists(myimagebase + '.image.tt0'): impbcor(imagename=myimagebase + '.image.tt0', pbimage=myimagebase + '.pb.tt0', outfile=myimagebase + '.image.tt0.pbcor', overwrite=True) # perform PBcorr exportfits(imagename=myimagebase + '.image.tt0.pbcor', fitsimage=myimagebase + '.image.tt0.pbcor.fits', overwrite=True) # export the corrected image exportfits(imagename=myimagebase + '.image.tt1', fitsimage=myimagebase + '.image.tt1.fits', overwrite=True) # export the corrected image exportfits(imagename=myimagebase + '.pb.tt0', fitsimage=myimagebase + '.pb.tt0.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.model.tt0', fitsimage=myimagebase + '.model.tt0.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.model.tt1', fitsimage=myimagebase + '.model.tt1.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.residual.tt0', fitsimage=myimagebase + '.residual.tt0.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.alpha', fitsimage=myimagebase + '.alpha.fits', overwrite=True) exportfits(imagename=myimagebase + '.alpha.error', fitsimage=myimagebase + '.alpha.error.fits', overwrite=True) if cleanup: for ttsuffix in ('.tt0', '.tt1', '.tt2'): for suffix in ('pb{tt}', 'weight', 'sumwt{tt}', 'psf{tt}', 'model{tt}', 'mask', 'image{tt}', 'residual{tt}', 'alpha', 'alpha.error'): os.system('rm -rf {0}.{1}'.format( myimagebase, suffix).format(tt=ttsuffix)) elif os.path.exists(myimagebase + '.image'): impbcor(imagename=myimagebase + '.image', pbimage=myimagebase + '.pb', outfile=myimagebase + '.image.pbcor', overwrite=True) # perform PBcorr exportfits(imagename=myimagebase + '.image.pbcor', fitsimage=myimagebase + '.image.pbcor.fits', overwrite=True) # export the corrected image exportfits(imagename=myimagebase + '.pb', fitsimage=myimagebase + '.pb.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.model', fitsimage=myimagebase + '.model.fits', overwrite=True) # export the PB image exportfits(imagename=myimagebase + '.residual', fitsimage=myimagebase + '.residual.fits', overwrite=True) # export the PB image if cleanup: ttsuffix = '' for suffix in ('pb{tt}', 'weight', 'sumwt{tt}', 'psf{tt}', 'model{tt}', 'mask', 'image{tt}', 'residual{tt}', 'alpha', 'alpha.error'): os.system('rm -rf {0}.{1}'.format(myimagebase, suffix).format(tt=ttsuffix)) else: raise IOError("No image file found matching {0}".format(myimagebase))
) makefits(imagename) dirtyimage = imagename + '.image.tt0' ia.open(dirtyimage) ia.calcmask(mask=dirtyimage + " > 0.0025", name='dirty_mask_{0}'.format(field_nospace)) ia.close() makemask(mode='copy', inpimage=dirtyimage, inpmask=dirtyimage + ":dirty_mask_{0}".format(field_nospace), output='dirty_mask_{0}.mask'.format(field_nospace), overwrite=True) mask = 'dirty_mask_{0}.mask'.format(field_nospace) exportfits(mask, mask + '.fits', dropdeg=True, overwrite=True) exportfits(dirtyimage, dirtyimage + ".fits", overwrite=True) reg = pyregion.open('cleanbox_regions_{0}.reg'.format(field_nospace)) imghdu = fits.open(dirtyimage + ".pbcor.fits")[0] imghdu2 = fits.open(dirtyimage + ".fits")[0] mask = reg.get_mask(imghdu)[None, None, :, :] imghdu2.data = mask.astype('int16') imghdu2.header['BITPIX'] = 16 imghdu2.writeto('cleanbox_mask_{0}.fits'.format(field_nospace), clobber=True) importfits(fitsimage='cleanbox_mask_{0}.fits'.format(field_nospace), imagename=cleanbox_mask_image, overwrite=True) #ia.open(cleanbox_mask_image) #im = ia.adddegaxes(spectral=True, stokes='I', overwrite=True)
os.system("rm -rf " + dir_proj + "image_ratio/") os.system("mkdir " + dir_proj + "image_ratio/") m0_12co10 = imagenames[0] m0_12co21 = imagenames[1] m0_13co10 = imagenames[2] m0_13co21 = imagenames[3] cliplevel1 = [0.03, 0.08, 0.03, 0.08] factor = [ 4.0, 4.0, 230.53800000**2 / 220.39868420**2, 115.27120180**2 / 110.20135430**2 ] name_im0 = ["12co21", "13co21", "12co21", "12co10"] name_im1 = ["12co10", "13co10", "13co21", "13co10"] im0 = [m0_12co21, m0_13co21, m0_12co21, m0_12co10] im1 = [m0_12co10, m0_13co10, m0_13co21, m0_13co10] for i in range(len(im0)): makeratio(im0[i], im1[i], name_im0[i], name_im1[i], cliplevel1[i], factor[i]) ### exportfits imagenames = glob.glob(dir_proj + "image_ratio/ratio*.image") for i in range(len(imagenames)): os.system("rm -rf " + imagenames[i].replace(".image", ".fits")) exportfits(imagename=imagenames[i], fitsimage=imagenames[i].replace(".image", ".fits"))
def split_and_cal(rootvis, rootprefix, spwn, fluxcal, phasecal, target, anttable=[], fieldpre=[], fresh_clean=False): print "Beginning calibration and mapping of spw ", spwn prefix = rootprefix+"_spw"+spwn # hopefully this decreases read/write times... vis = outvis = prefix+".ms" split(vis=rootvis, outputvis=outvis, spw=spwn, datacolumn='all') listobs(outvis) plotants(vis=vis,figfile=prefix+'plotants_'+vis+".png") #plotms(vis=vis, xaxis='', yaxis='', averagedata=False, transform=False, extendflag=False, # plotfile='FirstPlot_AmpVsTime.png',selectdata=True,field='') plotms(vis=vis, spw='0', averagedata=True, avgchannel='64', avgtime='5', xaxis='uvdist', yaxis='amp', field=phasecal, plotfile=prefix+"phasecal_%s_AmpVsUVdist_spw%s.png" % (phasecal,spwn),overwrite=True) plotms(vis=vis, spw='0', averagedata=True, avgchannel='64', avgtime='5', xaxis='uvdist', yaxis='amp', field=fluxcal, plotfile=prefix+"fluxcal_%s_AmpVsUVdist_spw%s.png" % (fluxcal,spwn),overwrite=True) plotms(vis=vis, spw='0', averagedata=True, avgchannel='64', avgtime='5', xaxis='uvdist', yaxis='amp', field=target, plotfile=prefix+"target_%s_AmpVsUVdist_spw%s.png" % (target,spwn),overwrite=True) plotms(vis=vis, field='',correlation='RR,LL',timerange='',antenna='ea01',spw='0', xaxis='time',yaxis='antenna2',coloraxis='field',plotfile=prefix+'antenna2vsantenna1vstime_spw%s.png' % spwn,overwrite=True) #gencal(vis=vis,caltable=prefix+".antpos",caltype="antpos") # this apparently doubles the data size... clearcal(vis=vis,field='',spw='') #setjy(vis=vis, listmodels=T) gaincal(vis=vis, caltable=prefix+'.G0all', field='0,1', refant='ea21', spw='0:32~96', gaintype='G',calmode='p', solint='int', minsnr=5, gaintable=anttable) #didn't work plotcal(caltable=prefix+'.G0all',xaxis='time',yaxis='phase', spw='0', poln='R',plotrange=[-1,-1,-180,180], figfile=prefix+'.G0all.png') gaincal(vis=vis, caltable=prefix+'.G0', field=fluxcal, refant='ea21', spw='0:20~100', calmode='p', solint='int', minsnr=5, gaintable=anttable) plotcal(caltable=prefix+'.G0',xaxis='time',yaxis='phase', spw='0', poln='R',plotrange=[-1,-1,-180,180], figfile=prefix+'.G0.png') gaincal(vis=vis,caltable=prefix+'.K0', field=fluxcal,refant='ea21',spw='0:5~123',gaintype='K', solint='inf',combine='scan',minsnr=5, gaintable=anttable+[ prefix+'.G0']) plotcal(caltable=prefix+'.K0',xaxis='antenna',yaxis='delay', spw='0', figfile=prefix+'.K0_delayvsant_spw'+spwn+'.png') bandpass(vis=vis,caltable=prefix+'.B0', field=fluxcal,spw='0',refant='ea21',solnorm=True,combine='scan', solint='inf',bandtype='B', gaintable=anttable+[ prefix+'.G0', prefix+'.K0']) # In CASA plotcal(caltable= prefix+'.B0',poln='R', spw='0', xaxis='chan',yaxis='amp',field=fluxcal,subplot=221, figfile=prefix+'plotcal_fluxcal-B0-R-amp_spw'+spwn+'.png') # plotcal(caltable= prefix+'.B0',poln='L', spw='0', xaxis='chan',yaxis='amp',field=fluxcal,subplot=221, figfile=prefix+'plotcal_fluxcal-B0-L-amp_spw'+spwn+'.png') # plotcal(caltable= prefix+'.B0',poln='R', spw='0', xaxis='chan',yaxis='phase',field=fluxcal,subplot=221, plotrange=[-1,-1,-180,180], figfile=prefix+'plotcal_fluxcal-B0-R-phase_spw'+spwn+'.png') # plotcal(caltable= prefix+'.B0',poln='L', spw='0', xaxis='chan',yaxis='phase',field=fluxcal,subplot=221, plotrange=[-1,-1,-180,180], figfile=prefix+'plotcal_fluxcal-B0-L-phase_spw'+spwn+'.png') gaincal(vis=vis,caltable=prefix+'.G1', field=fluxcal,spw='0:5~123', solint='inf',refant='ea21',gaintype='G',calmode='ap',solnorm=F, gaintable=anttable+[ prefix+'.K0', prefix+'.B0']) gaincal(vis=vis,caltable=prefix+'.G1', field=phasecal, spw='0:5~123',solint='inf',refant='ea21',gaintype='G',calmode='ap', gaintable=anttable+[ prefix+'.K0', prefix+'.B0'], append=True) plotcal(caltable=prefix+'.G1',xaxis='time',yaxis='phase', spw='0', poln='R',plotrange=[-1,-1,-180,180],figfile=prefix+'plotcal_fluxcal-G1-phase-R_spw'+spwn+'.png') plotcal(caltable=prefix+'.G1',xaxis='time',yaxis='phase', spw='0', poln='L',plotrange=[-1,-1,-180,180],figfile=prefix+'plotcal_fluxcal-G1-phase-L_spw'+spwn+'.png') plotcal(caltable=prefix+'.G1',xaxis='time',yaxis='amp', spw='0', poln='R',figfile=prefix+'plotcal_fluxcal-G1-amp-R_spw'+spwn+'.png') plotcal(caltable=prefix+'.G1',xaxis='time',yaxis='amp', spw='0', poln='L',figfile=prefix+'plotcal_fluxcal-G1-amp-L_spw'+spwn+'.png') myscale = fluxscale(vis=vis, caltable=prefix+'.G1', fluxtable=prefix+'.fluxscale1', reference=[fluxcal], transfer=[phasecal]) applycal(vis=vis, field=fluxcal, spw='0', gaintable=anttable+[ prefix+'.fluxscale1', prefix+'.K0', prefix+'.B0', ], gainfield=fieldpre+[fluxcal,'',''], interp=fieldpre+['nearest','',''], calwt=F) applycal(vis=vis, field=phasecal, spw='0', gaintable=anttable+[ prefix+'.fluxscale1', prefix+'.K0', prefix+'.B0', ], gainfield=fieldpre+[phasecal,'',''], interp=fieldpre+['nearest','',''], calwt=F) applycal(vis=vis, field=target, spw='0', gaintable=anttable+[ prefix+'.fluxscale1', prefix+'.K0', prefix+'.B0', ], gainfield=fieldpre+[phasecal,'',''], interp=fieldpre+['linear','',''], calwt=F) plotms(vis=prefix+'.ms',field=fluxcal,correlation='', spw='0', antenna='',avgtime='60s', xaxis='channel',yaxis='amp',ydatacolumn='corrected', plotfile=prefix+'_fluxcal-corrected-amp_spw'+spwn+'.png',overwrite=True) # plotms(vis=prefix+'.ms',field=fluxcal,correlation='', spw='0', antenna='',avgtime='60s', xaxis='channel',yaxis='phase',ydatacolumn='corrected', plotrange=[-1,-1,-180,180],coloraxis='corr', plotfile=prefix+'_fluxcal-corrected-phase_spw'+spwn+'.png',overwrite=True) # plotms(vis=prefix+'.ms',field=phasecal,correlation='RR,LL', spw='0', timerange='',antenna='',avgtime='60s', xaxis='channel',yaxis='amp',ydatacolumn='corrected', plotfile=prefix+'_phasecal-corrected-amp_spw'+spwn+'.png',overwrite=True) # plotms(vis=prefix+'.ms',field=phasecal,correlation='RR,LL', spw='0', timerange='',antenna='',avgtime='60s', xaxis='channel',yaxis='phase',ydatacolumn='corrected', plotrange=[-1,-1,-180,180],coloraxis='corr', plotfile=prefix+'_phasecal-corrected-phase_spw'+spwn+'.png',overwrite=True) plotms(vis=prefix+'.ms',field=phasecal,correlation='RR,LL', spw='0', timerange='',antenna='',avgtime='60s', xaxis='phase',xdatacolumn='corrected',yaxis='amp',ydatacolumn='corrected', plotrange=[-180,180,0,3],coloraxis='corr', plotfile=prefix+'_phasecal-corrected-ampvsphase_spw'+spwn+'.png',overwrite=True) plotms(vis=vis,xaxis='uvwave',yaxis='amp', spw='0', field=fluxcal,avgtime='30s',correlation='RR', plotfile=prefix+'_fluxcal-mosaic0-uvwave_spw'+spwn+'.png',overwrite=True) plotms(vis=vis,xaxis='uvwave',yaxis='amp', spw='0', field=target,avgtime='30s',correlation='RR', plotfile=prefix+'_target-mosaic0-uvwave_spw'+spwn+'.png',overwrite=True) for antenna in xrange(28): plotms(vis=vis, xaxis='time', yaxis='amp', spw='0', field='', avgchannel='64', coloraxis='corr', avgtime='5s', antenna='%i' % antenna, plotfile=prefix+"_antenna%02i_ampVStime.png" % antenna, overwrite=True) imagename = prefix+"_mfs" if fresh_clean: shutil.rmtree(imagename+".model") shutil.rmtree(imagename+".image") shutil.rmtree(imagename+".psf") shutil.rmtree(imagename+".flux") shutil.rmtree(imagename+".residual") clean(vis=outvis, imagename=imagename, field=target,spw='', mode='mfs', # use channel to get cubes nterms=1, # no linear polynomial niter=5000, gain=0.1, threshold='1.0mJy', psfmode='clark', multiscale=[0], interactive=False, imsize=[2560,2560], cell=['0.1arcsec','0.1arcsec'], stokes='I', weighting='uniform', allowchunk=True, usescratch=True) exportfits(imagename=imagename+".image", fitsimage=imagename+".fits", overwrite=True) print "Finished spw ",spwn
def exportMStoFITS(msname=""): fitsfile_name = msname + ".fits" exportfits(msname, fitsfile_name) return fitsfile_name