Observational Techniques: Computer Notes
Aims
The aim of this section of the course is to enable you to use simple computer programs
to solve a variety of common astronomical tasks. In particular, how to read in and
print out ASCII (text) data files, how to do calculations, how to make plots, and how to
interact with astronomical data in FITS format.
We could do all of this in a wide variety of programming languages. I have (somewhat
arbitrarily) decided to use Python for this course, because it seems to be gaining
popularity fast for astronomical data handling, and because some of you will have encountered it
at the ATNF course. Once you're familiar with one programming language, others will come
much more easily.
Running Python
The first step is to get Python up and running. We've put Python (plus all relevant libraries)
on the Stromlo Linux computers moron and maggot. These should be enough for everyone doing this
course to use.
To use these machines from a SunRay terminal, do the following:
- In an xterm window, type "xhost moron" (or maggot, if you prefer). This tells your
terminal to accept windows generated on moron.
- Now log in to moron (or maggot). The command is "ssh -Y -l username moron". Type your
username in place of "username". You will be prompted for your password.
- You can now run python, by typing "python" at the prompt.
- To run python interactively, including plotting, type "ipython -pylab". ipython is
slightly nicer interactive version of python: "-pylab" tells it to import the matplotlib
plotting package.
- To get out of python or ipython, hold down the control button while pressing "D".
- You can create programs using any text editor. There is one you can start up from
the toolbar at the bottom of your screen. Alternatively type "emacs &" in the xterm window
and an emacs editor window will appear.
- When you've finished with moron (or maggot) type logout in the terminal window.
You might prefer to run the rograms on your own laptop. Versions of Python run on
Windows, Macs, Unix and LINUX (among others) so you should be able to install it just
about anywhere.
In addition to python itself, to do this course you will need some extra packages:
One easy way to get all of these (along with much much more) is the SciSoft package put
together by ESO:
http://www.eso.org/science/scisoft/.
Alternatively you can install them individually.
Learning to Program in Python
If you've never programmed before, you should try out this tutorial:
To start off with, you should work through sections up to and including "debugging".
Note that you are using Python from the command line, not with IDLE.
If you have programmed before, start with a different tutorial:
To learn about plotting and interacting with astronomical data, try the following excellent
tutorial: