########################################################### ## Include relevant tools if not already done: ## include 'vlafiller.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: ## mset:=fitstoms(msfile='ngc5921.ms', fitsfile='/aips++/data/demo/NGC5921.fits'); # Construct the ms tool for # the spectral line data set located # in the AIPS++ Data Repository mset.summary(verbose=T); # Obtain summary mset.done(); # Finish ms tool ########################################################### ## Manually plot the data for visual inspection: ## plot := msplot(msfile='ngc5921.ms', edit=T); # Allow editing as well as inspection plot.done(); ########################################################### ## Flag autocorrelations: ## fg:=flagger(msfile="ngc5921.ms" ); fg.flagac(); fg.done(); ########################################################### ## Set the flux density of 3C~286 (field 1): ## imgr:=imager(filename='ngc5921.ms'); # Start the imager tool imgr.setjy(fieldid=1); # Calculate & set flux density for imgr.setdata(fieldid=1); # Set data to 1331+305 (3C 286) imgr.plotvis(type='model'); # Plot model amplitudes vs uv distance imgr.done(); # Close out the tool. ########################################################### ## Derive gain calibration solutions: ## cal:=calibrater(filename='ngc5921.ms'); # Create calibrater tool for # spectral line data set cal.reset(); # Reset apply/solve state # of the calibrater tool cal.setdata(msselect='FIELD_ID <= 2', # Select data for g & bp calibrators mode='channel', # (Fields 1 & 2) start=3, # and drop the outer channels nchan=55); # that may bias the gain solution. cal.setapply(type='TOPAC', # Correct opacity 'on-the-fly' t=-1, # Calc opacity correction for each time opacity=0.0001); # Specify measured zenith opacity # make opacity small - not really needed here cal.setapply(type='GAINCURVE', # Correct gain curve for VLA 'on-the-fly' t=-1); # apply correction for each time cal.setsolve(type='G', # Arrange to solve for G for t=0, # each scan. refant=14, # Choose reference antenna 14: table='ngc5921.gcal'); # a well-behaved antenna # near the center of the array. cal.state(); # Review setsolve settings cal.solve(); # Solve for the net complex gains # and write solutions to the table # ngc5921.gcal located on disk. cal.plotcal(tablename='ngc5921.gcal'); # Inspect solutions ########################################################### ## Derive bandpass calibration solutions: ## cal.reset(); # Reset apply/solve state # of the calibrater tool cal.setdata(msselect='FIELD_ID==1'); # Select bandpass calibrator # (1331+305 = 3C 286) cal.setapply(type='TOPAC', # Correct opacity 'on-the-fly' t=-1, # Calc opacity correction for each time opacity=0.0001); # Specify measured zenith opacity # make opacity small - not really needed here cal.setapply(type='GAINCURVE', # Correct gain curve for VLA 'on-the-fly' t=-1); # apply correction for each time cal.setapply(type='G', # Arrange to apply G solutions t=0.0, # from the table ngc5921.gcal table='ngc5921.gcal'); cal.setsolve(type='B', # Arrange to solve for a single t=86400.0, # bandpass solution for the refant=14, # entire observation. table='ngc5921.bcal'); cal.state(); # Review setapply/setsolve settings cal.solve(); # Solve for the bandpass solutions # and write them to the table # ngc5921.bcal located on disk. cal.plotcal(tablename='ngc5921.bcal', # Inspect the solutions plottype='AMP', multiplot=F); ########################################################### ## Transfer the flux density scale: ## cal.fluxscale(tablein='ngc5921.gcal', # Transfer the flux density scale tableout='ngc5921.fluxcal', # from 1328+307 (J2000: 3C286) reference='1331+30500002', # to the gain calibrator transfer=['1445+09900002']); # 1445+09900002. Write # solutions to the table # ngc5921.fluxcal located on disk. cal.plotcal(tablename='ngc5921.fluxcal', # Inspect the solutions plottype='AMP', multiplot=F); ########################################################### ## Correct the target source data: ## cal.reset(); # Reset setapply/setsolve cal.setdata(msselect='FIELD_ID IN [2,3]'); # Select sources in MS fields # 2, & 3 to which calibration # is to be applied cal.setapply(type='TOPAC', # Correct opacity 'on-the-fly' t=-1, # Calc opacity correction for each time opacity=0.0001); # Specify measured zenith opacity # make opacity small - not really needed here cal.setapply(type='GAINCURVE', # Correct gain curve for VLA 'on-the-fly' t=-1); # apply correction for each time cal.setapply(type='G', # Arrange to apply flux-scaled G t=0.0, # solutions (from field 2) from table='ngc5921.fluxcal', # the ngc5921.fluxcal table. select='FIELD_ID==2'); cal.setapply(type='B', # Arrange to apply B solutions t=0.0, # from the ngc5921.bcal table. table='ngc5921.bcal', select=''); cal.state(); # Review setapply settings cal.correct(); # Apply solutions and write the # CORRECTED_DATA column in the MS. cal.done(); ########################################################### ## Subtract the continuum in the uv-plane ## (assumes that no self-calibration will be done): ## mset := ms(filename="ngc5921.ms", # Create the ms tool readonly=F); # Make sure it is writable! mset.uvlsf(fldid=3, # Choose NGC 5921 (field 3), spwid=1, # spectral window 1, chans=[4:6,50:59], # line free channels 4-6 & 50-59, solint=0.0, # use scan-averaging, mode="subtract"); # & subtract cont. from line data. # Line-only data will be written into # CORRECTED_DATA column. mset.done(); # Finish the tool ########################################################### ## Split out calibrated target source data: ## mset := ms(filename="ngc5921.ms", # Create the ms tool readonly=F); # Make sure it is writable! mset.split(outputms="ngc5921.split.ms", # Select output file name, fieldids=3, # write out only NGC 5921 data, spwids=1, # spectral window 1, nchan=46, # write out 46 channels, start=6, # starting with channel 6, step=1, # no channel averaging, whichcol="CORRECTED_DATA"); # write out CORRECTED_DATA column. mset.done(); # Finish this tool ########################################################### ## Get quick summary with default catalog tool: ## dc.summary('ngc5921.split.ms'); # Get a new summary so you know # the new field_id & spwid ########################################################### ## Image the target source data: ## imgr:=imager(filename='ngc5921.split.ms'); # Create imager tool if not already done. # Use split out calibrated data. imgr.setdata(mode='channel', # Select channel data for field 1 (source) nchan=46, start=1, step=1, fieldid=1); imgr.advise(takeadvice=F, # Determine image and cell size using fieldofview='60arcmin'); # advise function. Do not take advice, # note parameters in logger # window and use for setimage. # This step is NOT required for # imaging, it is just a useful tool. imgr.setimage(nx=256, # Set imaging parameters ny=256, cellx='15arcsec', celly='15arcsec', stokes='I', mode='channel', nchan=58, start=3, step=1, fieldid=1); imgr.weight(type='briggs', # Set up Robust weighting rmode='norm', robust=0.5); imgr.clean(algorithm='hogbom', # Image and deconvolve inner quarter niter=6000, # with Hogbom CLEAN down to a threshold gain=0.1, # of 2 mJy threshold='2mJy', model='ngc5921.mod', image='ngc5921.im', # Write the cleaned image to the file residual='ngc5921.resid', # ngc5921.im on disk. mask='', # Clean the inner quarter, thus: do not interactive=F); # set a mask or create a deconvolution # region. dv.gui(); # Bring up default viewer tool to # examine the final image, ngc5921.im # look at sidelobe response, if desired: imgr.makeimage(type='psf', # Form the PSF image if desired image='ngc5921.psf'); imgr.fitpsf(psf='ngc5921.psf'); # Measure the beam size imgr.done(); ########################################################### ## Write image to a fits file: ## im:=image(infile="ngc5921.im"); im.tofits(outfile="ngc5921.fits"); im.done();