Preface — Example code
xvi
A few paths through this book intended to bring the reader up to speed to tackle particular problems are listed below:
1. Those new to IDL and looking to do ad hoc analysis on data and produce simple visualizations should read
Chapter 2, The IDL environment [p. 11], Chapter 3, Variables [p. 25], Chapter 4, File Input/Output [p.
75], and Chapter 6, Direct graphics [p. 131]. Chapter 10, Using the iTools [p. 309] might be useful for
the those who want to interactively analyze and visualize their data with a provided GUI application.
2. Those looking to do more involved processing should read Chapter 5, Programming [p. 107] in addition to
those listed above.
3. Those looking to create interactive applications should also read Chapter 8, Widgets [p. 203], in addition to
all of the above.
4. Those looking to create (possibly interactive) sophisticated 3-dimensional graphics should then read Chapter 7,
Objects [p. 185] and Chapter 9, Object graphics [p. 237]. Alternatively, it might be possible that
Chapter 10, Using the iTools [p. 309] provides a simpler, though difficult to customize, solution.
Those new to IDL should start with Section 1.1, “Getting starting with IDL” [p. 1].
4. Example code
The example programs and batch files containing all the code displayed at the command line from the book can be
downloaded at modernidl.idldev.com.
The example code was modified in some cases to produce the figures shown in this book, e.g., to produce PostScript
output approriate for the book. Style and formatting, such as white-on-black changed to black-on-white, was also
modified in some cases for presentation in book format.
5. Developers from other languages
This section describes IDL’s relation to several popular programming languages. For those familiar with C/C++, Java,
Fortran, or Python, it may be helpful to have a brief comparison of IDL with a known language.
Statically typed languages like C or C++ do not have anything like IDL’s interactive, interpreted environment with
dynamically typed variables. While IDL does allow techniques such as pointers and object-oriented programming, it has
a simplified syntax for them, particularly pointers. Techniques like looping over the elements of an array can be done
(slowly) in IDL, but vectorized techniques which operate on entire array of elements at a time are much more efficient
and approach the speed of well-crafted C code. IDL is written in C, so its default extension and embedding APIs are
provided in C. The CALL_EXTERNAL routine and Dynamically Loadable Modules (DLMs) provide techniques for
extending IDL, i.e., writing C code that can be called from within IDL. In the opposite direction, Callable IDL is a
technique for writing C programs which execute IDL code.
Java developers should note that while IDL allows object-oriented programming, it also allows standard procedures and
functions and that objects in IDL are not automatically garbage collected (although IDL 8.0 does have automatic garbage
collection, the HEAP_GC routine is not a replacement in previous versions of IDL). The Java bridges allow both IDL
code to instantiate Java objects and Java code to instantiate IDL objects.
Fortran code can be called from within IDL using the CALL_EXTERNAL function.