############################################################################# # # # A VLA (D-config) 43 GHz continuum fast-switching observation of M82 # # # # Initial by GM 2009-05-27 (Beta 2.4) init minimally annotated version # # Revised by GM 2009-06-01 added opacity (0.09), gaincurve # # added ~scan-based phase solution # # use weighting='briggs' in clean # # Revised by GM 2000-06-02 added more plotting, split m82 # # removed 'briggs' weighting # # # # This calibration example is a good demonstration of calibration and # # and imaging of a mariginally phase-coherent 43 GHz VLA continuum # # fast-switching observation of M82. The observation is nearly 4h46m # # long, uses 3.33s integrations, has 2 spws, and the dataset has # # ~3.3M visibilities (time/spw/baseline points). The phases are # # extremely variable, but most are reasonably calibratable. # # Although reference pointing was done every 90 min or so, the # # deterioration of the pointing is evident in the data and calibration # # amplitudes as a function of time after each pointing scan (the pointing # # scans are not filled, but the gaps where they occur are readily evident). # # # # The resulting image reveals the large-scale structure of M82, but with # # insufficient resolution to resolve the discrete sources isolated by # # the corresponding B-array demo. The comparison of pre-calibration, # # dirty and cleaned (natural, robust, tapered)images is a compelling # # demonstration of the important of calibration and deconvolution. # # # # Required for this script (in the directory from which it is run): # # - this script # # - The AA243_A000811.xp{5,6} VLA archive files # # - The 3C286_Q.im model image from the data repository # # # # Wishlist: # # - Add some cleanup and other niceties # # - Add opacity, gaincurve # # - Should final phase solution be scan averages? # # - Pending fluxscale improvements, do a selective fluxscale # # to avoid using solutions from poorly pointed data to set # # the f.d. scale. # # - Improve the imaging with clean boxes? # # - selfcal? most of the power is only on the shortest baselines... # # - Add some image analysis (peak, rms, etc.) # # - Make a regression out of this reduction # # # ############################################################################# # some file and table names to use below arch=['AA243_A000811.xp5','AA243_A000811.xp6'] fdmodel='3C286_Q.im' msname='m82D.ms' phasecal1='m82D.intphase.G' ampcal='m82D.scanamp.G' phasecal2='m82D.scanphase.G' fluxcal=ampcal+'flx' # Fill from VLA archive files #-------------------------------------- importvla(archivefiles=arch,vis=msname) # Scan listing, initial plots, etc. #-------------------------------------- listobs(msname) plotxy(vis=msname,xaxis='time',yaxis='amp',selectdata=T,correlation="RR,LL") plotxy(vis=msname,xaxis='time',yaxis='phase',selectdata=T,correlation="RR,LL") # ...only VA10-VA11 in spw 0 plotxy(vis=msname,xaxis='time',yaxis='phase',spw='0',selectdata=T,correlation="RR,LL",antenna='VA10 & VA11',plotsymbol='o') # ...only the calibrators plotxy(vis=msname,xaxis='time',yaxis='phase',spw='0',field='0,1,3',selectdata=T,correlation="RR,LL",antenna='VA10 & VA11',plotsymbol='o') # ...with scan-averaging plotxy(vis=msname,xaxis='time',yaxis='phase',spw='0',field='0,1,3',selectdata=T,correlation="RR,LL",antenna='VA10 & VA11',plotsymbol='o',timebin='60') # Basic commanded flagging #-------------------------------------- # quack (to lop off first few integrations in each scan) # scan; all "low" integrations are already flagged online, # but there may occasionally be one or two integrations that # have only a few unflagged baselines; NB: the quackinterval # is a bit longer than what one would use in AIPS because # casa fills a bit more of the online-flagged data) flagdata(vis=msname,mode='quack',quackinterval=14) # zoom in on this plot to see effect of quack plotxy(vis=msname,xaxis='time',yaxis='amp',selectdata=T,correlation="RR,LL") # Pre-calibration images # uncal'd calibrator clean(vis=msname,imagename='m82D.uncal_cal_dirty', imsize=[256,256], cell=['0.3arcsec','0.3arcsec'], niter=0, field='1') # uncal'd m82 clean(vis=msname,imagename='m82D.uncal_dirty', imsize=[400,400], cell=['0.3arcsec','0.3arcsec'], niter=0, field='2') # Calibration! #---------------------------------------- The calibration steps: 1. Set the f.d. calibrator model (the gain calibrator already set to 1) 2. Solve for per-integration phase 3. Solve for per-scan amplitude, using the per-int phase 4. Solve for per-scan phase, using amplitude (discard per-int phase) Notes: 1. Using opacity=0.09 2. Using VLA gain curve 3. Reference antenna (phase) VA26 # Set f.d. model (3C286): setjy(vis=msname,field='1328+307',modimage=fdmodel) # f.d. calibrator, model and data side-by-side plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='model',field='3',selectdata=T,correlation="RR,LL",subplot=121,plotrange=[0,0,0,2]) plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='data',field='3',selectdata=T,correlation="RR,LL",subplot=122,plotrange=[0,0,0,2]) # gain calibrator, model and data side-by-side plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='model',field='0,1',selectdata=T,correlation="RR,LL",subplot=121,plotrange=[0,0,0,1]) plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='data',field='0,1',selectdata=T,correlation="RR,LL",subplot=122,plotrange=[0,0,0,1]) # gaincal (fast phase-only) gaincal(vis=msname,caltable=phasecal1, field='0,1,3', calmode='p',solint='int', refant='VA26', opacity=0.09, gaincurve=T) # plot the solution plotcal(caltable=phasecal1,yaxis='phase') plotcal(caltable=phasecal1,yaxis='snr') plotcal(caltable=phasecal1,yaxis='phase',subplot=313,iteration='antenna') # gaincal (slower amp-only, using phase from above) gaincal(vis=msname,caltable=ampcal, field='0,1,3', calmode='a',solint='inf', refant='VA26', gaintable=phasecal1,interp='nearest', opacity=0.09, gaincurve=T) # plot the solution # (flag a bad range on VA11, maybe also a few other antennas) plotcal(caltable=ampcal,yaxis='amp') plotcal(caltable=ampcal,yaxis='snr') plotcal(caltable=ampcal,yaxis='amp',subplot=313,iteration='antenna') # gaincal with more modest phase timescale for better SNR and tracking gaincal(vis=msname,caltable=phasecal2, field='0,1,3', calmode='p',solint='40s', refant='VA26', gaintable=ampcal,interp='nearest', opacity=0.09, gaincurve=T) # plot the solution plotcal(caltable=phasecal2,yaxis='phase') plotcal(caltable=phasecal2,yaxis='snr') plotcal(caltable=phasecal2,yaxis='phase',spw='0',subplot=313,iteration='antenna') # fluxscale to transfer proper scale to phase-calibrator # (this isn't quite ideal since it uses all of the phase-calibrator # scans and all antennas, and many of these solutions are poor due # to deteriorating pointing....) fluxscale(vis=msname, caltable=ampcal,fluxtable=fluxcal, reference='1328+307') # plot the solutions, before and after plotcal(caltable=ampcal,yaxis='amp',subplot=121,plotrange=[0,0,0,0.6]) plotcal(caltable=fluxcal,yaxis='amp',subplot=122,plotrange=[0,0,0,0.6]) # accum to show interpolation effects in plocal # (only for illustration) # accumulate phase on calibrators accum(vis=msname, incrtable=phasecal2, caltable='m82D.accum1', field='0,1,3',calfield='0,1,3',interp='nearest') # ...and onto M82 accum(vis=msname,tablein='m82D.accum1', incrtable=phasecal2, caltable='m82D.accum2', field='2',calfield='0,1',interp='linear') # acummulate amplitude on calibrators accum(vis=msname,tablein='m82D.accum2', incrtable=fluxcal, caltable='m82D.accum3', field='0,1,3',calfield='0,1,3',interp='nearest') # ...and onto M82 accum(vis=msname,tablein='m82D.accum3', incrtable=fluxcal, caltable='m82D.accum4', field='2',calfield='0,1',interp='linear') # plot accum'd solutions, zoom in on pieces to see what's happening plotcal(caltable='m82D.accum4',yaxis='amp',antenna='VA08') plotcal(caltable='m82D.accum4',yaxis='phase',antenna='VA08') # apply the calibration to each source # (alternatively could use m82D.accum4 from above) # calibrators w/ nearest interpolation applycal(vis=msname, field='0,1,3', gaintable=[phasecal2,fluxcal], interp=['nearest','nearest'], opacity=0.09, gaincurve=T) # target with linear interpolation applycal(vis=msname, field='2', gaintable=[phasecal2,fluxcal], gainfield=[[0,1],[0,1]], interp=['linear','linear'], opacity=0.09, gaincurve=T) # f.d. calibrator, model and corrected data side-by-side # AMP plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='data',field='3',selectdata=T,correlation="RR,LL",subplot=131,plotrange=[0,0,0,2],timebin='500') plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='model',field='3',selectdata=T,correlation="RR,LL",subplot=132,plotrange=[0,0,0,2],timebin='500') plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='corrected',field='3',selectdata=T,correlation="RR,LL",subplot=133,plotrange=[0,0,0,2],timebin='500') # PHASE plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='data',field='3',selectdata=T,correlation="RR,LL",subplot=131,plotrange=[0,0,-180,180],timebin='500') plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='model',field='3',selectdata=T,correlation="RR,LL",subplot=132,plotrange=[0,0,-180,180],timebin='500') plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='corrected',field='3',selectdata=T,correlation="RR,LL",subplot=133,plotrange=[0,0,-180,180],timebin='500') # gain calibrator, model and corrected data side-by-side # AMP plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='data',field='0,1',selectdata=T,correlation="RR,LL",subplot=131,plotrange=[0,0,0,1],timebin='100') plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='model',field='0,1',selectdata=T,correlation="RR,LL",subplot=132,plotrange=[0,0,0,1],timebin='100') plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='corrected',field='0,1',selectdata=T,correlation="RR,LL",subplot=133,plotrange=[0,0,0,1],timebin='100') # PHASE plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='data',field='0,1',selectdata=T,correlation="RR,LL",subplot=131,plotrange=[0,0,-180,180],timebin='100') plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='model',field='0,1',selectdata=T,correlation="RR,LL",subplot=132,plotrange=[0,0,-180,180],timebin='100') plotxy(vis=msname,xaxis='uvdist',yaxis='phase',datacolumn='corrected',field='0,1',selectdata=T,correlation="RR,LL",subplot=133,plotrange=[0,0,-180,180],timebin='100') # m82 in amplitude plotxy(vis=msname,xaxis='uvdist',yaxis='amp',datacolumn='data',field='2',selectdata=T,correlation="RR,LL",timebin='200') # clean to make dirty image: # calibrator clean(vis=msname,imagename='m82D.cal_dirty', imsize=[256,256], cell=['0.3arcsec','0.3arcsec'], niter=0, field='1') # m82 clean(vis=msname,imagename='m82D.dirty', imsize=[400,400], cell=['0.3arcsec','0.3arcsec'], niter=0, field='2') # split out m82 for careful imaging split(vis=msname,outputvis='m82D_m82only.ms',field='2'); # (see Crystal's demo for imaging/deconvolution...) # end