I linked to a great post on FlowingData a few weeks ago about some basic rules for visualizations. Nathan then gave a more detailed treatment of his first rule:

I already covered the small handful of rules that pertain mostly to traditional statistical graphics. The first one–to always start your bar charts with a zero baseline–unexpectedly drew some disagreement, and I am unexpectedly compelled to go into more depth.

Great alternatives to a non-zero baseline.

There are quite a few new features in IDL 8.5 that I have not covered in previous articles. Here is a summary list:

  • There is now a DIALOG_COLORPICKER which you can present to users to choose a color:

  • Analogous to the command line utility with the same name, IDL 8.5 adds a WGET routine to retrieve the contents of a URL:

    IDL> wget('http://www.google.com/index.html', filename='google.html')
  • In function graphics, the BARPLOT, ELLIPSE, and POLYGON routines now support fill patterns. The new keywords PATTERN_BITMAP, PATTERN_ORIENTATION, PATTERN_SPACING, and PATTERN_THICK specify the fill pattern.

  • Before IDL 8.5, it was possible to have hashes of hashes of hashes, etc., but it was necessary to manually create each level of the hashes. Elements of a hash of a hash were accessed via h['a', 'b'], which was shorthand for (h['a'])['b']. Now it is possible to have IDL automatically create the necessary levels of the hash during a hash assignment:

    IDL> h = hash()
    IDL> h['a', 'b', 'c'] = 5
    IDL> h
        "a": {
            "b": {
                "c": 5
  • Server-side sockets actually have been present in IDL for awhile, but they are now documented.

Since this spring when I sold the last print copies, Modern IDL has been available as PDF only. I have not wanted to make another print run because of the large up front investment required, but I have finally explored the on demand printing services that have been around for awhile. I am happy to announce that a print version of Modern IDL is now available on Lulu.com.

The new version is perfect bound, not spiral bound like the old print version. Also, new features of IDL 8.5 have been included in this new print version and the PDF (still available on the Modern IDL website).

If you purchased the Modern IDL PDF in the past and have not received a link to the new version, please let me know.

The IDL 8.5 feature that I am most excited about is the Jupyter notebook kernel for IDL. For a certain type of analysis, the notebook is a great tool for both recording an interactive session as well as presenting it to others. From the Jupyter documentation:

The Jupyter Notebook is a web application for interactive data science and scientific computing. It allows users to author documents that combine live-code with narrative text, equations, images, video and visualizations. These documents encode a complete and reproducible record of a computation that can be shared with others on GitHub, Dropbox and the Jupyter Notebook Viewer.

The IDL kernel provided in IDL 8.5 works well. The only issue I had with the notebook was that only the first direct graphics plot was displayed. The workaround was simple, though a bit tedious — I just needed a WINDOW command before each plot. I had no issue with function graphics plots, widgets, or non-graphical commands in my first explorations.

I’m still uncertain of the exact use cases for which the notebook will be valuable, but I intend to spend some time trying to find them. As a simple example, here is a notebook (and HTML representation) of the first section of my book, Modern IDL.

This is a great article about managing code in your personal library — code that might not be cared for as much as code in a project seen by others.

Over time you have probably developed a set of python scripts that you use on a frequent basis to make your daily work more effective. However, as you start to collect a bunch of python files, the time you take take to manage them can increase greatly. Your once simple development environment can become an unmanageable mess; especially if you do not try to have some consistency and common patterns for your development process.

Except for the section on pandas, almost everything is just as applicable to IDL as Python. I know I changed my attitude about my own library at some point, converting it into an open source project (even if no one uses it). Making the code usable for others makes it readable for yourself in a few months (weeks, days?). Even if your code isn’t actually available to others, acting like it could be is valuable.

One of the major features of IDL 8.5 is the two-way bridge between IDL and Python. This allows Python functionality to be accessed from IDL (Python has a lot of libraries for things that fall outside of the standard scientific routines found in IDL) as well as accessing IDL functionality from Python (call legacy IDL code).

The IDL-Python bridge works with either Python 2 or 3 (whew, I’m still on Python 2!).

Continue reading “IDL 8.5: IDL-Python bridge.”

Another of the side effects of the IDL-Python bridge is to add the ability to define dynamic methods (function pointers are the other). Dynamic methods are a way to define arbitrary methods for a class at runtime.

To implement dynamics for a class, inherit from IDL_Object and define the following method:

function my_class::_overloadmethod, method_name, a, b, c

As always, method names, which will be passed as method_name to this function, must be a valid IDL method name.

While the other Python bridge related feature, function pointers, should be a useful addition that I intend to use, I would recommend staying away from dynamic methods. The only reason I could see for using them is to dynamically make bindings for a library in another language such as is done with the Python bridge.

See the IDL Data Point article for more information.

There are a lot of suggestions for visualizations, but only a handful of actual rules.

An important side effect of the IDL-Python bridge is to add some Python features to IDL in order to be able to effectively expose a Python API in IDL. One of these is the introduction of “function pointers”, a way of treating an object as a function. This is useful because objects have a lot of nice properties just from being a variable — they can be stored in a variable, passed to other functions, saved in a .sav file, etc. With the introduction of function pointers, functions have these same properties.

Continue reading “IDL 8.5: function pointers.”

IDL 8.5 is available for download from the Exelis VIS site, though the official release will be in September. Chris Torrence, IDL developer:

Just to clear up any speculation or confusion, there were some contractual reasons why we needed to release IDL 8.5 and ENVI 5.3 now. But the “official” release will actually be in September, and that’s when we’ll make an announcement and send out emails to everyone.

So just think of this as a perk for those of you who are reading our blogs and on the newsgroup. It’s like being in on the kickstarter before anyone else.

There are some exciting new features in IDL 8.5, including:

  1. function pointers and dynamic methods
  2. wget function
  3. function graphics updates
  4. IDL-Python bridge
  5. Project Jupyter notebok

I will have more details about each of these once I get IDL 8.5 licensed and explore a bit.

older posts »