From CASA Guides
(Redirected from Python Basics)
Jump to navigationJump to search

One of CASA nicest features is that it it integrated into an python working environment (specifically an iPython shell). Python is a high-level programming language that has gained a lot of traction for scripting and scientific programming over the last few years. The features that make Python high-level and the strong supporting libraries (especially for array handling) mean that in practice it has a lot of similarities to other commonly used analysis packages like IDL or MatLab.

These pages will step you through some basics of python. What you learn will have direct applications to scripting CASA. If you dig a little deeper then you will also find some of the tools to integrate your astronomical analysis, observation problem, and data reduction.

This is a CASA guide, so we will assume that you are working inside of a "casapy" shell, but much of what you learn can be directly ported to any iPython shell or to write compiled python code (which on most systems you will be able to run simply by typing "python"). The only thing to be slightly careful about, is that Python 2.x (what we use) is not quite compatible with Python 3.x which is now being used other places.

We'll start with the very basics: arithmetic, data collections, control flow. These will heavily duplicate several other tutorials on the web (we strongly recommend the introductory tutorials at the basic python site: Here). Going through a couple of these as you try to write your first programs is probably a great way to really get oriented.

CASA Guide Python Overview

Links to Other Sites