NRAO Home > CASA > CASA Cookbook and User Reference Manual

Appendix B
Python and CASA

CASA uses Python, IPython and matplotlib within the package. IPython is an enhanced, interactive shell to Python which provides many features for efficient command line interaction, while matplotlib is a Python 2-D plotting library for publication quality figures in different hardcopy formats.

From www.python.org: ”Python is an interpreted, interactive, object-oriented programming language”. Python is used as the underlying command line interface/scripting language to CASA. Thus, CASA inherits the features and the annoyances of Python. For example, since Python is inherently 0-based in its indexing of arrays, vectors, etc, CASA is also 0-based; any Index inputs (e.g., start (for start channel), fieldIndex, antennaID, etc) will start with 0. Another example is that indenting of lines means something to Python, of which users will have to be aware.

Currently, CASA uses python 2.6 (2.5 for the Mac OS 10.5 version). Some key links to python are:

Each of the features of these components behave in the standard way within CASA. In the following sections, we outline the key elements for analysis interactions; see the Python references and the IPython page for the full suite of functionality.

 B.1 Python Packages
 B.2 Automatic parentheses
 B.3 Indentation
 B.4 Lists and Ranges
 B.5 Dictionaries
  B.5.1 Saving and Reading Dictionaries
 B.6 Control Flow: Conditionals, Loops, and Exceptions
  B.6.1 Conditionals
  B.6.2 Loops
 B.7 System shell access
  B.7.1 Using the os.system methods
  B.7.2 Directory Navigation
  B.7.3 Shell Command and Capture
 B.8 Logging
 B.9 History and Searching
 B.10 Macros
 B.11 On-line editing
 B.12 Executing Python scripts
 B.13 How do I exit from CASA?


More information about CASA may be found at the CASA web page

Copyright © 2010 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search