rbeyer / kalasiris

A Python library to wrap functions and functionality for the Integrated Software for Imagers and Spectrometers (ISIS).
https://kalasiris.readthedocs.io
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

kalasiris.Path interface? #2

Open rbeyer opened 5 years ago

rbeyer commented 5 years ago

Could we implement an object-oriented system where the kalasiris.Path object is subclassed from pathlib.Path, so you can say:

    import kalasiris as isis

    h = isis.Path('some.img')

    h.hi2isis().hical()

    print h.name
    # prints 'some.cub' which is has been run through hical. 
    # Needs some careful thought about how to deal with the actual
    # filesystem files, which may be swapped around.

    # inspect with 
    h.qview()

    # Also overload operators with isis.algebra, so that
    one = isis.Path('one.cub')
    two = isis.Path('two.cub')

    three = one + two
    # is the same as
    isis.algebra(from_=one, from2=two, operator='add', to=?)
    # hmm, how to specify three.name, i.e. the to= cube?  Default to one.name?

Definitely needs some thinking.

michaelaye commented 4 years ago

i really like the algebra idea of this, even so, I think I have never done algebra with ISIS cubes.

For the first part this reminds me a bit of my PathManager object that keeps track of the different calibration states of ISIS cubes:

Screen Shot 2020-04-16 at 22 36 41

Maybe these ideas are combinable... more thinking...