LEARNING IDL FOR ASTRONOMY January 2, 2002

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: Go through our tutorials step-by-step. We will be distributing these a few times during the course. Each tutorial will take a couple of hours, but the time you spend will be repaid… fast.

Learning a computer language is bit like learning Greek. You become more proficient as you use it. However, it helps to have a learning plan. We envision three levels of proficiency:

(1): THE NOVICE LEVEL. To learn IDL at the basic level, we suggest that you sit down at a computer for a couple of hours with each of our tutorials. The first tutorial will allow you to write the software you need for your first lab report, and succeeding ones will make the software for the other labs much easier. We can’t overemphasize the importance of these tutorials!

(2): THE INTERMEDIATE LEVEL. To become proficient at IDL, we suggest that you purchase the book “IDL Programming Techniques” and work your way through it. Alternatively, if you’re poor, sit down at a computer for several sessions of an hour or two each with the IDL books entitled USING IDL and BUILDING IDL APPLICATIONS. Read the following sections in the order given and try out everything, either using the examples they give or making up your own:

USING IDL: Chapter 1, Typographical Conventions (pp 4 to 5). USING IDL: Chapter 2, Input to IDL (pp 13 to 16). BUILDING IDL: Chapter 2, Constants and Variables, pp 12 to 21. BUILDING IDL: Chapter 3, Expressions and Operators, pp 24 to 37. BUILDING IDL: Chapter 5, Array Subscripts, pp 56 to 65. USING IDL: Chapter 10, X Versus Y Plots—PLOT and OPLOT, Annotation—the XYOUTS Procedure, Plotting Symbols, Polygon Filling (pp 157 to 171); Plotting Missing Data (pp 179 to 180); Using the CURSOR Procedure (pp 182 to 184). BUILDING IDL: Chapter 7, Statements, pp 80 to 104. BUILDING IDL: Chapter 8, Defining Procedures and Functions, pp 106 to 115.

This gives you the background to become an IDL “expert”. Having the student version will make this easier because you can do this at home at your leisure.

(3): THE EXPERT LEVEL. To actually become an IDL expert, we suggest that you

• Get the book “IDL Programming Techniques” by David W. Fanning. Cost is $75 from the website http://www.rsinc.com/sv/books.cfm.

• Purchase the IDL student version, install it on your own computer, and read through both its manual and Fanning’s book bit-by-bit in front of your computer.

• Use IDL exclusively as your programming language and use it as much as possible.

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. This is how we learned about IDL’s vast array of procedures.

3. THE GODDARD LIBRARY

One thing that makes IDL extremely useful for astronomers is that lots of astronomers use it. The Goddard folks have written and assembled a great many astronomically useful procedures. We have those procedures in our system^{1}), and you can get them too: just go the website http://idlastro.gsfc.nasa.gov/homepage.html.

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).

1The Goddard routines are in /usr/local/rsi/idl 5/lib/goddard