######################################################################## # Data reduction script for CenA Band 6: # - Imaging script: "CenA_Band6_Imaging.py" - # Tested in CASA Version 3.3.0 (r16856) ######################################################################## """ See accompanying README file for details of the necessary input files and comments on the data """ name='CenA.cal.rebin' #----- Inspect the line data plotms(vis=name+'.ms',xaxis='channel',yaxis='amp',spw='2', avgtime='1e8',avgscan=T,plotfile='CenA-AMPvsCH.png') # Center on field 20 of the mosaic #---------------------------------------------------------------------------------- #------ Continuum Imaging --------------------------------------------------------- #---------------------------------------------------------------------------------- #----- Make Dirty Continuum image os.system('rm -rf CenA.Cont.Dirty*') clean(vis=name+'.ms',imagename='CenA.Cont.Dirty', field='',phasecenter='20', mode='mfs',restfreq='230.538GHz', spw='0,1,2:1~30;226~255,3', imagermode='mosaic', imsize=1296,cell='0.25arcsec', interactive=F,niter=0, cyclefactor=1.5,cyclespeedup=50) #----- Make Clean Continuum image #----- Clean may take a long time - add async=True to run clean asynchronously os.system('rm -rf CenA.Cont.Clean*') clean(vis=name+'.ms',imagename='CenA.Cont.Clean', field='',phasecenter='20', mode='mfs',restfreq='230.538GHz', spw='0,1,2:1~30;226~255,3', imagermode='mosaic', imsize=1296,cell='0.25arcsec', interactive=F, niter=1000,threshold='0.1mJy', mask=[565,660,630,715], cyclefactor=1.5,cyclespeedup=50) #----- Get some statistics on the continuum maps. imstat('CenA.Cont.Clean.image') #----- Make plot of continuum image and inspect data imview(raster={'file': 'CenA.Cont.Clean.image','colorwedge':T,'colormap': 'Rainbow 2'}, out="CenA_Cont_image.png") plotms(vis = name+'.ms', xaxis='uvdist', yaxis='amp', ydatacolumn='corrected', field='0', averagedata=True, avgchannel='256', avgtime='', avgscan=F, avgbaseline=F, coloraxis='corr') #---------------------------------------------------------------------------------- #----- Self-calibration ----------------------------------------------------------- #---------------------------------------------------------------------------------- os.system('rm -rf self_1.pcal') gaincal(vis=name+'.ms',caltable='self_1.pcal', solint='600s',combine='scan',gaintype='T',field='0', refant='DV03',spw='0~2:1~50;250~256,3',minblperant=4, calmode='p',minsnr=2) #----- Plot the calibration solutions plotcal(caltable='self_1.pcal',xaxis='time',yaxis='phase', spw='',field='',antenna='', iteration='antenna',subplot=531,plotrange=[0,0,-180,180], figfile='pcal1_phase.png') #----- Apply the solutions to all fields and channels with applycal, which will overwrite the corrected data column: applycal(vis=name+'.ms',field='', gaintable=['self_1.pcal'],calwt=F) #---------------------------------------------------------------------------------- #----- Spectral Line Imaging ------------------------------------------------------ #---------------------------------------------------------------------------------- #----- Split out spectral line data os.system('rm -rf CenA.cal.line.ms') split(vis = name+'.ms',outputvis = name+'.line.ms', field = 'Cent*',spw='2', keepflags=False) #----- Continuum subtraction (in the uv plane) os.system('rm -rf CenA.cal.line.ms.contsub*') uvcontsub2(vis=name+'.line.ms',fitspw='0:1~50;200~255', field='', combine='', solint='int',fitorder = 1) #----- Make a plot of line spectrum plotms(vis=name+'.line.ms.contsub',xaxis='velocity',yaxis='amp', avgtime='1e8',avgscan=T,transform=T,freqframe='LSRK', restfreq='230.538GHz',plotfile='CO2_1_velocity.png') #----- Make Clean Spectral line image os.system('rm -rf CenA.CO2_1Line*') clean(vis=name+'.line.ms.contsub', imagename='CenA.CO2_1Line.Clean', spw='0',field='',phasecenter='0', mode='velocity',outframe='LSRK',restfreq='230.538GHz', nchan=35,start='200km/s',width='20km/s', imagermode='mosaic', imsize=[1350,900],cell='0.2arcsec',minpb=0.2, weighting='briggs',robust=0.5, niter=1000, threshold='0.01mJy', psfmode='clark',ftmachine='mosaic',mosweight=False, scaletype='SAULT',veltype='radio',pbcor=False, npercycle=100,cyclefactor=1.5,cyclespeedup=-1, interactive=T) imview('CenA.CO2_1Line.Clean.image') #----- Create moment maps os.system('rm -rf CenA.CO2_1Line.Clean.image.mom* ') immoments('CenA.CO2_1Line.Clean.image', moments=[0],chans='1~33', mask='CenA.CO2_1Line.Clean.image>0.005', outfile='CenA.CO2_1Line.Clean.image.mom0') immoments('CenA.CO2_1Line.Clean.image', moments=1, chans='1~33', mask='CenA.CO2_1Line.Clean.image>0.005*3', outfile='CenA.CO2_1Line.Clean.image.mom1') immoments('CenA.CO2_1Line.Clean.image', moments=2, chans='1~33', mask='CenA.CO2_1Line.Clean.image>0.005*3', outfile='CenA.CO2_1Line.Clean.image.mom2') os.system('rm -f CenA.CO2_1Line.Clean.image.mom0.png') imview (raster={'file': 'CenA.CO2_1Line.Clean.image.mom0', 'colorwedge':T,'scaling': -0.5,'range':[-3,30]}, zoom=1,out='CenA.CO2_1Line.Clean.image.mom0.png') os.system('rm -f CenA.CO2_1Line.Clean.image.mom1.png') imview (raster={'file': 'CenA.CO2_1Line.Clean.image.mom1', 'colorwedge':T}, zoom=1,out='CenA.CO2_1Line.Clean.image.mom1.png') os.system('rm -f CenA.CO2_1Line.Clean.image.mom2.png') imview (raster={'file': 'CenA.CO2_1Line.Clean.image.mom2', 'colorwedge':T}, zoom=1,out='CenA.CO2_1Line.Clean.image.mom2.png') #----- Export as fits exportfits(imagename='CenA.Cont.Clean.image', fitsimage='CenA.Cont.Clean.image.fits') exportfits(imagename='CenA.CO2_1Line.Clean.image', fitsimage='CenA.CO2_1Line.Clean.image.fits') exportfits(imagename='CenA.CO2_1Line.Clean.image.mom0', fitsimage='CenA.CO2_1Line.Clean.image.mom0.fits') exportfits(imagename='CenA.CO2_1Line.Clean.image.mom1', fitsimage='CenA.CO2_1Line.Clean.image.mom1.fits') exportfits(imagename='CenA.CO2_1Line.Clean.image.mom2', fitsimage='CenA.CO2_1Line.Clean.image.mom2.fits') #---------------------------------------------------------------------------------- #----- End of imaging script. #----------------------------------------------------------------------------------