Coder Social home page Coder Social logo

jessemapel / kalasiris Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rbeyer/kalasiris

0.0 1.0 0.0 179 KB

A Python library to wrap functions and functionality for the Integrated Software for Imagers and Spectrometers (ISIS).

License: Apache License 2.0

Makefile 7.64% Python 92.36%

kalasiris's Introduction

kalasiris

Calling ISIS programs from Python


Documentation Status

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

WARNING

This is a very early development version, be warned!

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 (but not return types)
  • Guaranteed to work with ISIS 3.6.0+, probably works with ISIS 3+
  • Only guaranteed to work with Python 3.6.0+

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.

Quickstart

Are you new to Python? Or you just don't want to mess with sophisticated Python installation procedures? Or you don't want to commit to installing something when you don't know if it will be worth it? Or you just want to write something 'real quick' in Python and just need to call some ISIS programs now?

We've got you covered.

Just go into the kalasiris directory, and copy the kalasiris.py file into the same directory where your program is. It doesn't depend on anything that isn't already part of Python, so you can just use it like so:

from kalasiris import cam2map

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

Easy! Assuming you have a something.cub file that can be map-projected.

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 cubenormDialect), classes (like Histogram), and syntactic sugar (the _k functions). You don't get them by just grabbing kalasiris.py as described above.

If you want all of the kalasiris library, but still don't want to go through some formal installation process, you can clone this repo, and then move (or copy) the whole kalasiris/ directory (instead of just the kalasiris.py file inside of it) to your project, and then do the same thing as above, but now you can do more 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(hicub, '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 you now have access to things like the Histogram class, the getkey_k() _k function, and much more.

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

Installation

Eventually have some instructions here once they've been tested.

How is this different from pysis?

Folks got a lot of use out of pysis, but it hasn't had a release or commits in some time, and due to its implementation and strict checking, it is not compatible with recent versions of ISIS. The main kalasiris implementation can fit in one file and is very lightweight.

Naturally, this means that working with kalasiris is perhaps less forgiving, but we think it is more nimble.

There is also some compatibility with pysis calling syntax, see the documenation for more information.


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

kalasiris's People

Contributors

rbeyer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.