Note: If you are new to IDL or upgrading from an older version, see also:
The ALOG2 function computes the logarithm base-2 of the input variable.
The BigInteger class allows you to create and manipulate integer numbers of any size. You can use BigIntegers in mathematical expressions in combination with other BigIntegers or regular numbers. The BigInteger class also has numerous methods for exploring the properties of your BigInteger numbers. For example:
b = BigInteger(2)^1279 - 1
HELP, b
PRINT, '2^1279 - 1 is prime?', b.IsPrime() ? 'true' : 'false'
c = b.NextPrime()
PRINT, 'next prime is ', c - b, ' greater'
IDL prints:
B BIGINTEGER <ID=1 LENGTH=1279 bits> = 1.0407932194664400...x10^385
2^1279 - 1 is prime? true
next prime is 2056 greater
For more examples see the BigInteger class.
You can now create BOOLEAN variables which only contain the values 0 (false) or 1 (true). Boolean variables are actually variables of type BYTE with a special boolean flag. Because they are type BYTE, boolean variables can be used anywhere that a byte variable is used.
There are also two new system variables, !TRUE and !FALSE, which are boolean variables with the value 1 and 0, respectively.
The boolean flag is used when printing out HELP information, when modifying elements within a boolean array, and when converting to and from JSON. For example:
a = [0.0, 1.0, 0.0, 3.0]
b = BOOLEAN(a)
b[2] = "yes" ; equal to "true"
HELP, b
PRINT, b
PRINT, JSON_SERIALIZE(b)
IDL prints:
B BOOLEAN = Array[4]
0 1 1 1
[false,true,true,true]
For more information, see the BOOLEAN and BOOLARR functions.
You can now analyze the code coverage for your applications using the CODE_COVERAGE function. The function returns the line numbers of code that were executed and not executed for your given routine. In addition, the Code Coverage feature has been integrated into the Workbench. You can turn on Code Coverage highlighting for Editors, as well as display Code Coverage statistics in the Profiler View:
For more details see the CODE_COVERAGE function, the Code Coverage Workbench page, and the Profiler View.
The new FOLDERWATCH object monitors folders for changes and invokes a user-defined callback whenever a change occurs. This enables IDL programmers to create a "batch" client that watches a specified "hot folder" and subsequently performs processing when specific conditions have been met (e.g. a file has been added to, modified, or deleted from the folder).
; Get working directory
CD, CURRENT=c
f = FOLDERWATCH( c, 'MyCallback', /ADDED )
The new FFT_POWERSPECTRUM function computes the Fourier Power Spectrum of an array. In addition, the function can return additional information including the amplitude, phase and significance levels associated with the result.
The Generate Code method generates the code needed to reproduce the contents of a graphics window. This method can be used to generate code after changes have been made interactively in the graphics window, e.g., moving, resizing, or changing properties.
p = PLOT(/TEST, THICK=3, COLOR='red', LAYOUT=[2,1,1])
b = BARPLOT(/TEST, FILL_COLOR='green', LAYOUT=[2,1,2], /CURRENT) p.GenerateCode, 'mycode.pro'
You also have the option to save all the data used in the visualizations within the graphics window so you can share the generated code.
For more information on generating code, see the Generate Code Guide Me.
You can now create simple inline routines that can be used for functional programming. These Lambda routines can be used with the new ::Filter, ::Map, and ::Reduce methods, or you can simply call them as standalone functions or procedures. For example:
; Use Map to return the square root of a number
var = [0:5]
PRINT, var.Map(LAMBDA(n: sqrt(n)))
IDL prints:
0.000000 1.00000 1.41421 1.73205 2.00000 2.23607
Next use Lambda with the Filter method to return prime numbers:
var = [2:50]
lam = LAMBDA(n:n le 3 || MIN(n mod [2:FIX(SQRT(n))]))
newvar = var.Filter(lam)
PRINT, newvar
IDL prints:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
We can also make function calls directly on the returned Lambda variable:
compile_opt idl2
; Are these prime numbers?
PRINT, lam(499), lam(4999), lam(49999), lam(499999), lam(4999999)
IDL prints:
1 1 1 0 1
See LAMBDA and LAMBDAP for details.
You can now access special attributes on all IDL variables. For example:
var = RANDOMU(seed, 200, 100)
PRINT, var.length
PRINT, var.ndim
PRINT, var.dim
PRINT, var.typecode
PRINT, var.typename
IDL prints:
20000
2
200 100
4
FLOAT
These attributes provide a convenient shorthand for the SIZE, N_ELEMENTS, and TYPENAME functions, and are also faster to call. See Variable Attributes for details.
You can now call special static methods on all IDL variables except objects and structures. For example:
var1 = RANDOMU(seed, 200, 100)
PRINT, var1.Mean()
PRINT, var1.Total()
var2 = var1.Sort()
HELP, var2
IDL prints:
0.501100
10022.0
VAR2 FLOAT = Array[20000]
Another example using strings:
str = " IDL is Hard. "
if (str.Contains("hard", /FOLD_CASE)) then $
str = str.Replace("hard", "fun", /FOLD_CASE)
str = str.ToUpper()
str = str.Trim() ; remove leading/trailing whitespace
PRINT, str
IDL prints:
IDL IS FUN.
In many cases, calling the static method will be faster and more efficient than the equivalent function call. For example, the ::Sort and ::Uniq methods both avoid making an intermediate "index" array and just return the sorted or unique elements.
Many of these methods provide new functionality. For example, see the IDL_String::Capwords, ::Startswith, ::EndsWith, and ::Replace methods.
|
Compare Convert Diff Equals Filter Finite FromBits |
Hashcode HasValue IsFinite IsInfinite IsNaN IsReal |
Map NestedMap PtrValid Reduce Reform Shift |
Sort ToBits ToDouble ToInteger ToString Uniq |
|
Capwords CharAt Compress Contains EndsWith Extract |
IndexOf Insert Join LastIndexOf Matches Remove |
Replace Reverse Split StartsWith Strlen |
Substring ToByte ToLower ToUpper Trim |
|
Ceil Floor Imaginary |
Mean Median Min |
Max Product Real |
Round Signum Total |
|
BitGet BitLength BitSet |
BitShift ToASCII ToBinary |
ToHex ToOctal |
|
PtrType Valid |
|
|
For details see Static Methods and Attributes.
The ARRAY_EQUAL function has new keywords: NOT_EQUAL and QUIET. The NOT_EQUAL keyword reverses the meaning of the test, which is useful for checking whether an array contains a particular value or not. The QUIET keyword suppresses any type conversion errors. See ARRAY_EQUAL for details.
ERRORPLOT has two new properties: ERRORBAR_LINESTYLE and ERRORBAR_THICK, to control the linestyle and thickness of just the error bars.
The FILE_DELETE procedure now has a RECYCLE keyword, which will send files to the operating system's recycle (or trash) bin, instead of permanently deleting them. This keyword is only available on Windows platforms and is quietly ignored on other platforms.
The List, Hash, Dictionary, and OrderedHash objects have three new methods:
The List object also has a new NestedMap method, which passes the data values and arguments in a nested loop, to perform list comprehension.
For details see List, Hash, Dictionary, and OrderedHash.
You can now create Hash and OrderedHash objects with case-insensitive keys. If the FOLD_CASE keyword is set, then the case for string keys will be ignored when accessing keys, adding new keys, removing keys, or changing values. Note that even though the key matching is case insensitive, these objects always preserve the case of the key when it was originally set. See Hash for details.
The List object has a new List::Sort method which lets you sort the list elements using an optional compare function.
The IDL_Container class has the following improvements:
For details see IDL_Container.
Better chromacoding and formatting for structure fields and system variables.
Added TICKUNITS="numeric" and TICKUNITS="scientific" as optional types to IDLgrAxis.
If a routine is marked with compile_opt nosave, then it will be excluded from IDL save files, unless the routine was specifically included as an input argument to the SAVE routine. See compile_opt for details.
You can now unregister properties from any object than inherits from IDLitComponent. Unregistered properties will no longer appear in the Property Sheet for that object, but can still be accessed through ::GetProperty and ::SetProperty. See IDLitComponent::UnregisterProperty for details.
By default, graphics windows are created with a toolbar containing some common tools such as Print and Save. You can use the new NO_TOOLBAR keyword to avoid creating the toolbar. This allows you to create graphics windows that are smaller than the default size. This keyword is available on all graphics functions such as PLOT or WINDOW.
By default, when saving to a bitmap that is less than 300 dots-per-inch, IDL will now use anti-aliasing to produce a smoother output image. You can use a new ANTIALIAS keyword to control this default behavior. See the ::CopyWindow and ::Save methods for details.
The ISA function has new keywords: COMPLEX, FLOAT, INTEGER, STRING. These allow you to test the data type of the input variable. See ISA for details.
When converting an IDL structure, you can now set a new LOWERCASE keyword to convert the tag names to lowercase in the resulting JSON string.
JSON_SERIALIZE now converts byte values into integer values (in the range 0–255) instead of a "true/false" boolean. Before, JSON_SERIALIZE used to convert all non-zero byte values to "true", which caused a loss of data.
See JSON_SERIALIZE for details.
IDL's object and new graphics now allow you to input Unicode characters that have up to 8 hexadecimal digits. For example:
p = PLOT(/TEST, TITLE="!Z(10900)", FONT_NAME="Aegean")
Note: This example will only work if you have the Aegean font installed on your system.
cURL library updated to version 7.36.0.
OpenSSL library updated to version 1.0.1g.
HDF5 library updated to provide read-only support for SZIP (v2.1) compression.
The TIMER object now has Block and Unblock methods. IDL no longer automatically interrupts callbacks.
In previous versions of IDL messages from FFmpeg would be reported as errors and IDLffVideoRead object initialization would fail.
Now in IDL 8.4 if the video file contains any video or audio codecs that are not supported then IDL will quietly ignore these codecs and continue to open the file.
Users can set the new VERBOSE keyword to force IDL to issue informational messages when it encounters any unsupported codecs.
IDL 8.4 will be the last version to include the obsolete Live Tools routines. After IDL 8.4 these routines will no longer be included with the IDL distribution.