[http://casaguides.nrao.edu/index.php?title=CASA_EVLA_Scripts&action=edit edit me in CASA Guides]
== Overview ==
== Overview ==
Line 73:
Line 69:
useflags('myVis.ms', myFlags)
useflags('myVis.ms', myFlags)
</source>
</source>
== Listing observation information directly from the SDM files ==
Download script: [[File:List_sdm.py]]
This script lists information directly from the SDM directory's XML tables and prints this information to the CASA log. Formatting is similar to the task {{listobs}}; however, list_sdm is much faster for larger datasets, and can be run before (or while) importing to an MS.
It will also return a dictionary keyed on scan number. The dictionary contains the following information, which can be useful for scan selection prior to import:
'baseband' list of baseband name(s)
'chanwidth' list of channel widths (Hz)
'end' observation end time (UTC)
'field' field ID
'intent' scan intent(s)
'nchan' list of number of channels
'nsubs' number of subscans
'reffreq' list of reference frequencies (Hz)
'source' source name
'spws' list of spectral windows
'start' observation start time (UTC)
'timerange' start time - end time range (UTC)
<source lang="python">
# In CASA
from List_sdm import list_sdm
myScanDict = list_sdm('mySDMfile')
</source>
Representative log output:
<pre style="background-color: #ffe4b5;">
2011-01-02 02:26:32 INFO listsdm ================================================================================
2011-01-02 02:26:32 INFO listsdm SDM File: AS1039_sb1382796_2_000.55368.51883247685
2011-01-02 02:26:32 INFO listsdm ================================================================================
2011-01-02 02:26:32 INFO listsdm Observer: Michael P. Rupen
2011-01-02 02:26:32 INFO listsdm Facility: EVLA, D-configuration
2011-01-02 02:26:32 INFO listsdm Observed from 2010/06/21/12:27:08.17 to 2010/06/21/13:26:55.70 (UTC)
2011-01-02 02:26:32 INFO listsdm Total integration time = 3587.53 seconds (1.00 hours)
This is a collection of Python scripts to help process and analyze EVLA data. Although they are not officially supported, some authors may choose to provide contact information. A brief description on how to run each script is provided by the author. If you would like to contribute, and do not have access to the CASA Guides Wiki, you may email Miriam Krauss (mkrauss at nrao.edu).
Plotting the weather table, obtaining observation-specific opacity information
This script will plot weather information contained in the MS (see example below) as well as estimate the zenith opacity for each spectral window. This script is only intended for use with the EVLA-- it contains hardcoded site parameters and EVLA-specific models. Feel free to contact Josh Marvil (jmarvil + 'at' + nrao.edu) with questions or comments.
The plot will contain the following subfigures:
The Sun's elevation, calculated from the date and time of the observation
Wind speed and direction, as read from the weather table
Temperature and Dewpoint, as read from the weather table
Estimates of Precipitable Water Vapor (PWV), based upon:
A Seasonal model based on VLA measurements between 1998-2005 (See VLA Test Memo #232)
A calculation involving temperature and dewpoint (See VLA Scientific Memo #176)
The average of the above two methods (currently accepted as the best predictor)
Zenith optical depth from 1-50 GHz, calculated for each of the above three estimates of PWV, averaged over time. This calculation uses the atmospheric toolkit available within casa (see help(at) within CASA for more info)
This can be run from within CASA as a Script in the following way:
place Script_plotWX.py in your working directory
open Script_plotWX.py in a text editor
find this line near the top of the script: myMS='MSname.ms'
replace MSname.ms with the name of your measurement set, and save
in CASA, execute the script:
# In CASAexecfile'Script_plotWX.py'
Or, this script can be run within CASA as a function:
place Script_plotWX.py in your working directory
in CASA, import the function definition and call the function, replacing MSname.ms with the name of your measurement set:
# In CASAfromScript_plotWXimportplotWXmyTau=plotWX('MSname.ms')
Importing, listing, plotting, and applying online flags
This script reads the Flags.xml table in the SDM directory, and parses the online antenna flags so that they can be listed, plotted, and applied to the MS. Note that the tbuff parameter is a padding value (in seconds) for creating the flag time ranges.
Here, flags are read in and listed, then plotted and applied. The plot file is saved to a file for future reference.
# In CASAfromReadflagsimportlistflags,readflags,plotflags,useflagsmyFlags=readflags('mySDMfile',tbuff=1.5)listflags(myFlags)plotflags(myFlags)pl.savefig('mySDMfile_onlineFlags.png')useflags('myVis.ms',myFlags)