IDL is a comercial package that requires the payment of licences as well as their anual maintenance. Since the costs are very expensive only a limited amount of IDL licenses are available. Please use them efficiently, and do not block them while not used. At present, there are 30 licenses available in the Unix network, and 6 in dino (a six processor SGI Power Challenge machine for running long jobs). Please do not use more than 1 license at times of high demand (typically from 10am to 5pm weekdays), and please exit IDL promptly when you have finished. To see the licence status in real-time, check the page: http://marta/cgi-bin/licencias.pl?sw=detallado
The current version of IDL is v5.4. However, we are still keeping v5.2 around for avoiding potential problems if you are using old procedures that may not work with the current version. We will try to keep the same policy when installing new versions (but this is a deal with Research Systems, Inc. (RSI) company). If you want to use IDL v5.2, type idl52, idlde52.
Note: many people have noted that IDL is not as precise and fast as fortran or C, therefore it will be a good approach either to call subroutines (within IDL) written in other programming languages (e.g. fortran) or just using IDL to play around with the output arrays from these languages.
The second allows a multiple document interface that includes built-in editing tools. This mode is higly recommended.
To exit an IDL session type
or click on Exit within File (left upper corner of the main menu) if you are within idlde.
The IDLdevelopment environment provides you 5 windows:
Within idlde mode you just need to click on Help at the right upper corner of the main menu.
Getting into the Help is very important and for sure will save you a lot of time when developing your applications. This hypertext provides you several facilities to achieve the desired information even if you don't have any idea of what variable or procedure will you use. Particularly useful is the option Help on IDL where you can get information either by topics or by alphabetical functional list.
You also could access the IDL help outside from IDL by typing idlhelp (which does not not pick up any licence) to start the GUI help window or idldemo to start the Demo mode.
Several manuals in PDF are available at:
All manuals are cross-linked and cross-referenced. Use acroread to read them; for instance:
Information about local libraries can be obtained by typing widget_olh, but it only works when you are within idl v5.2. Help about the local libraries can also be accessed by editing the help files in:
Other sources of information are the ITT website and the David Fanning Consulting page, which contains many other interesting links. Also of interest are the Markwardt IDL Programs and the JHU/APL/S1R IDL page.There is also a very useful set of routines for astronomy in IDL astro lib (help about this library can be found as well by typing widget_olh within idl v5.2). An interesting place is IDL newsgroup. An introductory course given by Reinhold Kroll is available here.
IDL>a='tonto' & b="tonto"
IDL>a=" hello " & b=" hello again " & print,a,b ; this is just a comment to show the usefulness of &
IDL>a=5 & b=2
IDL>; A shorter way of saying IF (a GT b) THEN z=a ELSE z=b:IDL>
IDL>z = (a GT b) ? a : b
IDL provides the following data types:
|Type||Bytes||Range||Conversion Routine Name||Constant||Array||Index|
|Integer||2||-32768 -- +32767||fix||0,0S||intarr||indgen|
|32 Bit Signed Long||4||2x +/- 109||long||0L||lonarr||lindgen|
|32 Bit Unsigned Long||4||0-4x 109||ulong||0UL||ulonarr||ulindgen|
|64 Bit Signed Long||8||-9,223,372,036,854,775,808 --+9,223,372,036,854,775,807.||long64||0LL||lon64arr||l64indgen|
|64 Bit Unsigned Long||8||0-18,446,744,073,709,551,615||ulong64||0ULL||ulon64arr||ul64indgen|
|Double Precision||8||+/- 10308||double||0.0 D||dblarr||dindgen|
|Complex||8||(pair of reals)||complex||COMPLEX(0,0)||complexarr||cindgen|
|Double Precision Complex||16||(pair of double precision reals)||dcomplex||DCOMPLEX(0,0)||dcomplexarr||dcindgen|
|String||0-32767||Text||string||'' or ""||strarr||sindgen|
Unlike Fortran, IDL variables and arrays are defined dynamically and you do not need to declare them at the begining. For example the type of a variable or array may change several times along an IDL procedure. In principle this an IDLadvantage, but be careful since it is very easy to make mistakes!. If yoyIf you wish you can avoid problems by declaring your variables or arrays using the commands tabulated above.
IDL>a = [[0,1,2],[3,4,5],[6,7,8]]
IDL>a = [[0,1,2],[3,4,5],[6,7,8]]*1.0
IDL>print,'a:',a & print,'b:',b
To extract elements, subarrays or vectors from within arrays you only need to specify the subscript of the element [s], the subscript boundaries [s1:s2] or specify the whole set of elements of a desired dimension [*] respectively.
IDL>a=RANDOMU(seed,4,4) ; RANDOMU returns one or more uniformly-distributed,
floating-point, IDL>pseudo-random numbers in the range 0 < Y <1.0
to fill the array.
IDL>print,a & print,a[0,0]
IDL>b=a[0:2,3] & print,b
Some interesting functions to play around with arrays:
ARRAY_EQUAL (compare data for equality in situations where the
index of the elements that differ are not of interest)
CONGRID (resample image to any dimensions)
INVERT (compute inverse of a square array)
MIN (return the minimum element of an array)
MAX (return the maximum element of an array)
N_ELEMENTS (number of elements of an array)
REFORM (changes the dimensions of an array without changing the total number of elements)
REPLICATE (form array of given dimensions filled with a value)
REVERSE (reverse vectors arrays)
ROT (rotate array by any amount)
SHIFT (shift array elements)
SORT (sort array contents and return vector of indices)
REBIN (resample array by integer multiples)
SIZE (return array size and type information, it can be seen from the Variable Watch Window)
TOTAL (sum array elements)
TRANSPOSE (Transpose array)
WHERE (let you know for example where are the array elements satisfying a given condition)
IDL>a = INDGEN(10) & PRINT, 'array = ', a
IDL>r=ARRAY_EQUALl(a,2) & print,r
IDL>;will return 0 (i.e., false) if not all the elements of a are equal to 2, otherwise will return 1, i.e. true)
IDL>a=RANDOMU(seed,4,4) & print,a
IDL>total=N_ELEMENTS(a) & print,total
IDL>a=indgen(4) & print,a
IDL>b = REFORM(a,2,2) & print,b
IDL>a = [[0,1,2],[3,4,5],[6,7,8]] & print,a
IDL>b=REVERSE(a) & print,b
IDL>a = [[0,1,2],[3,4,5],[6,7,8]] & print,a
IDL>b=TRANSPOSE(a) & print,b
IDL>a = INDGEN(10) & PRINT, 'array = ', a
IDL>; Find the subscripts of all the elements in the array that have a value greater than 5:
IDL> result = WHERE(a GT 6, count)
IDL>PRINT, 'Number of elements > 6: ', count
IDL>PRINT, 'Subscripts of elements > 6: ', result
If you wish to keep a record of the commands you type at the IDL command line you can use JOURNAL. The first step is to type
All the commands you type are saved in this file. If you wish to include a comment or any further notation in this file
To end journaling type JOURNAL without arguments
If you wish to use a certain directory where you use to write your own procedures, or to access to a particular library of routines (not included in the defaults), IDL checks the environmental variable IDL_STARTUP when starting a session. All commands and paths you add to this variable will be automatically executed when opening a session. As an example, suppose you wish to include the old version of the popular IDL Astronomy Library which is kept in /usr/pkg/rsi/idl_local/lib_OLD/astro_OLD. The first step to follow is to include in your .cshrc file in your home directory the following statement:
setenv IDL_STARTUP /home/username/idl.startup
according to this statement you allow IDL to look a the idl.startup (you can use a different name if you wish) file located in your home where to check for the IDL_STARTUP variable. Next edit this file and include the following statements to include this directory and all its subdirectories:
IDL_ASTRO_OLD = EXPAND_PATH('+/usr/pkg/rsi/idl_local/lib_OLD/astro_OLD')
!path= IDL_ASTRO_OLD+':'+ !path
Type PATH within IDL to be sure that you really have included the old directory.
Note: it will be activated when you enter a new session but first you should type source .cshrc at your home.
There are many possibilities for your configuration that can be accessed
from the main menu of idlde (click on File and then on Preferences).