### ### Script for PdBI GG Tau data: ### 3mm LSB continuum data reduction and imaging only ### ########################################################### ## Include relevant tools if not already done: ## include 'almati2ms.g'; include 'ms.g'; include 'flagger.g'; include 'msplot.g'; include 'calibrater.g'; include 'viewer.g'; include 'imager.g'; include 'image.g'; include 'imagepol.g'; ########################################################### ## Fill Data: ## almatifiller(msfile='07feb97-g067.ms', # Create a Measurement Set with fitsdir='./fits', # the almatifiller global function. pattern='07-feb-1997*', # Specify the name of the MS, append=F, # the directory where the compress=F, # ALMA-TI FITS files are stored, obsmode="CORR", # and specify that all files chanzero="TIME_AVG"); # beginning with '07-feb-1997' # should be combined into one. ########################################################### ## Obtain a detailed summary (with default catalog tool): ## dc.summary('07feb97-g067.ms'); ########################################################### ## Manually plot the data for visual inspection, ## interactively flag bad data: ## ## see the data in x-y plot format: plot := msplot(msfile='07feb97-g067.ms', edit=T); # Allow editing as well as inspection ########################################################### ## Swap out IRAM PdBI on-line phase corrected data if not good: ## # Phase correction selection of all data: include 'iramcalibrater.g'; ical:=iramcalibrater(msname="07feb97-g067.ms", initcal=T); ical.phcor(trial=F); ical.done(); ########################################################### ########## 3 mm Calibration ########## ########################################################### ########################################################### ## Set flux density scale for the flux density calibrator ## (CRL618) imgr:=imager(filename='07feb97-g067.ms'); imgr.setjy(fieldid=4, spwid=3, fluxdensity=[1.55,0,0,0]); imgr.setjy(fieldid=4, spwid=11, fluxdensity=[2.2,0,0,0]); imgr.setjy(fieldid=4, spwid=15, fluxdensity=[2.2,0,0,0]); imgr.setjy(fieldid=4, spwid=19, fluxdensity=[2.2,0,0,0]); imgr.done(); ### CRL618 spwid= 3 [I=1.55, Q=0, U=0, V=0] Jy, (user-specified) ### CRL618 spwid= 11 [I=2.2, Q=0, U=0, V=0] Jy, (user-specified) ########################################################### ## Get first cut phase solutions to improve S/N for BPass determination: ## cal:=calibrater(filename='07feb97-g067.ms'); # Create calibrater tool for # GG Tau data set cal.setdata(mode='channel', # Select 3mm LSB continuum, bpcal nchan=30, # choose inner 30 chans start=15, # to avoid band edges. step=1, msselect='FIELD_ID==2 && SPECTRAL_WINDOW_ID==3'); cal.setsolvegainspline(table='ggtau.3mm.gcal0',# Setup to derive phase solns with: mode='PHAS', preavg=120, # 2 min preavg data to increase S/N, splinetime=10000, # spline fit timescale (~3hrs), refant=1, # refant = 1, npointaver=10, # minimize phase wrap pblms phasewrap=260, append=F); # create new table ggtau.3mm.gcal0 cal.solve(); # Solve for the solutions. ### ghostview 07feb97-g067.ms.PHAS.ps to see fit results. ########################################################### ## Derive bandpass calibration for 3mm LSB: ## cal.reset(); # Reset calibrator. cal.setdata(msselect='FIELD_ID==2 && SPECTRAL_WINDOW_ID==3'); # Select 3mm LSB continuum # & BPass cal (Field 2) # Default: Select all channels cal.setapply(type='GSPLINE', # Setup to apply 1st phase solutions table='ggtau.3mm.gcal0'); # before deriving BPass solns. cal.setsolvebandpoly(table='ggtau.3mm.bpoly', # Derive bandpass solns with: degamp=6, # amp poly order=6, degphase=12, # phase poly order=12, visnorm=F, # don't remove phase drifts with time, bpnorm=F, # do not normalize bp solutions, maskcenter=4, # do not use center 2 Gibbs chans, maskedge=3, # do not use last 3 end chans, refant=1, # choose ant 1 as refant, append=F); # create new table ggtau.3mm.bpoly cal.solve(); # Solve for the BPass solutions. ### ghostview 07feb97-g067.ms.RF_PHASE.ps & 07feb97-g067.ms.RF_AMP.ps ### to see fit results. ########################################################### ## Phase calibrate 3mm LSB: ## cal.reset(); # Reset calibrator. cal.setdata(msselect='FIELD_ID IN [1,2,4] && SPECTRAL_WINDOW_ID==3'); # Select 3mm LSB continuum # & all cals (Fields 1,2,4) # Default: select all channels cal.setapply(type='BPOLY', # Arrange to apply 3mm B solutions table='ggtau.3mm.bpoly'); # before deriving phase solns cal.setsolvegainspline(table='ggtau.3mm.gcal',# Derive phase solns with: mode='PHAS', # preavg=0, # no preaveraging of solns, splinetime=10000, # spline fit timescale (~3hrs) refant=1, # choose ant 1 as refant, npointaver=10, # minimize phase-wrap problems phasewrap=260, append=F); # create new table ggtau.3mm.gcal cal.solve(); # Solve for the phase at 3mm ########################################################### ## Apply all solutions derived so far, determine any residual ## phase errors, then derive the absolute flux density ## calibration of 3mm LSB continuum data: ## cal.reset(); # Reset calibrator. cal.setdata(msselect='FIELD_ID IN [1,2,4] && SPECTRAL_WINDOW_ID==3'); # Select 3mm LSB continuum # & all cals (Fields 1,2,4) # Default: select all channels cal.setapply(type='BPOLY', # Arrange to apply 3mm B solutions table='ggtau.3mm.bpoly'); # cal.setapply(type='GSPLINE', # Arrange to apply 3mm phase solns table='ggtau.3mm.gcal'); # cal.setsolve(type='T', # Solve for any residual phase table='ggtau.3mm.temp', # errors with a timescale of t=600, # 10 min. Use ant 1 as a refant=1); # reference. cal.solve(); # Solve for solutions. cal.plotcal(tablename='ggtau.3mm.temp', # Check plots of solutions. plottype='PHASE'); # (Phase & Amplitude) cal.plotcal(tablename='ggtau.3mm.temp', plottype='AMP'); cal.fluxscale(tablein='ggtau.3mm.temp', # Transfer the flux density scale tableout='ggtau.3mm.flux', # from CRL618 to g cals reference='CRL618', # 0528+134 & 0415+379. transfer='0415+379 0528+134'); # Write solutions to the table # cal.3mm.flux located on disk. ### Logger reports results: ### Flux density for 0415+379 (spw=3) is: 5.849 +/- 0.014 Jy ### Flux density for 0528+134 (spw=3) is: 2.634 +/- 0.007 Jy ########################################################### ## Record flux values from logger window. Manually insert ## fluxes with imgr.setjy: imgr:=imager(filename='07feb97-g067.ms'); # Start imager tool imgr.setjy(fieldid=1, # Set flux density scale for spwid=3, # 0415+379, 3mm LSB continuum fluxdensity=5.849); imgr.setjy(fieldid=2, # Set flux density scale for spwid=3, # 0528+134, 3mm LSB continuum fluxdensity=2.634); imgr.done(); ### 0415+379 spwid= 3 [I=5.849, Q=0, U=0, V=0] Jy, (user-specified) ### 0528+134 spwid= 3 [I=2.634, Q=0, U=0, V=0] Jy, (user-specified) ########################################################### ## Amplitude calibration of 3mm LSB: cal.reset(); # Reset setapply/setsolve cal.setdata(msselect='FIELD_ID IN [1,2,4] && SPECTRAL_WINDOW_ID==3'); # Select 3mm LSB continuum # & all cals (Fields 1,2,4) # Default: select all channels cal.setapply(type='BPOLY', # Arrange to apply B solutions table='ggtau.3mm.bpoly'); # from the ggtau.3mm.bpoly table. # before deriving amp solns cal.setapply(type='GSPLINE', # Arrange to apply phase solns table='ggtau.3mm.gcal'); # before deriving amp solns cal.setsolvegainspline(table='ggtau.3mm.gcal',# Arrange to solve amp solns with: mode='AMP', # preavg=20000/8, # preave data to reduce amp bias splinetime=20000, # spline fit timescale (~6hrs) refant=1, # choose ant = 1 as refant npointaver=10, # minimize phase-wrap problems phasewrap=260); # write to same ggtau.3mm.gcal table cal.solve(); # Solve for the amps at 3mm ########################################################### ## Correct the target source and all other 3mm LSB data: ## cal.reset(); # Reset setapply/setsolve cal.setdata(msselect='SPECTRAL_WINDOW_ID=3'); # Select all sources # in 3mm LSB continuum data cal.setapply(type='BPOLY', # Arrange to apply B solutions table='ggtau.3mm.bpoly'); # from the ggtau.3mm.bpoly table. cal.setapply(type='GSPLINE', # Arrange to apply flux-scaled gain table='ggtau.3mm.gcal'); # solutions (phase & amp) from # the ggtau.3mm.gcal table. cal.correct(); # Apply solutions and write the # CORRECTED_DATA column in the MS. cal.done(); ########################################################### ## Split out calibrated target source data: ## mset := ms(filename='07feb97-g067.ms', # Create the ms tool readonly=F); # Make sure it is writable! mset.split(outputms='ggtau.3mm.split.ms', # Select output file name, fieldids=3, # write out only ggtau data, spwids=3, # spectral window 3 (3mm LSB), nchan=64, # write out all 64 channels, start=1, # starting with channel 1, step=1, # no channel averaging, whichcol='CORRECTED_DATA'); # write out CORRECTED_DATA column. mset.done(); # Finish this tool dc.summary('ggtau.3mm.split.ms'); # Get a new summary ########################################################### ## Get a first image the target source in 3 mm continuum emission: ## imgr:=imager(filename='ggtau.3mm.split.ms'); # Create imager tool if not already done. imgr.setdata(mode='channel', # Select channel data for GG Tau nchan=64, start=1, # Choose all channels beginning step=1, spwid=1, # at channel 1. fieldid=1); imgr.advise(takeadvice=F, # Determine image and cell size using amplitudeloss=0.05, # advise function. Do not take advice, fieldofview='55arcsec'); # note parameters in logger window # and use as a basis for setimage. imgr.setimage(nx=256, ny=256, # Set image plane parameters cellx='0.2arcsec', celly='0.2arcsec', stokes='I', # Image total intensity mode='mfs', # Use multi-frequency synthesis nchan=1, start=4, # Merge selected 58 channels into 1 step=58, spwid=1, fieldid=1); imgr.weight(type='briggs', # Set up Robust weighting rmode='norm', robust=0.5); imgr.clean(algorithm='clark', # Image & deconvolve with 100 iterations niter=100, # using the Clark CLEAN algorithm. gain=0.1, model='ggtau.3mm.model1', image='ggtau.3mm.im1', # Write the cleaned image to the file residual='ggtau.3mm.resid1',# ggtau.3mm.im1 on disk. mask='', # Clean only the inner quarter (no mask set) interactive=F); dv.gui(); # Use the default GUI to look at the image ########################################################### ## Clean interactively within a mask region, use the first image as ## a template to see the emission better so you can define the mask: imgr.clean(algorithm="clark", # Clean down to a threshold niter=6000, # of 0.6 mJy/beam. gain=0.1, threshold=[value=0.6, unit="mJy" ], masktemplate='ggtau.3mm.im1', # Use 1st image to set mask region model="ggtau.3mm.model2", mask="ggtau.3mm.mask" , # Write mask region to this file image="ggtau.3mm.im2" , # Write the cleaned image to the file residual="ggtau.3mm.resid2",# ggtau.3mm.im2 on disk. niter=100, # Look at residual image every 100 iterations interactive=T); # Set mask region interactively ### Beam used in restoration: 1.8652 by 0.97922 (arcsec) at pa 15.9562 (deg) dv.gui(); # Start default viewer tool to examine image ########################################################### ## Write image to a fits file: ## im:=image(infile="ggtau.3mm.im2"); im.tofits(outfile="ggtau.3mm.fits"); im.done();