Category "rIDL"


I’ve wanted IDL batch files to be executable scripts for awhile, but figured I would just have to live without that since IDL’s comment character is not #. But then found out that Scheme also uses the ; as the comment characters, but allows the first line to begin with #! (the shebang) and just ignores that line. So I made rIDL mimic that:

$ mg_shebang_test.pro
This is an executable rIDL script!

where the mg_shebang_test.pro script is:

#!/usr/bin/env ridl -quiet
; This is an example of an executable rIDL script that recognizes the shebang
; characters, #!, on the first line of the script.
print, 'This is an executable rIDL script!'
exit

This was actually quite simple to add to rIDL; I would love to see this feature in regular command line IDL.

rIDL is a command line version of IDL offering tab completion, more logging options, better multi-line command editing, and keybindings. See previous articles for more information: 1, 2, 3, 4.

rIDL has been extremely useful for me when using IDL from the command line, but so far I only had it building on Mac OS X. I finally broke down and made a real build system for rIDL based on CMake. I have currently tested builds on Mac OS X and 64-bit Linux, though I am hoping it works more widely.

Get the lastest source code with Subversion:

$ svn co http://svn.idldev.com/ridl/trunk ridl

I currently don’t have any official releases of rIDL, it is definitely a work in progress. See the README file in the source for instructions on building.

You will need to have a working GNU Readline available on your system. On Mac OS X, I use Homebrew to install Readline:

$ sudo brew install readline

Readline is usually available on most Linux systems.

Let me know if there are issues!

I have been adding a “notebooking” feature to rIDL (a more fully featured IDL command line replacement, see this post for an introduction to rIDL) which can save commands entered, the output log, and graphics created into a single HTML file, like this (shown in miniature on the right). The commands entered to produce this page are shown in ridl_notebook_demo.pro.

Notebook

The goal for notebooking is to be able to quickly produce a log of input and output (both text and graphics) in a single file in a visually appealing manner. This notebook should be able to be published in some manner easily (hence HTML output). Notebooks could easily be created demonstrating how to perform some action and showing the expected output.

All that is required are the notebook and :save_graphic rIDL magic commands:

rIDL> :notebook output.html
rIDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
rIDL> s = streamline(u, v, x, y, rgb_table=3, auto_color=1, $
..... x_streamparticles=50, y_streamparticles=50, $
..... arrow_size=0., font_size=11)
rIDL> :save_graphic

The :save_graphic command currently works for saving the current new graphic, iTool, or direct graphics window.

rIDL is still only available from the subversion repo:

$ svn co http://svn.idldev.com/ridl/trunk ridl

It should build on Mac OS X “fairly easily” (requires installing GNU readline) and on Linux with a bit more work.

I recently added some commands to rIDL to view and manipulate the command history. This makes it easier to copy commands entered at the command line to a file. See the screencast below for a demo.

Bridge command line to files

The first goal for my rIDL project was to completely emulate of all of command line IDL’s functionality. Once that is implemented, then extra cool stuff can be added. I’m getting close this goal (of course, I couldn’t help myself and there is some extra cool stuff in there already).

I have addressed two items where rIDL was not up to IDL’s standards:

  1. events were not handled properly when running widget programs
  2. commands were not saved between sessions

I still need to allow setting preferences with a command line switch when starting IDL as in:

$ idl -IDL_QUIET 1

There are plenty of small things that are not quite exactly the same, e.g., rIDL does not check the IDL_RBUF_PERSIST preference yet, is just assumes that you want the command history to persist between sessions. It will take some time to sort all these out (and even to discover what they are).

The code is not ready for a formal release yet. But those interested in poking around can get the code with Subversion:

svn co http://svn.idldev.com/ridl/trunk

It should build on Mac OS X (but you have to build GNU Readline first), but you are on your own on other platforms. If you have questions, comments, suggestions, etc. let me know!

I have been interested in creating a better command line interface to IDL for a long time. I have been using the wonderful IPython interface to Python since I began programming in Python a couple years ago and I always have wanted the equivalent interface for IDL.

My goals for the project are:

  1. implement all the functionality of normal command line IDL
  2. use GNU Readline to get a lot of command line editing power including tab-completions for filenames, routine names, variable names, keyword names, etc. and better history searching
  3. make .edit work on the command line (it works for the IDL Workbench and the old IDLDE, but not command line IDL)
  4. add useful “magic commands” i.e. meta-commands that are handled by an rIDL pre-processor

My current prototype at least addresses each of these ideas.

Check out the screencast showing my progress so far. I would like to get all the current IDL command line functionality into rIDL before making a formal release, but expect some type of pre-release soon.

rIDL screencast