Skip to main content

Calling ISIS programs from Python


https://img.shields.io/pypi/v/kalasiris.svg https://img.shields.io/conda/vn/conda-forge/kalasiris.svg https://github.com/rbeyer/kalasiris/workflows/Python%20Testing/badge.svg https://img.shields.io/circleci/project/github/conda-forge/kalasiris-feedstock/master.svg?label=noarch Documentation Status Codecov Status

The kalasiris library is a Python library to wrap functions and functionality for the Integrated Software for Imagers and Spectrometers (ISIS).

Features

  • Primarily a very lightweight wrapper around Python’s subprocess module to allow easy calling of ISIS programs in the shell from within Python.

  • Calling compatibility with pysis (and emulation of return types)

  • Works with ISIS 3.6.0 and higher.

  • Works with Python 3.6.0 and higher.

ISIS

This library really only works if you already have ISIS installed and working properly. Quirks of working with where and how ISIS is loaded in your environment and how to use kalasiris with it, can be found in the documentation.

Citing in your work

Beyer, R. A. 2020. Kalasiris, a Python Library for Calling ISIS Programs. 51st Lunar and Planetary Science Conference, not held due to COVID-19, Abstract #2441. ADS URL

Quickstart

Are you new to Python? Do you just want to write something ‘real quick’ in Python and need to call some ISIS programs now?

We’ve got you covered.

Need to run an ISIS program like cam2map:

from kalasiris import cam2map

fromcube = 'something.cub'
tocube = 'something_mapped.cub'
cam2map(fromcube, to=tocube)

Easy! Assuming you have a something.cub file that can be map-projected. The first positional argument will be assumed to be the “from” parameter, but you could also explicitly use from=fromcube here.

In addition to just calling all ISIS programs this way, you can do other fun things like this:

import kalasiris as isis

img      = 'PSP_010502_2090_RED5_0.IMG'
hicube   = 'PSP_010502_2090_RED5_0.cub'
histfile = 'PSP_010502_2090_RED5_0.hist'

isis.hi2isis(img, to=hicube)

InsID = isis.getkey_k(hicube, 'Instrument', 'InstrumentId')
print(InsID)
# prints HIRISE

isis.hist(hicube, to=histfile)

h = isis.Histogram(histfile)

print(h)
# prints the hist file header info

print(h['Std Deviation'])
# prints 166.739

print(h[1])
# prints the second row of the histogram:
# HistRow(DN=3924.0, Pixels=1.0, CumulativePixels=2.0, Percent=4.88281e-05, CumulativePercent=9.76563e-05)

print(h[1][3])
print(h[1].Percent)
# both of the above print 4.88281e-05

You can see that there are things like the Histogram class, the getkey_k() function which is part of the _k function collection, and much more.

Read the documentation for more: https://kalasiris.readthedocs.io

Installation

You can install kalasiris via pip or conda-forge:

To install kalasiris via pip, run this command in your terminal:

$ pip install kalasiris

Installing kalasiris from the conda-forge channel can be achieved by adding conda-forge to your channels with:

conda config --add channels conda-forge

Once the conda-forge channel has been enabled, kalasiris can be installed with:

conda install kalasiris

It is possible to list all of the versions of kalasiris available on your platform with:

conda search kalasiris --channel conda-forge

If for some reason you don’t want to use conda or pip, you could do one of these two things (but really, just use conda or pip):

The core functionality is contained in a single file. Just go into the kalasiris directory, and copy the kalasiris.py file into the same directory where your own program is. It doesn’t depend on anything that isn’t already part of Python, so you can just use it.

Just grabbing this one file gets you the ability to call ISIS programs from your Python programs. There are other parts of this package that provide helper functions (like cubenormfile.writer), classes (like Histogram), and syntactic sugar (the _k functions). You don’t get them by just grabbing kalasiris.py as described above.

However, installation via pip or conda is so easy, and you’re installing ISIS via conda already.


This repository layout was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Metadata

Release files for kalasiris 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kalasiris 1.11.0
File Size Uploaded
kalasiris-1.11.0.tar.gz 53.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kalasiris 1.11.0
File Interpreter ABI Platform
kalasiris-1.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 80.5 kB

Release files / kalasiris-1.11.0.tar.gz

Download URL kalasiris-1.11.0.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
40d4b0da973bd6c20399214ea5ee814624703fd338c1f8458130565af02d4ab9
BLAKE2b-256 checksum
How to use checksums
7c0c09162574ac7406b35f8cfb1febcbf0402c4dd1d3740fd7ea8f21e742e3c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / kalasiris-1.11.0-py3-none-any.whl

Download URL kalasiris-1.11.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bb1145e11ad7ecc14ce692e40cb195c9df3932328235e0b642467561e7fe497
BLAKE2b-256 checksum
How to use checksums
5f34cb52fa181efdcb341624e2016925a3443699eedbed261bf88d9bd6c4c983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release history Release notifications | RSS feed

This release

1.11.0 This release

2 release files

1.10.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page