Analysis Utilities (or analysisUtils for short) is a small set of Python source code files that provide a number of analysis and plotting utilities. The primary file is analysisUtils.py (108000 lines as of March 2021). The utilities were developed (and continue to be developed) for ALMA commissioning and data reduction and are, in many cases, also useful for EVLA data reduction. This CASA Guide documents some of the most useful functions contained in the analysisUtils Python module from a user's perspective, but most of the functions have fairly complete inline help.
If you are working on a machine at NRAO Charlottesville, then you can skip Step 1, because the latest modules are already available at: /users/thunter/AIV/science/analysis_scripts.
Step 1: Download Analysis Utilities from here and extract the tar ball. From a Unix command line this can be done with
$ tar xvf analysis_scripts.tar
Seven files will be extracted -- a README file, and six python scripts. The README file contains the time and date that the tar ball was generated, which can be useful for reporting bugs. The history file available at the ftp site contains a list of major changes in each version.
Step 2: Edit your existing casa initialization file (in CASA5: $HOME/.casa/init.py, or in CASA6: $HOME$/.casa/startup.py) or create a new file if it does not already exist, and add the following
import sys sys.path.append("/PATH_TO_ANALYSIS_SCRIPTS/") import analysisUtils as au
where /PATH_TO_ANALYSIS_SCRIPTS/ is the path to the directory you just extracted from the tar ball. An example can be downloaded and edited here: File:Init.py. When this is done, start casapy and you will have access to all the functions contained in the analysisUtils module.
Once installed, functions can be searched for by name via minimum match string with the au.help function (where comma denotes a logical AND): e.g. au.help('antenna') or au.help('spw,caltable'). As in python, inline help for an individual function is accessed by typing 'help au.planet'. For further help with analysisUtils installation or usage, you may submit a helpdesk ticket to the Data Reduction category at https://help.almascience.org/. Be advised that analysisUtils is a commissioning tool, so the level of support available is not as extensive as for CASA, but we do welcome feedback. If your question is with regard to plotbandpass, then please provide the version number of this program (it is printed to the screen at execution time and on the plots). In all cases, please provide the release date of your analysisUtils, which can be viewed from inside casapy as follows:
The documentation for the two script generators almaqa2csg.py and almaqa2isg.py can be found at TBD.
Some Examples of Other Functions
Up-to-date, online help is available for all of these functions (and more) at the CASA prompt by simply using the command: help(au.functionName). To search for functions, you can type au.help('phrase'), where phrase is case-insensitive and minimum-match. Multiple phrases can be combined with a comma, for example au.help('baseline,stats').
- reads an ms and computes the angular separation of all fields, or a subset
- reads the list of antenna stations in an .ms and creates a .cfg file suitable for simobserve
- change the intents for a specified field in an ms (based on John Lightfoot's pipeline script)
- returns a dictionary of the baseline lengths in your ms, by default sorted by length
- returns a bunch of statistics on the baseline lengths in your ms
- compute the effective restoring beam obtained from the casa command sdimaging when using the GJINC gridding kernel
- lists the range of LST, UT, MJD for the whole ms, and for scans with OBSERVE_TARGET intent (including the elevation range)
- prints the antenna station coordinates in local offsets from the Center of Array, and computes longest/shortest baselines
- contacts the JPL Horizons telnet service and returns the J2000 position, velocity, angular diameter, range and range rate of a solar system object
- calls Bryan Butler's solar_system_setjy module in CASA to compute flux density vs. time or flux density vs. frequency
- generates a plots of uv amplitude vs. uv distance for a grid of ALMA configurations and observing frequencies
- generates a plot of the Sun's az vs. el during an ms or ASDM
- plot any standard telescope configuration of observatories known to casa, and return an array of the sorted baseline lengths
- shows relative location of pointings in an .ms
- reads the PWV from each antenna's WVR from the ASDM_CALWVR table in an ms, and creates a plot vs. time
- plot weather conditions vs. time for your ms
- plot the WVR solutions in terms of baseline-based phase corrections
- performs a least-squares fit to the multi-spw output from fluxscale
- compute the total time spent integrating on-source for each specified field
A list of additional 1200+ functions, and their brief descriptions, can be found at Todd's wikipage