SMA CO Line Data 3.1

From CASA Guides
Revision as of 17:00, 5 May 2010 by Rfriesen (talk | contribs) (Created page with '== Overview == This script describes SMA data reduction using miriad to fill and apply Tsys correction, and then writing uvfits. CASA is then used to read uvfits, flag, calibrat…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Overview

This script describes SMA data reduction using miriad to fill and apply Tsys correction, and then writing uvfits. CASA is then used to read uvfits, flag, calibrate, continuum subtract, and image the data. Plotting for datasets with many spw such as SMA data (plotxy) can be slow, where possible the new plotter plotms has been used. The data themselves are a six-pointing mosaic of the infrared dark cloud G19.3+0.07 with 12CO(2-1) in the USB from Brogan et al. in prep. Please do not use these data for scientific purposes.

A tarfile of the uvfits data can be found here. An integrated intensity map of the SMA data overlaid on a Spitzer image can be found here.

Creating the measurement set from uvfits data

# In CASA
# Remove any files from previous run-throughs
os.system('rm -rf spw_fits.files')
os.system('tar xvf spw_fits_files.tar')
os.system('rm -rf g19_d2usb*')

Read in each uvfits file (need to put upper range to one more than have, to satisfy ipython peculiarity). The myfiles makes a list of the filenames that can be used in a later call.

os.system('rm -rf spw_ms_files')
os.system('mkdir spw_ms_files')
myfiles = []
for i in range(1,25):
        msfile = "spw_ms_files/g19_d2usb.spw"+str(i)+".ms"
        importuvfits(fitsfile="spw_fits_files/g19_d2usb.spw"+str(i),
                     vis=msfile)
        myfiles.append(msfile)

Create a single ms from the filenames listed in 'myfile':

concat(vis=myfiles,concatvis='g19_d2usb.ms',timesort=True)

Finally, initialize the scratch columns using clearcal and use listobs to look at the properties in the concatenated file:

clearcal(vis='g19_d2usb.ms')
 
listobs(vis='g19_d2usb.ms',verbose=False)

Put screengrab here from listobs.

Brief description of the purposes of the sources in this project. () gives source id number.

Bandpass calibrator: 3c454.3 (9) Gain calibrators: 1743-038 (1) and 1908-201 (6) Flux calibrators: 3c454.3 (9) and Uranus (13) Science target: g19 (2,3,4,5,7,8) six-pointing mosaic Other sources in the ms were not part of this program.

Initial inspection and flagging

Use plotms to inspect the data. Screengrab here.

clearstat()
plotms(vis="g19_d2usb.ms",xaxis="time",yaxis="amp",field='1~9,13',
       avgchannel='3072')

Now you can use the locate features in plotms to find the bad data points on field 8 and antenna ids 1-2 and 0-2 and either flag in plotms or for script purposes write a flagdata command. Here we will do all flagging within the script.

NOTE: locate gives antenna ids, but flag data looks first at the name column, since SMA antenna names are numbers this can be confusing. The corresponding NAMES are antennas 2-3 and 1-3, which you can check with listobs.

flagdata(vis='g19_d2usb.ms',mode='manualflag',field='8',spw='20~23',
	 timerange='07:52:45~07:52:47',antenna='2&3;1&3')

Plotting again shows that the bad data are gone: (screen grab)

clearstat()
plotms(vis="g19_d2usb.ms",xaxis="time",yaxis="amp",field='8',
       avgchannel='3072')

NOTE: to confirm the data were flagged in plotms, you need to change selection in plot (for example change field and then change back), and then change back to original to clear the cache and force a re-read of the data.

Make an inital amplitude vs. channel plot of the bandpass calibrator 3c454.3 averaging all the data together in time. crossscan=T needed because there are two scans on 3c454.3. Note the rolloff of 24 individual spw. Try zooming to see better. (Screengrab here)

NOTE: after you run plotxy, run clearstat() before trying to run plotms or you will get a table lock.

clearstat()
plotxy(vis="g19_d2usb.ms",xaxis="channel",yaxis="amp",datacolumn="data",
       iteration="baseline",
       antenna="",spw="",field="9",
       averagemode="vector",width="1",timebin="all",
       crossscans=T,crossbls=False,stackspw=F,
       subplot=331,plotcolor="darkcyan",
       overplot=False,showflags=False,interactive=True,figfile="")

As you can see in this plot, SMA spw overlap by a fair amount. Here we will flag the first seven channels on either side of each spw to aid calibration.

default('flagdata')
flagdata(vis='g19_d2usb.ms', mode='manualflag',spw='0~23:0~6;121~127')

On many baselines the first integration of every scan is low. These can also be flagged with flagdata. The integration time of these data is 30.9s. Note that more recent SMA data rarely shows this problem.

flagdata(vis="g19_d2usb.ms",mode="quack",field='',
	 spw="0~23",quackinterval=40.0)

The following can be used to plot the antenna positions. For these observations, antenna 8 was in the barn for repair.

clearstat()
plotxy(vis="g19_d2usb.ms",xaxis="x")

Bandpass Calibration