X
25120 Rate this article:
3.8

Basic information about using IDL on Linux

Anonym

Recently, a user contacted us because they were transitioning from using IDL/ENVI on Windows to Linux. The user was very familiar with IDL on Windows but had never used it on Linux, and they were wondering if we had any articles or documentation help them. To help them, I put together the following list of information that I thought might be useful to users who are new to using IDL on Linux:

0) Installing IDL

If IDL is not installed on the system, the first thing you need to do is download the Linux version of IDL from our website and follow the installation instructions to install it.

http://www.exelisvis.com/MyAccount/Downloads/tabid/411/mv/vw2/id/6640/Default.aspx

The directory path "/usr/local/exelis" is the typical/default location where IDL is installed.  The installer for IDL will ask if you want to setup symbolic lines. If you answer"yes", then the IDL environment will be permanently set up on your system. If you answer "no", then you will need to set up the IDL environment every time you launch IDL.

1) Launching command-line IDL

If symbolic links were setup when performing the IDL installation, you should be able to launch IDL by simply entering the command into the terminal:

idl

However, if these links were not setup, then you will need to setup the IDL environment before launching IDL. To do this, you need to source the correct file depending on which shell you are using:

BASH

$ source /usr/local/exelis/idl83/bin/idl_setup.bash
$ idl

CSH/TSH

$ source /usr/local/exelis/idl83/bin/idl_setup
$ idl

You can determine which shell you are using by entering the following command:

echo $SHELL

If you are successful in launching IDL, it will bring up and IDL prompt where you can compile and execute your IDL Programs:

IDL Version 8.3 (linux x86_64 m64). (c) 2013, ExelisVisual Information Solutions, Inc.
Installation number: -99999999999999
Licensed for use by: Exelis VIS IDL floating licenses

IDL>

If you are familiar with the IDL executive commands, they may be useful in this environment:

http://exelisvis.com/docs/Executive_Commands.html

2) Launching ENVI and using a headless system

You can launch ENVI from IDL using the following command:

IDL> en=envi()

If you are using a headless system (a system without a GUI that cannot display images), then you will want to use the HEADLESS keyword when launching ENVI:

IDL> e=envi(/headless)

In addition, if you are on a headless system, use the Z-buffer if generating Direct Graphics with IDL:

http://exelisvis.com/docs/Supported_Devices.html#Z-Buffer

Also, on a headless system, use the BUFFER keyword when using the (New) Graphic. For example:

p = plot(findgen(10), /buffer)
p.save, "plot.png"

3) Differences between IDL programs on Linux and Windows

IDL programs are multi-platform. Therefore, for the most part, you should be able to run the same IDL programs you ran on Windows without changes. However, there are few differences between IDL on Linux and Windows.

One of the  main differences between IDL on Linux and Windows, is that the graphics device on Windows is the "WIN" device, and on Linux, it is the "X" device. Therefore, if you want to display something using Direct Graphics, you need to use the "X" device instead of the "WIN" device:

http://exelisvis.com/docs/Supported_Devices.html#X

In addition, if you want to change the graphics preferences you will need to change the X graphics preferences:

http://exelisvis.com/docs/prefs_gr_x.html

Another minor change you might need to consider is that on linux directories are separated using the "/" character instead ofthe "\" character used by Windows.

4) Editing programs

If you need to edit programs on your Linux system, then there are a few options you can use to do this:

A) idlde

If you are using a headless system, then you can launch the IDL Development Environment and use it the same way you use it on Windows.You can launch it by typing "idlde" instead of "idl" into the terminal.

B) Use another text editor

If you cannot use the IDL Development Environment (ex: ifyou are on a  headless system), then youcan edit IDL programs using a standard linux text editor. A couple populareditors are EMACS and VI:

http://en.wikipedia.org/wiki/Emacs

http://en.wikipedia.org/wiki/Vi

5) How to manage paths preferences

The best way to manage paths and preferences is to use IDL commands such as PREF_SET and PREF_GET. Some examples of how this can be done are shown on the following help page:

http://exelisvis.com/docs/PREF_SET.html

6) Linux Terminal Commands

If you have experience using the DOS command-line, you might find the Linux command-line environment to be pretty familiar. The following website provides a list of DOS commands and their equivalent in LINUX:

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

Some commands that I use a lot are listed below:

cd - Changes the directory location
ls -  List the contents of a directory
mkdir - Make a new directory
more - displays the contents of a file
pwd -  displays thecurrent directory location