ericmandel / pyds9

Python connection to SAOimage DS9 via XPA
76 stars 41 forks source link

setting regions fails #50

Closed wkerzendorf closed 6 years ago

wkerzendorf commented 7 years ago

unfortunately pyds9 fails withits own example:

>>> d.set('regions', 'fk5; circle(345.29,58.87,212.58")')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-196-63d11cb7ad2a> in <module>()
----> 1 d.set('regions', 'fk5; circle(345.29,58.87,212.58")')

/Users/wkerzend/anaconda3/envs/sn1006_wd/lib/python2.7/site-packages/pyds9/pyds9.pyc in set(self, paramlist, buf, blen)
    584 
    585         return xpa.xpaset(string_to_bytes(self.id), string_to_bytes(paramlist),
--> 586                           s, blen, 1)
    587 
    588     def info(self, paramlist):

/Users/wkerzend/anaconda3/envs/sn1006_wd/lib/python2.7/site-packages/pyds9/xpa.pyc in xpaset(target, plist, buf, blen, n)
    163     _freebufs(errs, n)
    164     if errmsg:
--> 165         raise ValueError(errmsg)
    166     return got
    167 

ValueError: XPA$ERROR syntax error: fk5 (DS9:ds9 86ab2324:62914)
ericmandel commented 7 years ago

@wkerzendorf @wjoye That's odd, this works on my Mac, both in pyd9 and using xpa directly. The "syntax error" is coming from DS9 itself and indicates a problem with the argument list. For example, if I change 345.87 to something bogus like x345.87, I get a syntax error.

To determine whether this is a problem on the DS9 side or the pyjs9 side, can you please execute the equivalent command from the command line:

$ echo 'fk5; circle(345.29,58.87,212.58")' | xpaset ds9 regions

You might need to install xpa, if you don't have it installed already -- I'll appreciate the effort.

If you get a syntax error, then we know this is a problem with DS9 handing this command. And the first thing I'll ask is: which version of DS9 you are running?

montefra commented 7 years ago

@wkerzendorf : which version are you using?

wkerzendorf commented 7 years ago

@ericmandel how do I install xpaset?

wkerzendorf commented 7 years ago

@ericmandel done (from source). and it does not like it

xpa git:(master) echo 'fk5; circle(345.29,58.87,212.58")' |xpaset ds9 regions
XPA$ERROR syntax error: fk5 (DS9:ds9 86ab2324:62914)
ericmandel commented 7 years ago

@wkerzendorf XPA source is available here:

https://github.com/ericmandel/xpa

Build with the usual:

./configure
make
make install

I believe Bill makes pre-built binaries are available here:

http://ds9.si.edu/site/XPA.html
wkerzendorf commented 7 years ago

@ericmandel maybe things are much quicker solved in person. Care to join me on: https://appear.in/ds9-powwow ?

ericmandel commented 7 years ago

@wkerzendorf @wjoye Unfortunately, talking directly won't help much: now that we've established that the problem is with DS9 and not pyds9, Bill Joye will have to debug this, not me. Can you tell us which version of DS9 you are running and which OS?

wkerzendorf commented 7 years ago

7.5 on osx sierra.

ericmandel commented 7 years ago

@wkerzendorf @wjoye I'm running 7.5 on OSX El Capitan, and everything seems to work, so we'll have to wait for Bill.

ericmandel commented 7 years ago

We can leave this open for a while, since it documents what has been tried already.

wjoye commented 7 years ago

Sorry for the delay guys, I'm just getting caught up after being out of the office last week. The following works for me under MacOS 10.12 Sierra version 7.6b2 and 7.5 echo 'fk5; circle(345.29,58.87,212.58")' |xpaset ds9 regions

can you do the following for me and list the output

echo 'debug on;fk5; circle(345.29,58.87,212.58")' |xpaset ds9 regions

wkerzendorf commented 7 years ago

@wjoye same:

(sn1006_wd) ➜  surviving_wd  echo 'debug on;fk5; circle(345.29,58.87,212.58")' |xpaset ds9 regions
XPA$ERROR syntax error: fk5 (DS9:ds9 c0a800b3:61534)
ericmandel commented 7 years ago

@wkerzendorf @wjoye Going back to basics, the "syntax error" means that the DS9 region parser did not know what to do with "fk5". We know that "fk5" should be a valid token for the parser, so something odd is happening. Can you please try:

echo 'icrs; circle(345.29,58.87,212.58")' | xpaset ds9 regions

echo 'circle(345.29,58.87,212.58")' | xpaset ds9 regions

The first might actually put a region in the right place. The second might not, if it misinterprets the position as being in pixel units. But no matter, I'm wondering if either of them will parse correctly without a syntax error.

wkerzendorf commented 7 years ago

here's what is going on:

(sn1006_wd) ➜  surviving_wd  echo 'icrs; circle(345.29,58.87,212.58")' |xpaset ds9 regions
XPA$ERROR syntax error: icrs (DS9:ds9 c0a800b3:61534)
(sn1006_wd) ➜  surviving_wd  echo 'circle(345.29,58.87,212.58")' |xpaset ds9 regions 
XPA$ERROR Bad Coordinate mapping, unable to create some region(s). (DS9:ds9 c0a800b3:61534)
ericmandel commented 7 years ago

OK, thanks, that should give Bill some data to guess what is happening. I don't know how the DS9 parser works.

wjoye commented 7 years ago

Ok guys, this is a long shot: try echo 'fk5;circle(202.4757151,47.19562292,3.964")' | xpaset ds9 regions -format ds9 or please set your prefs (Regions: Default format: DS9), save and restart, or just delete your preferences dir/file ($HOME/.ds9 or $HOME/.ds9.prf) I believe the your default regions file format is NOT ds9, hence the wrong parser is been used.

esperlman commented 7 years ago

Hi, I actually don't even get this far. I have a nearly brand-new iMac (running Sierra 10.12.5) and installed ds9 into Applications. Creating regions by hand just simply fails - no error messages, no nothing. No region appears when I click on the image in display window, whether I am in 'region' menu or not. Do you have any thoughts? Thanks, Eric

esperlman commented 7 years ago

Ah ... never mind here - had to go into 'edit' menu and click on 'region'.

sndik16 commented 6 years ago

thanks esperlman, I had the same issue for 30 min or so, and your find with "Edit"->"Region" helped to get to place the regions

montefra commented 6 years ago

As this is not a pyds9 problem, I close the issue