CASA Contributed Script: getgain: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Thunter (talk | contribs)
Thunter (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
Download script: [[File:Getgain.py]]
Download script: [[File:Getgain.py]]


This utility reads the EVLA GainCurves file and make a plot for a specified antenna and band. It is meant to run inside of casa, but is located in its own file but in the same directory as analysisUtils.py (and is also attached below). There are 3 required arguments: The first argument is the antenna (either an integer number or a string name in the form of 'ea03'), the second argument is the band letter: 4, P, L, S, C, X, U, K, A, Q. Note that 'S' band (as of May 2012) has no entries. An optional third argument is the elevation for which to report the gain. An optional fourth argument is the path to the GainCurves file, which is assumed to be $CASAPATH/data/nrao/VLA/GainCurves.
This utility reads the EVLA GainCurves file distributed with CASA and makes a plot for a specified antenna and band. It is meant to run inside of casa, but is located in its own file. Here is the usage:
<pre>
getgain(myAntenna, myBand, myElev=60, tableLocation='', date='')
</pre>
There are 2 required arguments. The first argument is the antenna: either an integer number (1..28, 29=PieTown, 30=all, and 0=mean) or a string name in the form of 'ea03'.  The second argument is the band letter: 4, P, L, S, C, X, U, K, A, Q. Note that 'S' band (as of May 2012) has no entries. An optional third argument is the elevation (in degrees) for which to report the gain. An optional fourth argument is the path to the GainCurves file, which is assumed to be $CASAPATH/data/nrao/VLA/GainCurves.  An optional fifth argument is the date of observation, in the format:  2012-10-01 or 2012/10/01.


[[Image:Gaincurve.K.3.png|200px|thumb|right|gain curve of ea03 at K-band]]
[[Image:Gaincurve.K.3.png|200px|thumb|right|gain curve of ea03 at K-band]]


This can be run from within CASA as a Script in the following way:
Here is an example that gets the current gain curve for Antenna ea03 at K band:
<source lang="python">
<source lang="python">
# In CASA
# In CASA
Line 18: Line 22:
band=K
band=K
antenna=3
antenna=3
current time = 4829398371.042835
current time = 4874153631.947559
Using table =  /usr/lib64/casapy/release/data/nrao/VLA/GainCurves
Using table =  /usr/lib64/casapy/release/4.1.0/data/nrao/VLA/GainCurves
There are 250 rows with band K
There are 329 rows with band K
There are 8 rows with antenna 3 and band K: 475 532 558 587 616 645 673 703
There are 11 rows with antenna 3 and band K: 453 510 536 565 594 623 651 1146 1169 1196 1223
Using row number 703
Corresponding to dates:
gain=1.026696 at ZA=45.0 or EL=45.0
  453: 1975-01-01
  510: 1998-02-02
  536: 1999-04-02
  565: 2000-06-02
  594: 2000-10-02
  623: 2001-11-10
  651: 2003-01-13
  1146: 2010-01-01
  1169: 2011-10-01
  1196: 2011-12-16
  1223: 2012-06-26
Using row number 1223
gain=1.000517 at ZA=45.0 or EL=45.0
Plot stored in gaincurve.K.3.png
Plot stored in gaincurve.K.3.png
  Out[5]: array([ 1.0005169])
</pre>
</code>
Here is an example that gets the most recent gain curve for Antenna ea03 at K band as of 2000-01-01:
<source lang="python">
# In CASA
CASA <6>: getgain('ea03','K',45,date='2000-01-01')
</source>
<code><pre style="background-color: #fffacd;">
elev=45.000000
band=K
antenna=3
MJD= 51544.00000, MJDseconds= 4453401600.0, JD= 2451544.50000
Using table =  /usr/lib64/casapy/release/4.1.0/data/nrao/VLA/GainCurves
There are 329 rows with band K
There are 11 rows with antenna 3 and band K: 453 510 536 565 594 623 651 1146 1169 1196 1223
Corresponding to dates:
  453: 1975-01-01
  510: 1998-02-02
  536: 1999-04-02
  565: 2000-06-02
  594: 2000-10-02
  623: 2001-11-10
  651: 2003-01-13
  1146: 2010-01-01
  1169: 2011-10-01
  1196: 2011-12-16
  1223: 2012-06-26
Using closest prior measurement in time: row 536 (274 days away)
gain=1.027782 at ZA=45.0 or EL=45.0
Plot stored in gaincurve.K.3.png
  Out[6]: array([ 1.02778167])
</pre>
</pre>
</code>
</code>

Latest revision as of 20:16, 1 May 2013

Plotting VLA gain tables

Download script: File:Getgain.py

This utility reads the EVLA GainCurves file distributed with CASA and makes a plot for a specified antenna and band. It is meant to run inside of casa, but is located in its own file. Here is the usage:

getgain(myAntenna, myBand, myElev=60, tableLocation='', date='')

There are 2 required arguments. The first argument is the antenna: either an integer number (1..28, 29=PieTown, 30=all, and 0=mean) or a string name in the form of 'ea03'. The second argument is the band letter: 4, P, L, S, C, X, U, K, A, Q. Note that 'S' band (as of May 2012) has no entries. An optional third argument is the elevation (in degrees) for which to report the gain. An optional fourth argument is the path to the GainCurves file, which is assumed to be $CASAPATH/data/nrao/VLA/GainCurves. An optional fifth argument is the date of observation, in the format: 2012-10-01 or 2012/10/01.

gain curve of ea03 at K-band

Here is an example that gets the current gain curve for Antenna ea03 at K band:

# In CASA
CASA <4>: execfile('getgain.py')     or      from getgain import *
CASA <5>: getgain(3,'K',45.0)
elev=45.000000
band=K
antenna=3
current time = 4874153631.947559
Using table =  /usr/lib64/casapy/release/4.1.0/data/nrao/VLA/GainCurves
There are 329 rows with band K
There are 11 rows with antenna 3 and band K: 453 510 536 565 594 623 651 1146 1169 1196 1223
Corresponding to dates:
  453: 1975-01-01
  510: 1998-02-02
  536: 1999-04-02
  565: 2000-06-02
  594: 2000-10-02
  623: 2001-11-10
  651: 2003-01-13
  1146: 2010-01-01
  1169: 2011-10-01
  1196: 2011-12-16
  1223: 2012-06-26
Using row number 1223
gain=1.000517 at ZA=45.0 or EL=45.0
Plot stored in gaincurve.K.3.png
  Out[5]: array([ 1.0005169])


Here is an example that gets the most recent gain curve for Antenna ea03 at K band as of 2000-01-01:

# In CASA
CASA <6>: getgain('ea03','K',45,date='2000-01-01')
elev=45.000000
band=K
antenna=3
MJD= 51544.00000, MJDseconds= 4453401600.0, JD= 2451544.50000
Using table =  /usr/lib64/casapy/release/4.1.0/data/nrao/VLA/GainCurves
There are 329 rows with band K
There are 11 rows with antenna 3 and band K: 453 510 536 565 594 623 651 1146 1169 1196 1223
Corresponding to dates:
  453: 1975-01-01
  510: 1998-02-02
  536: 1999-04-02
  565: 2000-06-02
  594: 2000-10-02
  623: 2001-11-10
  651: 2003-01-13
  1146: 2010-01-01
  1169: 2011-10-01
  1196: 2011-12-16
  1223: 2012-06-26
Using closest prior measurement in time: row 536 (274 days away)
gain=1.027782 at ZA=45.0 or EL=45.0
Plot stored in gaincurve.K.3.png
  Out[6]: array([ 1.02778167])