NGC3256Band3 for CASA 3.3: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Mzwaan (talk | contribs)
No edit summary
Mzwaan (talk | contribs)
No edit summary
Line 1: Line 1:
Hi Eric and Jackie!
==Initial flagging and inspection==
We define an array basename that includes the names of the six files that we use here. The parameter numms is the number of measurement sets.
 
<source lang="python">
# In CASA
basename=["uid___A002_X1d54a1_X5","uid___A002_X1d54a1_X174","uid___A002_X1d54a1_X2e3","uid___A002_X1d5a20_X5","uid___A002_X1d5a20_X174","uid___A002_X1d5a20_X330"]
numms=len(basename)
</source>
 
We start with flagging the shadowed data and the autocorrelation data:
 
<source lang="python">
# In CASA
for name in basename:
flagdata(vis=name+".ms",flagbackup = F, mode = 'shadow')
flagautocorr(vis=name+".ms")
</source>
 
Store the original flags
 
<source lang="python">
# In CASA
flagmanager(
vis = 'ngc3256_line.ms', mode = 'save', versionname = 'Original')
</source>
 
Antenna DV07 shows low amplitudes and strong phase wraps on the first day of observations. We flag this antenna for the data taken on April 16:
 
<source lang="python">
# In CASA
flagdata(
vis='ngc3256_line.ms',
mode='manualflag',
flagbackup = F,
antenna='DV07',
timerange='<2011/04/16/15:00:00')
</source>
 
There are a number of scans in the data that were used by the online system for pointing calibration. We can flag these easily by selecting on 'intent':
 
<source lang="python">
# In CASA
flagdata(
vis='ngc3256_line.ms',
mode='manualflag',
flagbackup = F,
intent="*POINTING*")
</source>
 
And similarly, we can flag the scans corresponding to atmospheric calibration:
<source lang="python">
# In CASA
flagdata(
vis='ngc3256_line.ms',
mode='manualflag',
flagbackup = F,
intent="*ATMOSPHERE*")
</source>
 
Remove the noisy edge channels
 
<source lang="python">
# In CASA
flagdata(vis = 'ngc3256_line.ms', flagbackup = F, spw = ['*:0~10','*:125~127'])
</source>
 
Inspect the Tsys tables:
 
<source lang="python">
# In CASA
for name in basename:
plotcal(
caltable="tsys_"+name+".cal", xaxis="freq",
yaxis="amp", spw="1,3,5,7", timerange="<2020", subplot=221,
overplot=False, iteration="spw", plotrange=[0, 0, 40, 180],
plotsymbol=".",
figfile="tsys_per_spw"+name+".png")
</source>
 
 
Apply the Tsys values and WVR tables
 
<source lang="python">
# In CASA
for name in basename:
for msnumber in range (0,numms):
asdm=basename[msnumber]
for field in ['Titan','1037*','NGC*']:
applycal(vis=asdm+".ms", flagbackup=F, field=field, gainfield=field, spw='1,3,5,7',
interp='nearest', gaintable=['tsys_'+asdm+'.cal',asdm+'.W'])
</source>
 
 
Split out spectral windows 1,3,5,7
This will get rid of the channel average spws, and spw 0, which is
the one for the WVR data. Most importantly, it will remove the "WVR placeholder spws" that do not
show up in listobs, but are in the SPECTRAL_WINDOW table and can cause problems in concat and split
 
The WVR and Tsys tables are now applied in the DATA column:
 
<source lang="python">
# In CASA
for name in basename:
asdm=name
os.system('rm -rf '+asdm+'.ms*')
split(
vis=asdm+".ms",
outputvis=asdm+".ms",
datacolumn='corrected',
spw='1,3,5,7')
</source>
 
---More to come here---
 
==Bandpass calibration==
 
Before we do the bandpass calibration, we use {{gaincal}} to determine phase-only gaincal solutions for the bandpass calibrator, to correct for any phase variations with time. In these data, the phase calibrator and bandpass calibrator is the same source, so we just run this on 1037. For the solution interval we use solint='inf', which means that one gain solution will be determined for every scan. For our reference antenna, we choose PM03. The average of channels 40 to 80 is used to determine the antenna based phase solutions. The output calibration table is named "ngc3256.G1".
 
<source lang="python">
# In CASA
gaincal(
vis = 'ngc3256_line.ms', caltable = 'ngc3256.G1', spw = '*:40~80', field = '1037*',
selectdata=T, solint= 'inf', refant = 'PM03', calmode = 'p')
</source>
 
We check the time variations of the phases with {{plotcal}}. We make plot of the XX and YY polarization products separately and make different subplots for each of the spectal windows. This is donw by selecting iteration of 'spw' and subplot=221. and generate png plots
 
<source lang="python">
# In CASA
plotcal(
caltable = 'ngc3256.G1', xaxis = 'time', yaxis = 'phase',
poln='X', plotsymbol='o', plotrange = [0,0,-180,180], iteration = 'spw',
figfile='phase_vs_time_XX.G1.png', subplot = 221)
</source>
 
<source lang="python">
# In CASA
plotcal(
caltable = 'ngc3256.G1', xaxis = 'time', yaxis = 'phase',
poln='Y', plotsymbol='o', plotrange = [0,0,-180,180], iteration = 'spw',
figfile='phase_vs_time_YY.G1.png', subplot = 221)
</source>
 
Now that we have a first measuremnt of the phase variations as function of time, we can determine the bandpass solutions with {{bandpass}}, using the phase calibration table 'on-the-fly'.
 
First, plot the phase as a function of frequency for 1037. We use avgscan=T and avgtime='1E6' to average in time over all scans, and coloraxis='baseline' is used to colorize by baseline.
 
<source lang="python">
# In CASA
plotms(
vis='ngc3256_line.ms', xaxis='freq', yaxis='phase', selectdata=True,
field='1037*', avgtime='1E6', avgscan=T, coloraxis='baseline', iteraxis='antenna')
</source>
 
and the amplitudes
<source lang="python">
# In CASA
plotms(
vis='ngc3256_line.ms', xaxis='freq', yaxis='amp', selectdata=True, spw='*:10~120',
field='1037*', avgtime='1E6', avgscan=T, coloraxis='baseline', iteraxis='antenna')
</source>
 
<source lang="python">
# In CASA
bandpass(
vis = 'ngc3256_line.ms', caltable = 'ngc3256.B1', gaintable = 'ngc3256.G1',
field = '0', minblperant=3, minsnr=1, solint='inf',
bandtype='B', fillgaps=1, refant = 'DV10', solnorm = F)
</source>

Revision as of 15:21, 18 May 2011

Initial flagging and inspection

We define an array basename that includes the names of the six files that we use here. The parameter numms is the number of measurement sets.

# In CASA
basename=["uid___A002_X1d54a1_X5","uid___A002_X1d54a1_X174","uid___A002_X1d54a1_X2e3","uid___A002_X1d5a20_X5","uid___A002_X1d5a20_X174","uid___A002_X1d5a20_X330"]
numms=len(basename)

We start with flagging the shadowed data and the autocorrelation data:

# In CASA
for name in basename:
	flagdata(vis=name+".ms",flagbackup = F, mode = 'shadow')
	flagautocorr(vis=name+".ms")

Store the original flags

# In CASA
flagmanager(
	vis = 'ngc3256_line.ms', mode = 'save', versionname = 'Original')

Antenna DV07 shows low amplitudes and strong phase wraps on the first day of observations. We flag this antenna for the data taken on April 16:

# In CASA
flagdata(
	vis='ngc3256_line.ms', 
	mode='manualflag', 
	flagbackup = F,
	antenna='DV07',
	timerange='<2011/04/16/15:00:00')

There are a number of scans in the data that were used by the online system for pointing calibration. We can flag these easily by selecting on 'intent':

# In CASA
flagdata(
	vis='ngc3256_line.ms', 
	mode='manualflag', 
	flagbackup = F,
	intent="*POINTING*")

And similarly, we can flag the scans corresponding to atmospheric calibration:

# In CASA
flagdata(
	vis='ngc3256_line.ms', 
	mode='manualflag', 
	flagbackup = F,
	intent="*ATMOSPHERE*")

Remove the noisy edge channels

# In CASA
flagdata(vis = 'ngc3256_line.ms', flagbackup = F, spw = ['*:0~10','*:125~127'])

Inspect the Tsys tables:

# In CASA
for name in basename:
	plotcal(
	caltable="tsys_"+name+".cal", xaxis="freq",
	yaxis="amp", spw="1,3,5,7", timerange="<2020", subplot=221,
	overplot=False, iteration="spw", plotrange=[0, 0, 40, 180],
	plotsymbol=".",
	figfile="tsys_per_spw"+name+".png")


Apply the Tsys values and WVR tables

# In CASA
for name in basename:
for msnumber in range (0,numms):
	asdm=basename[msnumber]
	for field in ['Titan','1037*','NGC*']:
		applycal(vis=asdm+".ms", flagbackup=F, field=field, gainfield=field, spw='1,3,5,7',
			interp='nearest', gaintable=['tsys_'+asdm+'.cal',asdm+'.W'])


Split out spectral windows 1,3,5,7 This will get rid of the channel average spws, and spw 0, which is the one for the WVR data. Most importantly, it will remove the "WVR placeholder spws" that do not show up in listobs, but are in the SPECTRAL_WINDOW table and can cause problems in concat and split

The WVR and Tsys tables are now applied in the DATA column:

# In CASA
for name in basename:
	asdm=name
	os.system('rm -rf '+asdm+'.ms*')
	split(
		vis=asdm+".ms",
		outputvis=asdm+".ms",
		datacolumn='corrected',
		spw='1,3,5,7')

---More to come here---

Bandpass calibration

Before we do the bandpass calibration, we use gaincal to determine phase-only gaincal solutions for the bandpass calibrator, to correct for any phase variations with time. In these data, the phase calibrator and bandpass calibrator is the same source, so we just run this on 1037. For the solution interval we use solint='inf', which means that one gain solution will be determined for every scan. For our reference antenna, we choose PM03. The average of channels 40 to 80 is used to determine the antenna based phase solutions. The output calibration table is named "ngc3256.G1".

# In CASA
gaincal(
	vis = 'ngc3256_line.ms', caltable = 'ngc3256.G1', spw = '*:40~80', field = '1037*',
	selectdata=T, solint= 'inf', refant = 'PM03', calmode = 'p')

We check the time variations of the phases with plotcal. We make plot of the XX and YY polarization products separately and make different subplots for each of the spectal windows. This is donw by selecting iteration of 'spw' and subplot=221. and generate png plots

# In CASA
plotcal(
	caltable = 'ngc3256.G1', xaxis = 'time', yaxis = 'phase',
	poln='X', plotsymbol='o', plotrange = [0,0,-180,180], iteration = 'spw',
	figfile='phase_vs_time_XX.G1.png', subplot = 221)
# In CASA
plotcal(
	caltable = 'ngc3256.G1', xaxis = 'time', yaxis = 'phase',
	poln='Y', plotsymbol='o', plotrange = [0,0,-180,180], iteration = 'spw',
	figfile='phase_vs_time_YY.G1.png', subplot = 221)

Now that we have a first measuremnt of the phase variations as function of time, we can determine the bandpass solutions with bandpass, using the phase calibration table 'on-the-fly'.

First, plot the phase as a function of frequency for 1037. We use avgscan=T and avgtime='1E6' to average in time over all scans, and coloraxis='baseline' is used to colorize by baseline.

# In CASA
plotms(
	vis='ngc3256_line.ms', xaxis='freq', yaxis='phase', selectdata=True,
	field='1037*', avgtime='1E6', avgscan=T, coloraxis='baseline', iteraxis='antenna')

and the amplitudes

# In CASA
plotms(
	vis='ngc3256_line.ms', xaxis='freq', yaxis='amp', selectdata=True, spw='*:10~120',
	field='1037*', avgtime='1E6', avgscan=T, coloraxis='baseline', iteraxis='antenna')
# In CASA
bandpass(
 	vis = 'ngc3256_line.ms', caltable = 'ngc3256.B1', gaintable = 'ngc3256.G1',
	field = '0', minblperant=3, minsnr=1, solint='inf',
	bandtype='B', fillgaps=1, refant = 'DV10',	solnorm = F)