IDL BASICS FOR ASTRO 250, SPRING 2002 January 18, 2006

1. BASIC INFO ABOUT IDL.

IDL is extremely powerful and in wide use by scientists, and especially astronomers. Unfortunately, there are no good primers for the beginner. The best way to learn its basics is to go through our tutorial idltut1 step-by-step; it takes you through the basic things, including plotting. Later, look at idldatatypes, which tells you about datatypes and organizational structures. Finally, take a look at makeps (how to make ps files of plots); this uses some routines in my personal library, see below). For more info, the book Building IDL Applications is indispensible.

2. THE IDL HANDIGUIDE

Make frequent use of the IDL Handiguide we distribute. It has the built-in IDL procedures arranged by topic. So when you are manipulating arrays, look under Array Manipulation Routines and you may well find a procedure that does exactly what you want. Ditto for Special Math Functions, Plotting Routines, Two-Dimensional, etc., etc., etc.

3. THE GODDARD WEBSITE, ITS LINKS, AND ITS LIBRARY

One thing that makes IDL extremely useful for astronomers is that lots of astronomers use it. Long ago the Goddard folks wrote many useful routines and more recently have assembled links to many other libraries and reference material. This is really a great resource: it’s huge, but things are categorized by subject to at least some extent.

In particular, you should print out the contents of http://idlastro.gsfc.nasa.gov/contents.html. It contains a list of the Goddard library, categorized by topic. For astronomers, the most important section is Astronomical Utilities. Coordinate conversions, time conversions, precession, Doppler shifts, etc., etc., etc. Another is the FITS sections, useful for all FITS files and especially those from Space Telescope. Image Manipulation contains many useful procedures for image analysis, such as FT-based convolution, generating circular masks, maximum entropy, etc. Math and Statistics has many procedures, some of which duplicate IDL’s and some of which do not. TV Display Procedures has nice procedures that will draw boxes, circles, blink images, and more. Miscellaneous has lots of procedures, of which I find the most useful are FINDPRO (finds all occurances of a procedure in one’s path!), and READCOL (reads column-organized ascii data into IDL vectors).

Our system has the Goddard routines split according to application category, located at /usr/local/rsi/idl/ulib/external/idlastro/pro/ . These versions are old (1998 mostly) and ought to be updated—but sometimes Goddard routines are not backwards compatible so you might want to follow my example and keep your own version so that when you update you know what’s happening. The deep group keeps a copy of an updated Goddard library at /deep2/dfink/cvs/idlutils/goddard .

4. THE DEEP LIBRARY

Our (former) own Doug Finkbeiner and friends have developed an extensive suite of clever, useful IDL procedures. The include things like the ability to write plotting captions in Greek letters using Latex notation (textoidl.pro), a fancy image display routine that takes positional info off of fits files and allows you to zoom, etc (atv.pro) and a similar program for plotting one-d arrays such as spectra (splot.pro), and programs for reading/writing fits files that exceed the Goddard library program’s capabilties. You may want to make use of them when you have learned the basics. Some of these routines are also referenced on Goddard’s website. They are located at /deep2/dfink/cvs/idlutils .

5. MY LIBRARY

Lots of people and many institutions have their own libraries. I have my own, and I will naturally use some of them in our class demos. It is located at /dzd2/heiles/idl/gen . One feature I use all the time is the easy ability to plot using color. I suggest that, if you are beginner, you use my IDL startup file. You can do that by putting the following line in your UNIX startup file (.cshrc)

setenv      IDL_STARTUP     ~heiles/idl/gen/idlstartup

which will put my library, including my version of the Goddard library, in your IDL path and define colors for plotting. When you enter IDL you will be prompted among four choices, which have to do with the type of color display; until you know better, respond by typing pseudo.