NGC3256Band3 for CASA 3.3: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Line 184: Line 184:
</source>
</source>


We then split out spectral windows 1,3,5,&7. This will get rid of the channel averaged spectral windows, and spw 0, which is the one for the WVR data. Most importantly, it will remove the "WVR placeholder spws", which can cause problems in concat and split.   
We then split out spectral windows 1,3,5,&7. This will get rid of the channel averaged spectral windows, and spw 0, which is the one for the WVR data. Most importantly, it will remove the "WVR placeholder" spws, which can cause problems in concat and split.   


<source lang="python">
<source lang="python">

Revision as of 00:40, 19 May 2011

Overview

[To be written by Eric]

Retrieving the Data

The data were taken in six different datasets over two consecutive nights: April 16-17, 2011. There are three datasets for April 16th and three for April 17th. Here we provide you with "starter" datasets, where we have taken the raw data in ALMA Science Data Model (ASDM) format and converted them to CASA Measurement Sets (MS). We did this using the importasdm task in CASA.

[What else are we going to do to the data we provide?]

Along with the Measurement Sets, we also provide the Tsys tables...[more]

You can download the data here: [Provide link to the raw .ms files in tar'd, gzip'd format]

Once the download has finished, unpack the file:

# In a terminal outside CASA
tar -xvf ngc3256band3.tgz

[Also provide links to the calibrated data (but maybe not here?)]

Initial inspection and a priori flagging

We start by defining an array 'basename' that includes the names of the six files used here. This will simplify the following steps by allowing us to loop through the files using a simple for-loop in python. The parameter numms is simply 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)

The usual first step is then to get some basic information about the data. We do this using the task listobs, which will output a detailed summary of each dataset supplied.

# In CASA
for name in basename:
        listobs(vis=name+'.ms')

The output will be sent to the CASA logger. You will have to scroll up to see the individual output for each of the six datasets. Here is an example of the most relevant output for the first file in the list.

Fields: 3
  ID   Code Name         RA            Decl           Epoch   SrcId nVis   
  0    none 1037-295     10:37:16.0790 -29.34.02.8130 J2000   0     38759  
  1    none Titan        00:00:00.0000 +00.00.00.0000 J2000   1     16016  
  2    none NGC3256      10:27:51.6000 -43.54.18.0000 J2000   2     151249 
  (nVis = Total number of time/baseline visibilities per field) 
Spectral Windows:  (9 unique spectral windows and 2 unique polarization setups)
  SpwID  #Chans Frame Ch1(MHz)    ChanWid(kHz)TotBW(kHz)  Ref(MHz)    Corrs   
  0           4 TOPO  184550      1500000     7500000     183300      I   
  1         128 TOPO  113211.988  15625       2000000     113204.175  XX  YY  
  2           1 TOPO  114188.55   1796875     1796875     113204.175  XX  YY  
  3         128 TOPO  111450.813  15625       2000000     111443      XX  YY  
  4           1 TOPO  112427.375  1796875     1796875     111443      XX  YY  
  5         128 TOPO  101506.187  15625       2000000     101514      XX  YY  
  6           1 TOPO  100498.375  1796875     1796875     101514      XX  YY  
  7         128 TOPO  103050.863  15625       2000000     103058.675  XX  YY  
  8           1 TOPO  102043.05   1796875     1796875     103058.675  XX  YY  
Sources: 48
  ID   Name         SpwId RestFreq(MHz)  SysVel(km/s) 
  0    1037-295     0     -              -            
  0    1037-295     9     -              -            
  0    1037-295     10    -              -            
  0    1037-295     11    -              -            
  0    1037-295     12    -              -            
  0    1037-295     13    -              -            
  0    1037-295     14    -              -            
  0    1037-295     15    -              -            
  0    1037-295     1     -              -            
  0    1037-295     2     -              -            
  0    1037-295     3     -              -            
  0    1037-295     4     -              -            
  0    1037-295     5     -              -            
  0    1037-295     6     -              -            
  0    1037-295     7     -              -            
  0    1037-295     8     -              -            
  1    Titan        0     -              -            
  1    Titan        9     -              -            
  1    Titan        10    -              -            
  1    Titan        11    -              -            
  1    Titan        12    -              -            
  1    Titan        13    -              -            
  1    Titan        14    -              -            
  1    Titan        15    -              -            
  1    Titan        1     -              -            
  1    Titan        2     -              -            
  1    Titan        3     -              -            
  1    Titan        4     -              -            
  1    Titan        5     -              -            
  1    Titan        6     -              -            
  1    Titan        7     -              -            
  1    Titan        8     -              -            
  2    NGC3256      0     -              -            
  2    NGC3256      9     -              -            
  2    NGC3256      10    -              -            
  2    NGC3256      11    -              -            
  2    NGC3256      12    -              -            
  2    NGC3256      13    -              -            
  2    NGC3256      14    -              -            
  2    NGC3256      15    -              -            
  2    NGC3256      1     -              -            
  2    NGC3256      2     -              -            
  2    NGC3256      3     -              -            
  2    NGC3256      4     -              -            
  2    NGC3256      5     -              -            
  2    NGC3256      6     -              -            
  2    NGC3256      7     -              -            
  2    NGC3256      8     -              -            
Antennas: 7:
  ID   Name  Station   Diam.    Long.         Lat.         
  0    DV04  J505      12.0 m   -067.45.18.0  -22.53.22.8  
  1    DV06  T704      12.0 m   -067.45.16.2  -22.53.22.1  
  2    DV07  J510      12.0 m   -067.45.17.8  -22.53.23.5  
  3    DV08  T703      12.0 m   -067.45.16.2  -22.53.23.9  
  4    DV09  N602      12.0 m   -067.45.17.4  -22.53.22.3  
  5    PM02  T701      12.0 m   -067.45.18.8  -22.53.22.2  
  6    PM03  J504      12.0 m   -067.45.17.0  -22.53.23.0 

Note that there are more than four SpwIDs even though the observations were set up to have four spectral windows. The spectral line data themselves are found in spectral windows 1,3,5,7, and spectral windows 2,4,6,8 are simply the respective channel averages. Spectral window 0 contains the WVR data. The additional SpwIDs listed in the "Sources" section are "WVR placeholder" spws [TRUE? WHY ARE THERE ONLY 7 EXTRA?]

Another important thing to note is that the position of Titan is listed as 00:00:00.0000 +00.00.00.0000. This is obviously not correct, and is due to...[MORE]. We will fix this below by running the task Template:Fixplanet.

The first editing we will do is some a priori flagging. We will start by 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")

There are a number of scans in the data that were used by the online system for pointing calibration. These scans are no longer needed, and we can flag them easily by selecting on 'intent':

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

Similarly, we can flag the scans corresponding to atmospheric calibration:

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

We will then store the current flagging state for each dataset using the flagmanager: [NOTE: I changed the versionname from 'Original' since that is created on import...]

# In CASA
for name in basename:
        flagmanager(vis = name+'.ms', mode = 'save', versionname = 'Apriori')

[Martin: Is there any reason you sometimes use double quotes and sometimes single?]

Tsys calibration and WVR Correction

[Talk about what each thing does and how we currently must use the un-concatenated data for each.]

First we will 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")

Note that we only plot the spectral windows with the spectral line data, and we set timerange="<2020" because [WHY?] Everything looks fine in the plot files produced, so we apply the Tsys values and WVR corrections with applycal: [DOES THAT MEAN WE ARE JUST PROVIDING THE WVR TABLES AS WELL, INSTEAD OF HAVING THEM GENERATE THEM?]

# 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'])

We then split out spectral windows 1,3,5,&7. This will get rid of the channel averaged spectral windows, and spw 0, which is the one for the WVR data. Most importantly, it will remove the "WVR placeholder" spws, which can cause problems in concat and split.

# 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')

The WVR and Tsys tables are now applied in the DATA column of the resultant measurement sets.

---More to come here---


[THESE FLAGGING COMMANDS WERE HIGHER UP, BUT I THINK THEY SHOULD BE MOVED BELOW CONCAT, MAYBE AFTER A BASIC PLOTMS] 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')

Remove the noisy edge channels

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

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)