VAS rating failing on account of transform.frozen() in matplotlib/path.py

Showing 1-9 of 9 messages
VAS rating failing on account of transform.frozen() in matplotlib/path.py Horea Christian 1/15/13 2:35 PM
Hi, I am trying to run the following code http://paste2.org/p/2753550 - the rating function is defined on lines 41ff  (I am trying to get a visual analogue scale out of it)

I have tried running a similar script via the builder, as well, and in principle: if singleClick=False the script fails after I click (wherever on the screen) with the following error: http://paste2.org/p/2753557

If singleClick=True it fails with the same error even before I can click.

Additionally the script I linked above (as opposed to the builder alternative) fails to display my cursor.

Do you have any idea what's amiss here? I tried reading the path.py matplotlib file, but I don't really understand what transform.frozen() is all about.

Many thanks for your help,
Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Jeremy 1/15/13 4:19 PM
I haven't seen this one before. It has something to do with how matplotlib.nxutils is working on your system. this is used to detect whether a point is inside a polygon (which is used by the RatingScale code). if nxutils cannot be found, it will fall through to pure python (slower but should work for you). I could add a try - except so that things will fall through to the slow way of doing it.

what version of matplotlib do you have? I have 1.1.0


--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To post to this group, send email to psychop...@googlegroups.com.
To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/zJCBvH5Du9YJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Horea Christian 1/16/13 5:26 AM
I have 1.2.0-r1 A piece of example code would be very much appreciated.
Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Jeremy 1/16/13 5:35 AM
in visual.py around line 7344, look for 

    # faster if have matplotlib.nxutils:
    if haveNxutils:
        return bool(nxutils.pnpoly(x, y, poly))

and change to
    if haveNxutils:
        try: return bool(nxutils.pnpoly(x, y, poly))
        except: pass

and a similar change near line 7380.

    if haveNxutils:
        try:
            if any(nxutils.points_inside_poly(poly1, poly2)):
                return True
            return any(nxutils.points_inside_poly(poly2, poly1))
        except: pass

If you can confirm that this works, I'll submit it as a patch to psychopy.


To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/aJwxMYdATzQJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Jeremy 1/16/13 5:42 AM
looks like it will be a different line number for you. you'll want:
File "/usr/lib64/python2.7/site-packages/psychopy/visual.py", line 7185, in pointInPolygon
Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Horea Christian 1/16/13 7:25 AM
Worked like a charm (well, initially it complained a bit about indenting, so I had to rewrite the paragraph - whitespaces I think)
you can see the working code here http://bpaste.net/show/70666/

Will I be able to pull your modified code from git tonight?

Also, what about the cursor not being shown - any advice on that?

Cheers,
Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Jeremy 1/16/13 7:44 AM

Worked like a charm (well, initially it complained a bit about indenting, so I had to rewrite the paragraph - whitespaces I think)
you can see the working code here http://bpaste.net/show/70666/

Will I be able to pull your modified code from git tonight?


I'm not sure when Jon will pull this into upstream. A better solution would be for someone to figure out why, in your version of nxutils, its getting a numpy.float64 when it did not expect one. Maybe there's a way to get the speed benefits of nxutils for you as well. And this might be needed in the future anyway as matplot lib 1.2 gets used in psychopy.

Also, what about the cursor not being shown - any advice on that?

try setting allowGUI=True in 
    win = visual.Window(.... allowGUI=True, ...)

--Jeremy
 

To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/F1tzt3EOysoJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Horea Christian 1/16/13 7:59 AM
Thanks for the cursor tip :) I think I'll wait for upstream. Is he usually quick?

I shared your/our nxutils inquiry with scipy (since I couldn't get to the matplotlib people directly - maybe you want to try that?)

Cheers,
Re: [psychopy-users] VAS rating failing on account of transform.frozen() in matplotlib/path.py Jeremy 1/16/13 8:03 AM
its in upstream already (!)

I am personally willing to check out the nxutils thing, and talk with scipy or matplotlib people, but I feel I should have a crack at it myself first and be more informed about the issues.


To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/Qo05uGESIsMJ.

For more options, visit https://groups.google.com/groups/opt_out.