IDL: where to begin (for those new to IDL)

Things to remember:

1. Type 'idl' to start, or 'idlde' if you want the development environment
   (GUI version, with debuggers, profilers etc.)

2. Type '?' for detailed help pages - this is identical to the 3 volumes
   of books that come with IDL so don't bother with the books

3. Most useful commands are print, mean, min, max, where, plot, oplot
   - lots more in the index of the help pages

a = 3
b = 5
c = a*b
print, c

x = findgen(100)
y = x^2
plot, x, y

4. Type 'help' to get a listing of what arrays are in the memory and
   what procedures have been compiled.

Batch files and procedures

1. Use '@filename' to run commands from a file - N.B. you cannot use nested
LOOPS (e.g. FOR LOOPS) in batch files. These are useful for quick jobs.

2. Procedures look like the following (e.g.

PRO test, x, y, z

a = x + y + z
print, a


Compile them using '.run test' and then type 'test'. If you have
linked them into your path (see below) you can just type 'test' and it
will compile and run automatically.

Output to postscript

1. First set the output to the postscipt device rather than the screen -
        IDL > set_plot,'ps'

2. Set the name of the output file (if you don't specify a name the output
goes to by default):
        IDL > device,filename=''

3. Plot you graph as you would normally e.g.
        IDL> plot,x,y,title="A Title"

4. Close the file:
        IDL> device,/close

5. Set the device back to the screen:
        IDL > set_plot,'x'

Customizing IDL

In your .cshrc file in your home directory (this file contains the
   settings for your machine and any of your own modifications can go
   in here), type:-

setenv IDL_STARTUP /home/username/idl.start

When you login this will tell IDL to look for a file called idl.start
in your home directory. You can now place IDL commands into this text
file (idl.start) with your own customizations.

The most important thing is to link in extra paths containing useful
procedures (e.g. the IDL Astronomy libary). The astronomy library
lives on the system in /usr/local/rsi/idl_5.4/astro_lib/pro (at the
moment anyway). So to add all the directories in here you can make IDL
get them automatically using the EXPAND_PATH function as follows:

; IDL STARTUP FILE put in extra paths

!path = expand_path('+/usr/local/rsi/idl_5.4/astro_lib/pro/') + !path

However, I recommend that you go to the web page where it tells you all
about the different procedures and how you can download them. You can
then install them on your scratch disk and link them from there so you
can keep them up to date.


1. Search on the web for particular functions - e.g. IMDISP is very
   useful for displaying images - it automatically scales the image to
   the device and can put axes and other things very quickly and
   easy. There are also other libraries (e.g. the COBE data analysis
   software can be downloaded).

 Useful websites:-

 IDL Astronomy User's Library:

 Introduction to IDL:

 U of W Astronomy IDL Page:

 Please let me know of any other BASIC problems/tips that might be useful to newcomers (particularly students) to IDL.

Clive Dickinson
California Institute of Technology

Mail-stop 105-24

Pasadena, CA 91125


Phone: +1 626-395-5869 (my desk at extension 5869)

Fax: +1 626-568-9352 (reception fax)