IDL

Some useful tips on the use of IDL on the ARC network.

Documentation

We have a pair of books on IDL programming - Dave Fanning's 'IDL Programming Techniques', and 'Practical IDL Programming' by Liam Gumley. We also have an online copy of the IDL documentation on the WWW server, which can be searched using the standard search facility.

Screen Refresh Problems

IDL may cause you problems with plot windows refusing to refresh themselves after they've been covered up, and sometimes colours may appear screwed up until the plot window is the active one. To fix this, you should add the following lines somewhere in your ~/.Xdefaults file. Then you'll want to review the notes on KDE to make sure the .Xdefaults file is read each time you logon!
!stuff to manage IDL under 24-bit Linux displays
idl.retain:2
idl.gr_visual: TrueColor
The first line is just a comment, the second line fixes the window refresh problem, and the third line sorts out the colours. So if your colours aren't messed up, you only need to add idl.retain:2, and so on.

Lastly, you'll need to pass the changes to the X Window system, before you start IDL again. To do this, type:
xrdb -merge ~/.Xdefaults
and then start IDL to see if the changes have taken effect.

Consistent colour maps

IDL does a pretty poor job of handling color maps in anything more than 8 bit. Here is a neat little routine that works around this, and allows you to write code that will select colors by name, on either 8, 24, or 32 bit displays. Two routines are provided. One is a demo of the main program, col_define. Both originate from this site. To use these routines, at the start of a program, include the line
col_define, 39
This loads the white/rainbow color table, and is required. Then, when you want to select a color, just issue a command such as:
plot, xdata, ydata, col=!col.red
or !col.white, !col.blue, etc. The full list of defined colours is given in the source code. Dave Fanning gives a full description of the problems with IDL and 24-bit colour here. The main point to notice is that using the device command you can make a 24-bit display largely operate like an 8-bit one. Just type device, decomposed=0.

Last updated Wednesday March 22, 2006