Astrophysics: Available Software: Wrapper scripts

If you really must go skinny-dipping with a Vorlon, don't forget your oxygen mask. (Ranger One)

Some utilities within certain software suites require a specialised "microclimate": certain environment variables which need to be set before the software can function properly. The central idea of a "wrapper script" is a "divide and conquer" approach to this:

  • The script alters its own internal environment, then runs the "wrapped" software on your behalf.
  • Meanwhile, back at your own command prompt, you haven't had to change your shell's environment in ways which may conflict with other software you may be using.

Additional benefits:

  • Some utilities are intended to most often be launched via the GUI, and require special pleading to be invoked from a command shell. The wrapper script can encapsulate the necessary "magic" on everybody's behalf.

    • If a program such as this is launched from the command line, the shell you launch it from will wait patiently till you've exited from the program; this is annoying if your interaction with the program will be solely through the GUI. The "magic" mentioned above can include launching the program in the background, so you get your shell prompt back sooner.

  • Some utilities are broken as delivered, but can be persuaded to co-operate with our production environment by small acts of kindness at the command line or by setting environment variables. The aforementioned "magic" can include said acts and settings.

  • Some utilities' command-line interfaces can be spectacularly user-hostile. A wrapper can take the opportunity to do some preprocessing of command-line arguments to simplify the user interface, or to swallow gratuitous warning messages due to a known bug in the underlying software.

Please see also:

The following wrapper scripts live in /Local/bin:

AdobeReader (alias acroread)

Usage:

acroread filename.pdf

This uses Adobe Reader or Preview to open the requested document, depending whether Adobe Reader has been installed or not. In either case, it notes that use of Adobe Reader is deprecated due to its notorious security history, which is why it's not installed by default. Please see also preview below.

ds9

This is SAOImage DS9 (a viewer for astronomical data, often in FITS format). Usage:

ds9 filename

The package SAOImage DS9 7.1 is now available for installation from the Astrophysics category of Self-Service. This is completely independent of the SciSoft installation, and in particular does not need SciSoft to be Activated. Please note that the new DS9 employs X11/XQuartz rather than Apple's native GUI, which can have some interesting side-effects; but its display can be tunnelled over SSH (which SciSoft's version can't).

The wrapper script acts as follows:

  • If the environment variable $MY_DS9_DIR is defined, and points to a directory containing a ds9 executable, said executable is launched.

  • If not, and the SAOImage DS9 7.1 package has been installed, the appropriate executable is launched.

  • As a last resort, the wrapper falls back on SciSoft's ds9.

    • You'll get comments about SciSoft being seen, but these are all internal to the wrapper script.

emacs-x

Please see GNU EMACS (command line) (in Editors Available in Astrophysics).

gnuplot

The first part of this script tries to launch our MacPorts incarnation of GNUplot if possible, whatever Activations you may have executed first in your current shell. The second, legacy part reluctantly tries to kludge round certain problems with SciSoft's build of GNUplot, with only partial success .... which is why we put GNUplot into our MacPorts build.

Usage:

gnuplot filename

.... at the shell prompt will start GNUplot, and launch AquaTerm to do the actual displaying (if you're logged onto the system at the console). If you wish or need to use an X11 display instead, for example if you've tunnelled into your system over SSH, say:

set term x11

.... at the gnuplot> prompt. In either case, the display window itself will only open once you've told it to display something, eg by my favourite GNUplot test command:

plot sin(x)

Benefits of using X11 include being able to tunnel it over an SSH session, and (in the MacPorts incarnation, at least) being able to properly interact with the displayed image using the mouse.

iraf

Please see:

[BOOKMARK: SciSoft-free URLs belong here]

matlab

Usage:

  • matlab
    Start up the interactive GUI desktop in the background.
  • matlab arg [...]
    Start the command-line interface, on the assumption that the user knows what he or she is doing.

In either case, the wrapper script seeks out the latest available version of Matlab on your system. (This is not quite trivial, as the location has changed in a nontrivial manner at least once.) If there is sufficient demand, we may make it possible to have more than one instance on the same machine, and to permit selection between them at invocation time.

preview

For symmetry with acroread above: This launches MacOS X's Preview to view the named document, even on systems where Adobe Reader has been installed and has been nominated as the default program with which to open PDFs.

pyraf

Please see:

[BOOKMARK: SciSoft-free URLs belong here]

R

If the R statistical suite (alias GNU S) has been installed, this will launch it from the command line.

sext

This is SExtractor ("a program that builds a catalogue of objects from an astronomical image"), which for some reason isn't trivially easy to find in the Starlink installation. Usage:

sext arg [...]

.... with the same command-line arguments that you would normally give.

Notes:

  • The incarnation of SExtractor in the (deprecated) SciSoft suite may be easier to discover for yourself; sadly, in SciSoft's July 2011 build, it has been found, on at least one occasion, to reliably produce bizarre images (MaJoC's instant reaction: "This may be Art, but is it Astrophysics?"). This spurred the search for alternatives; hence this wrapper script.

  • The version of SExtractor in AstrOmatic (qv) is younger than that in Starlink (at the time of writing, v2.8.6 plays v2.5-1). If AstrOmatic has been installed, sext will use AstrOmatic's version in preference.

  • Names have been changed, twice, to protect the innocent. Application Setup now knows all four names of which I'm aware (sextractor, sex, sext, and extractor), and its help and search facilities couple them with Starlink's extractor catalogue entry, and with the help entry for this script.

  • If you need to use SExtractor, you will by definition already be (or be about to become) an Advanced Player, and will therefore need no more handholding here. In particular, you won't need to have the SExtractor home page pointed out to you.

SuperMongo

SuperMongo used to be available as an add-in to (the obsolescent) SciSoft suite, but that seems to have been discontinued. A freestanding instance of a later version, which uses Matt Tecza's AquaTerm driver, is now available for installation from Self-Service. The wrapper script will use our version if possible, and SciSoft's if necessary (and available).

Usage: Install from the Astrophysics section of Self-Service, then say:

sm

.... at the shell prompt, plus any command-line arguments you may need.

Categories: Apple | Astro software | Astrophysics | Mac | OS X