spacetelescope / imexam

imexam is a python tool for simple image examination, and plotting, with similar functionality to IRAF's imexamine
http://imexam.readthedocs.io
BSD 3-Clause "New" or "Revised" License
75 stars 45 forks source link

ds9 is not on path but aliased #167

Closed bsipocz closed 5 years ago

bsipocz commented 5 years ago

It would be nice if connect() would be less picky. I don't have ds9 on my path but as an alias, so it doesn't discover it:

In [2]: viewer=imexam.connect()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-8d9a4c71871d> in <module>()
----> 1 viewer=imexam.connect()

/usr/local/lib/python3.7/site-packages/imexam/connect.py in __init__(self, target, path, viewer, wait_time, quit_window, port)
     96                 path=path,
     97                 wait_time=wait_time,
---> 98                 quit_ds9_on_del=quit_window)
     99             self._event_driven_exam = False  # use the imexam loop
    100 

/usr/local/lib/python3.7/site-packages/imexam/ds9_viewer.py in __init__(self, target, path, wait_time, quit_ds9_on_del)
    228                 self._ds9_path = util.find_path('ds9')
    229                 if not self._ds9_path:
--> 230                     raise OSError("Could not find ds9 executable on your path")
    231 
    232             else:

OSError: Could not find ds9 executable on your path

Alas fixing this is probably an ugly hack, so feel free to close the issue as a won't fix.

sosey commented 5 years ago

ooh, yah, lemme think if there's a clean way to check alias...however, you can start the viewer by giving the path to your ds9 ;) viewer=imexam.connect(path=None). Maybe I should make that more clear in the docs, but let me know if that doesn't work either!

bsipocz commented 5 years ago

Thanks, specifying the path works just as well as putting it on the path. Arguably I didn't go past the first "Simple walkthrough" page, could have spotted the path kwarg in the api docs.

Though now I run into some expected xpa issues, so will try to go down the ginga route tonight instead.

sosey commented 5 years ago

doh, I have a fix already for the alias path... what'w the XPA issue?

sosey commented 5 years ago

I'm really interested in your XPA error, it could just be timing of the ds9 connection, if it's something else I'd like to try and fix it :) Is it similar to either of these? https://github.com/spacetelescope/imexam/issues/164 and https://github.com/spacetelescope/imexam/issues/162 and https://github.com/spacetelescope/imexam/issues/137

bsipocz commented 5 years ago

It has nothing to do with imexam, but ds9 own "thing". Disclaimer, I could never make xpa work on my mac:

In [4]: viewer=imexam.connect(path='/Volumes/Macintosh HD/Applications/SAOImageDS9.app/Contents/MacOS/ds9')

In [5]: Error in startup script: invalid command name "xpafirst::yyparse"
    while executing
"xpafirst::yyparse"
    (procedure "ProcessXPAFirstCmd" line 7)
    invoked from within
"ProcessXPAFirstCmd argv i"
    (procedure "ProcessCommandLineFirst" line 42)
    invoked from within
"ProcessCommandLineFirst"
    (file "/Volumes/Macintosh HD/Applications/SAOImageDS9.app/Contents/Frameworks/Tksao.framework/Resources/library/ds9.tcl" line 472)