summaryrefslogtreecommitdiffstats
path: root/software/idl.page
blob: 78e41b3a0d5a599338ec10fcc3862a6ae94f0865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
format: rst
categories: software
toc: no
...

==================
IDL
==================

IDL is the "interactive data language", a clunky old propriatary numerical
analysis language still used by the astronomical community.

Language Design
-----------------

IDL is "pass by reference", which means that arguments to functions are always
variable pointers, not the actual value (the alternative is usually to pass by
copy, where the value gets passed through to a new variable inside the
function. One side effect of this is that return values are collected by
passing a recieving variable name as an argument to functions.

Syntax
-----------------

Procedures are called with a comma seperated list-like syntax where the first
element is the procedure and the following elements are arguments. 

The ``!`` character as a prefix is used to designate system variables.
 
``;`` is used for commenting.

``.`` can be used to start executive commands, 
Indicate constant is floating point 
Start executive command 

``&`` separates multiple statements/expressions on a single line (like ``;``
often does in other languages).

``*`` can be used for pointer dereferencing, as well as for multiplication
and a wild card in array slicing.

``@`` is used to include files, or execute a batch file.

``?`` brings up the IDL GUI help interface when entered at the
command line.

Instead of the ever-standard ``!`` to execute system commands, use ``$``. Also,
an ``$`` at the end of a line means continue to the next line, like ``\``.

X Windows
--------------
When used remotely with X Windows, sometimes plots don't refresh correctly
(eg, blacked out after another window has covered them). To correct this issue,
add these lines to your ``~/.Xdefaults``::

    !stuff to manage IDL under 24-bit Linux displays
    idl.retain:2
    idl.gr_visual: TrueColor

and then run ``xrdb -merge ~/.Xdefault``. (This tip from 
http://star.pst.qub.ac.uk/help/idl.shtml)

Basic Constructors
--------------------
BINDGEN, CINDGEN, DCINDGEN, DINDGEN, FINDGEN, L64INDGEN, LINDGEN, UINDGEN, UL64INDGEN, and ULINDGEN create arrays of increasing values, similar to range() in python; the prefix characters indicate the data type (B = byte, C = complex integer, etc).

The exponent notation ``5.67e3`` creates a floating point number, while ``5.67d3`` creates a double length float.