IDL in Astrophysics

Distributed in the Astro build, along with the licence file pertaining to Astrophysics; available also for update from Self-Service. Please see also IDL if you wish to install it on your laptop.

The GUI application is /Applications/itt/ (for version 8.1), or /Applications/exelis/ (for version 8.2 or later).

You can access IDL from the command line directly, by typing:


.... at the command line: this invokes a script with does the Activation described below internally, without mucking about with your shell's environment. Alternatively, say at the command line:

Activate idl

This modifies your environment to make extension code in our value-added library directories (astron.dir and idlutils.dir under /Applications/itt) available to IDL. If there is more than one version if IDL on your system, and you need to access a specific version, you can say instead (eg):

Activate idl 81

The above Activations do the following, in this order:

  • If the environment variable ${IDL_PATH} isn't empty, its value is reported. (This may disappear soon.)

  • The latest available version of IDL on your system is ascertained, if you haven't specified one.

  • An alias to run the appropriate version of IDL is created by running its initialisation scripts. This bypasses the need to add directories to your ${PATH}.

  • The environment variables ${IDL_DIR} and ${IDL_PATH} will be initialised appropriately. If they're already set, the added entries will be appended to what's already there.

    • If you get conflicts between your libraries and one or more of our value-added library sets, see the section on Library Problems at the end of this page.

  • If the file ${HOME}/.cshrc.idl exists (.cshrc.idl in your home directory; ${HOME}/.bashrc.idl if your current shell is /bin/bash), this will be sourced into your current shell. You can use this to (eg) append your personal IDL-related directories to ${IDL_PATH}, or set ${IDL_STARTUP} (see below).

  • IDL uses the environment variable ${IDL_STARTUP} to point to a file, which can contain IDL commands to help set up IDL to your tastes. Please see Library Problems below for an example.

    The following actions are tried in order, stopping with the first to succeed. Please note that merely placing a file in ${IDL_PATH} will not cause it to be read by IDL at startup time.

    • If ${IDL_STARTUP} is already set, its value is reported. This permits you to specify a filename of your choice, either in ${HOME}/.cshrc or ${HOME}/.cshrc.idl (or their bash equivalents).

    • If ${HOME}/.idl_startup (the file .idl_startup in your home directory) exists, ${IDL_STARTUP} is set to that filename.

    • If ${HOME}/ exists, ${IDL_STARTUP} is set to that filename.

    • If all else fails, the fact that ${IDL_STARTUP} isn't set to anything is reluctantly admitted.

After all that's finished, say idl at the command prompt to launch an IDL session.

PLEASE NOTE: Blindly setting ${IDL_PATH} after the Activation has set it (whether within ${HOME}/.cshrc.idl or later) will cause IDL to forget about its own directories, which is agreed to be less than helpful. Instead, use something of the following form:

  • .cshrc.idl :
    setenv IDL_PATH ${IDL_PATH}:+${HOME}/my/idl/dir

  • .bashrc.idl :
    export IDL_PATH=${IDL_PATH}:+${HOME}/my/idl/dir

  • .idl_startup (approximately, UNTESTED):
    !PATH = !PATH + ":+" + EXPAND_PATH(GETENV('HOME') + '/my/idl/dir')

.... which will append the named directory to the existing contents of ${IDL_PATH}. All assistance humbly accepted for correcting the details of the last suggestion: your humble Author isn't fluent in IDL, and is frankly guessing at the syntax for specifying your home directory in a portable manner.

Library problems:

Certain of IDL's libraries may not be loaded by default. If you get a line of the form

% Attempt to call undefined procedure/function: 'READCOL'.

you may need to add a line of this following form to your ${HOME}/.idl_startup file:

!PATH = !PATH + ":" + \

(This is one line, folded at the backslash. Don't forget to add your own trailing newline.)

You can also use the same mechanism to add your private IDL libraries to IDL's search path, as suggested above. (The need to sometimes do this for system libraries counts as a bug. If you get bitten, please report the fact.)

Conversely, you may have conflicts between your libraries and one or more of our value-added library sets. To test whether this is the case, start a fresh shell, then say one or more of the following at the shell prompt (or the corresponding bash equivalents), before Activating IDL:

setenv IDL_NO_ASTRON true
setenv IDL_NO_IDLUTILS true

These stop the Activation from adding astron.dir (resp, idlutils.dir) to IDL_PATH. If one or more of these helps, you can make this permanent by adding it/them to your .cshrc (though not to .cshrc.idl: by the time this is read, the damage has already been done).

Categories: Apple | Astro software | Astrophysics | IDL | Mac