How to install

At the command line:

$ easy_install pysis

Or, if you have virtualenvwrapper installed:

$ mkvirtualenv pysis
$ pip install pysis

Dependencies

For working with ISIS commands, you must firts have USGS ISIS 3 installed on
your machine. See the ISIS 3 installation guide for further instructions.
Remember to set your environmental variables (see step 4 of USGS ISIS guide) so
Pysis knows where your installation is.

Quickstart Guide

How to write ISIS 3 code in python using Pysis.

Using ISIS 3 at the command line you might want to run the following basic
commands (examples for the MDIS camera on the MESSENGER mission):

Getting values from ISIS commands

Pysis commands will return the command’s STDOUT as a byte string. If the command
returns a nonzero exit code, a ProcessError will be thrown. This example
command uses getkey to receive values from the label of an ISIS cube:

Multiprocessing Isis Commands with IsisPool

Pysis has built-in support to make multiprocessing isis commands simple. To run
the above MDIS calibration script for multiple images in multiple processes we
could rewrite the function as so:

from pysis import IsisPool
from pysis.util import ImageName
def calibrate_mdis(images):
images = [ImageName(filename) for filename in images]
with IsisPool() as isis_pool:
for filename in images:
isis_pool.mdis2isis(from_=filename.IMG, to=filename.cub)
with IsisPool() as isis_pool:
for filename in images:
isis_pool.spiceinit(from_=filename.cub)
with IsisPool() as isis_pool:
for filename in images:
isis_pool.mdiscal(from_=filename.cub, to=filename.cal.cub)

When using IsisPool we can’t determine which order commands will be executed in
so we much run each command for all the files as a group before moving to the
next command and creating a new IsisPool.