24729 Rate this article:
4.8

IDL 8.3

Mark Alonzo

What's New in IDL 8.3


IDL 8.3 adds new core language features, adds functionality to IDL Graphics, and simplifies building of custom tasks for the IDL and ENVI Services Engine.

New Feature


Dynamic Equation Visualization for Plot, Contour, and Surface
The PLOT, CONTOUR, and SURFACE functions have a new Equation argument (and EQUATION property) that lets you dynamically view your data. You can set the Equation argument to a string containing your equation (as a function of X and Y), or set the argument to a string giving the name of a function. IDL will then automatically generate data that spans your data range and execute your equation to compute the plot. As you pan and zoom within the graphics window, IDL will continue to update your data, allowing you to interactively explore your equation. For more details see Dynamic Visualizations.

IDL Dynamic Visualizations

Implied Print
If you enter an expression or a variable name at the IDL command prompt, IDL will automatically print out the result instead of throwing a syntax error. For example:

IDL> 2+2
  4
IDL> a = [0:10:2]
IDL> a
  0 2 4 6 8 10
IDL> a[2:4]
  4 6 8
IDL> sin(a)
  0.00000000 0.90929741 -0.75680250 -0.27941549 0.98935825 -0.54402113
IDL> IDLUnit('1 kg * c^2')
  8.98755E+016 joule

In addition, for floating-point data types, unlike the PRINT procedure, Implied Print will automatically use the maximum number of digits of precision. For example:

IDL> print, 1.2345678 ; only prints out 6 digits
  1.23457
IDL> 1.2345678
  1.2345678 ← prints out all the digits
IDL> print, !dpi ; only prints out 8 digits
  3.1415927
IDL> !dpi
  3.1415926535897931 ← prints out all the digits

For structures and Hashes, Implied Print will print out both the field names and the values:

IDL> {field1: "hello, world", field2: {sub1:[1,2,3],sub2:2}}
{
  FIELD1: "hello, world",
  FIELD2:
  {
   SUB1: [1, 2, 3],
   SUB2: 2
  }
}
IDL> HASH("field1", "hello, world", "field2", HASH("sub1", [1,2,3], "sub2", 2))
{
  "field1": "hello, world",
  "field2":
  {
   "sub1": [ 1, 2, 3],
   "sub2": 2
  }
}

This feature works when entering commands in both the IDL command line and in the IDL Workbench. It also works with the EXECUTE function (when a special flag is set). However, this feature does not work within IDL routines. To print out expressions and variables within a program you should continue to use the PRINT procedure or use EXECUTE. You can also use a new IMPLIED_PRINT keyword to FIX, PRINT, and STRING to format the output using the same rules.

For details see Implied Print.

Asynchronous Timers
The new Asynchronous Timers provide IDL with non-blocking timers. They offer several advantages over the current widget-based asynchronous timers:

  • Simple and complete API
  • Work in headless environments (are independent of widgets)
  • Higher theoretical resolution
  • Unix: nanoseconds
  • Windows: milliseconds

For information and examples on the new Asynchronous Timers, see TIMER.

System Clipboard Access
You can use the new Clipboard.Get( ) method to retrieve text from your system clipboard, and the Clipboard.Set method to put text onto your system clipboard. For information and examples see CLIPBOARD.

Static Methods and Properties
You can now create static methods on IDL object classes and use the standard "dot" syntax to make static method calls. Static methods provide a useful way to organize code into "packages" based upon the class name.

For example, the IDLUNIT class has a static method called AddUnit that you can use to extend the list of available units. invoke this static method by using the class name and method name:
  IDLUnit.AddUnit, name, value, ...

Static methods are also available on IDLffVideoRead and IDLffVideoWrite for retrieving the list of available codecs and formats. As another example, the new Clipboard Get and Set methods are static.

See Static Methods and Creating Static Methods for information on calling and creating static methods.

Colon Operator for Array Creation
You can use the new colon ":" operator to construct arrays with increasing or decreasing values. The colon operator provides a more readable, short-hand syntax for the *INDGEN family of functions.

The operator has the syntax Result = [start: finish], or Result = [start: finish: increment].

For example:
  arr = [0:1:0.1]
  PRINT, arr

IDL prints:
  :0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

IDLUNIT
The IDLUNIT function allows you to perform basic dimensional analysis, conversions, and mathematical operations, all while factoring units. IDLUNIT is designed to be flexible, allowing you to evaluate simple mathematical expressions or convert units. Results can be used in other IDL functions and programs. For example:

For example:
  PRINT, IDLUnit('20 m/s -> mph')
  PRINT, IDLUnit('1 kg * c^2')

IDL prints:
  44.7387 mph
  8.98755E+016 joule

In addition, the IDL Workbench now ships with an IDL widget application called "IDL Converter" that provides simple conversions between units. You can find the application from the "Macros -> IDL Converter" menu item.

IDL Converter

LambertW Function
The LAMBERTW routine allows you to compute the value of the Lambert W function:

z = W(z) eW(z)

The Lambert W function has many applications in mathematics, computer science, and the physical sciences. For example, it is used in the enumeration of trees, when solving equations with exponentials (such as the maxima of the Bose-Einstein or Fermi-Dirac distributions), or in the solution of linear constant-coefficient delay equations.

LambertW Function

HDF5 Wrapper Routines
IDL now has three new HDF5 wrapper routines to simplify the process of reading and writing data. These routines are:

  • H5_GETDATA
  • H5_LIST
  • H5_PUTDATA

These new routines are high-level and provide basic functionality. If you need additional capabilities, continue to use the standard suite of IDL's H5* routines.

Dictionary Data Type
IDL now contains a DICTIONARY data type, based upon the HASH class. By default the HASH class allows keys that are either case-sensitive strings (with spaces and special characters) or numbers. The DICTIONARY class only allows string keys that are case insensitive and are valid IDL variable names. This makes dictionary variables behave like "dynamic" structures where you can access the key/value pairs using a "dot" notation, but also easily add or remove keys or change the data types of existing key/value pairs. For example:

dict = DICTIONARY("one", 1.0, "blue", [255,0,0], "Pi", !DPI)
  PRINT, dict["one"]
  PRINT, dict.one
  PRINT, dict.ONE

In all three cases IDL prints:
1.00000

Now try changing the data type and dynamically adding a new key:
dict.one = 'my value'
  dict.newkey = [0,1,2]
  PRINT, dict.newkey

IDL prints:
  0 1 2

For more details see the DICTIONARY function.

Ordered Hash Data Type
IDL now contains an ORDEREDHASH data type, based upon the HASH class. By default the HASH class stores its keys in an arbitrary order based upon the hash values. The ORDEREDHASH class always preserves the order of key/value pairs. For example:

  keys = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
  values = LIST('one', 2.0, 3, 4l, PTR_NEW(5), {n:6}, COMPLEX(7,0))
  ohash = ORDEREDHASH(keys, values)
  PRINT, ohash.Keys()
  hash = HASH(keys, values)
  PRINT, hash.Keys()

IDL prints:

  A B C D E F G
  A F C D G B E

SIGNUM function

The SIGNUM function returns the sign of each element of an array. The sign of a value X is defined as:

  • 1 if X > 0
  • 0 if X = 0
  • -1 if X < 0
  • If X is complex then the sign is defined as X/abs(X).

For more details see SIGNUM.

Updates


CDF_VARGET has a new TO_COLUMN_MAJOR keyword
The TO_COLUMN_MAJOR keyword will convert the returned value from row-major form to column-major form. See CDF_VARGET for details.

CW_FIELD sends focus events and has new data types
The CW_FIELD widget has four new keywords: DOUBLE, FOCUS_EVENTS, IGNORE_ACCELERATORS, ULONG. The DOUBLE keyword will create a CW_FIELD widget that accepts double-precision values, while the ULONG keyword will handle unsigned integer data. The IGNORE_ACCELERATORS lets you specify what WIDGET_BUTTON accelerators are to be ignored.
Setting the FOCUS_EVENTS keyword will make CW_FIELD return an event when the keyboard focus on the text field is lost. The widget loses the keyboard focus when the user clicks onto a different widget or application or uses the Tab key to move to a different widget. The FOCUS_EVENTS keyword is useful if you have additional widgets within the same base that need to be updated when the user changes the CW_FIELD value and then clicks somewhere else.
See CW_FIELD for details on these new features.

IDL Command Line will now ignore "IDL>" within commands

Previously, if you pasted example code from documentation or the IDL console and the example code contained the "IDL>" prompt at the beginning of lines, IDL would issue a syntax error. Now, the IDL command line will simply ignore the "IDL>" characters and execute the rest of the command. This new behavior works in both the Unix shell and the IDL Workbench.

DLM_LOAD now accepts a full path
You can now give a full filepath to DLM_LOAD, and IDL will automatically load that module, even if it is not on IDL's !DLM_PATH.

DLM path can now be modified
Before, IDL's DLM path (contained in !DLM_PATH) was a read-only system variable. IDL would only register DLM files on startup, and setting the IDL_DLM_PATH preference would have no effect until your next session.
Now, you can set !DLM_PATH or the IDL_DLM_PATH preference and IDL will immediately register any .dlm files that it finds within the new directories. This allows you to easily add new C-code routines to IDL without having to restart your IDL session.

Event handling while debugging
In the past, IDL would not sent widget events when you were stopped within a routine. Now, by default, IDL sends widget events even when stopped within a routine. This allows you to use graphics and widget applications while debugging.
There is a new system variable, !DEBUG_PROCESS_EVENTS, that can be set to 0 to disable this behavior, or to 1 to enable this behavior. The default value is 1.

IDLgrContour: New LABEL_THRESHOLD property
The IDLgrContour object now has a new LABEL_THRESHOLD property that lets you control whether short contour line segments are labeled or not. Set this property to a floatingpoint value between 0 and 1. Contour line segments whose normalized length is greater than this threshold will be labeled (if C_LABEL_SHOW is set for that contour level), while those whose length is less than the threshold will not have a label. See IDLgrContour properties for details.

IMAGE can now accept an array of color names
In the IMAGE function, you can now pass a string array of color names to the RGB_TABLE property. IDL will then automatically retrieve the RGB values using the COLORTABLE function. For example:

img = READ_TIFF(FILEPATH('image.tif', $
   SUBDIR=['examples','data']))
  i = IMAGE(BYTSCL(img, TOP=3), $
   RGB_TABLE=['light blue', 'green', 'red', 'white'])

KRIG2D and GRIDDATA speed improvements
The kriging algorithm in KRIG2D and GRIDDATA is now about 30 times faster, depending upon the size of your input and output grids. In addition, KRIG2D has new keywords that allow you to use a Gaussian or Linear model, to perform the computation using doubleprecision arithmetic, and to retrieve the X and Y coordinates of the output grid. See KRIG2D and GRIDDATA for details.

POLY_2D can now handle sub-pixel shifts
POLY_2D has a new PIXEL_CENTER keyword, which lets you specify the center location of the input pixels. The default is 0.0, which is the lower-left corner. A typical value would be 0.5, which is the center of the pixel. See POLY_2D for details.

TEXT enhancements
The graphics TEXT function now has a new ONGLASS property that lets you display the text either within the plane of the screen, or using the full three-dimensional transform. This property is especially useful when displaying text on top of a 3D SURFACE, CONTOUR, or VOLUME visualization. See the TEXT function for details.
The TEXT function also has two new symbols, \| to produce parallel lines, and \perp to produce a perpendicular symbol.

WIDGET_BASE new TLB_RESIZE_NODRAW keyword
Set the TLB_RESIZE_NODRAW keyword when creating a top-level base. If this keyword is set then the base widget (and all of its children) will not be redrawn while a user is resizing the widget. See WIDGET_BASE for details.

Graphics: Add option to not draw axes, but preserve the margins
Normally, when you use AXIS_STYLE=0 to avoid drawing axes on a plot or other graphic, IDL will decrease the plot margins so that the graphic almost fills the window. Now, youcan specify AXIS_STYLE=4 to avoid drawing axes, but have IDL use the same margins as if the axes were present. This is useful if you then want to do a plot with axes (using the CURRENT keyword) and have the new plot margins align with the original plot margins. See the AXIS_STYLE keyword within PLOT for details.

Graphics Windows: Zoom in a Single Axis Dimension
Normally, when you use the scroll wheel to zoom in or out, the zoom happens equally in both the X and Y dimensions. To zoom in or out in only one dimension, select the axis dimension around which you want to zoom by clicking on that axis. Once you have just a single axis selected, using the scroll wheel on your mouse will cause the zooming to occur only in the selected dimension. Note that the zoom will be centered about the mouse pointer's position along that axis.

TIC/TOC automatically updates the Profiler View
If you are using TIC and TOC to profile your code using the PROFILER keyword and you are using the IDL Workbench, IDL will now automatically refresh the Profiler View when TOC is called.

Updated Workbench Support for ENVI Services Engine Task Development
The IDL Workbench now contains functionality to help you write and publish Tasks for use in ENVI Services Engine (ESE). This includes the ability to easily create JSON and PRO code, edit and validate JSON files, and publish Tasks from IDL directly to an ESE Server. See the IDL Help topic ESE Tasks for more information on this new Workbench functionality.

Updated Workbench Support for Java JRE 1.7
With IDL 8.3, we have updated the IDL Workbench to support Java JRE 1.7. Additionally, the IDL-Java and Java-IDL bridges now support version 1.7+ of the Java runtime environment.

Please login or register to post comments.