Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Version of Psychopy on OSX right now: safe to upgrade?

Hey,

OK so this post is still about a task I am trying to implement, the same as here http://forum.cogsci.nl/index.php?p=/discussion/4106/problem-with-element-clicked-for-arrows#latest but here I have another issue.

I use psychopy as my back end.

OK so I was implementing the task on opensesame 3.2.4 on windows.

I generated arrows with this script and it was working quite well:

import numpy as np


# calculate length total of an arrow,its position at the beginningm and its position at the end
# relatively to the height of the screen
def calc_parameter_arrow(prop_length_arrow, prop_start_point_arrow):
    length_total = int(prop_length_arrow*var.height)
    pos_arrow_begin = int(prop_start_point_arrow*var.height)
    pos_arrow_final_long = length_total + pos_arrow_begin
    return (length_total, pos_arrow_begin, pos_arrow_final_long)


# convert polar to cartesian
def pol2cart(rho, phi):
    x = rho * np.cos(phi)
    y = rho * np.sin(phi)
    return(int(round(x)), int(round(y)))

# transform a length according to various radian, and return a list of list with the x, y cartesian coordinate of this length for these various radians

def coord_cart_radians(length_given, list_radian):
    deg_rad_pos = map(( lambda x: [length_given, x]), list_radian)
    cartesian_pos_return = [pol2cart(p[0], p[1]) for p in deg_rad_pos]
    return(cartesian_pos_return)

#calculate radian of arrow separated by 45 degrees
nbr_arrow = 8.
degree_sep = 45.
deg = np.arange(nbr_arrow) * degree_sep
var.deg_rad = np.radians(deg)
var.deg_name = [ int(x) for x in deg ]

# various proportion of arrow relative to the height of the screen
var.prop_arrow_long_length_height = 0.3
var.prop_start_point_arrow_long = 0.1


length_arrow_long_total, pos_arrow_begin_long, pos_arrow_final_long = calc_parameter_arrow(var.prop_arrow_long_length_height, var.prop_start_point_arrow_long)

cartesian_pos_arrow_final_long = coord_cart_radians(pos_arrow_final_long, var.deg_rad)
cartesian_pos_arrow_begin_long = coord_cart_radians(pos_arrow_begin_long, var.deg_rad)


Pratice_arrow_long_Instruct_canvas = Canvas()

for pos, (coord_cart_b, coord_cart_f) in enumerate(zip(cartesian_pos_arrow_begin_long, cartesian_pos_arrow_final_long)):    

    Pratice_arrow_long_Instruct_canvas['long_arrow%s' % int(var.deg_name[pos])] = Arrow(coord_cart_b[0],coord_cart_b[1], coord_cart_f[0], coord_cart_f[1], head_width = 50, body_length = 0.8, body_width = 0.5, fill = True, color = 'black')

my_mouse = Mouse(visible=True)
counter = -1
Pratice_arrow_long_Instruct_canvas.show()


while counter <15:
    button,  (x, y), timestamp = my_mouse.get_click()
    var.element_clicked = Pratice_arrow_long_Instruct_canvas.elements_at(x, y)
   counter+=1
    Pratice_arrow_long_Instruct_canvas.show()

Here was the result on windows:

Same script on the version 3.2.4 (same version as windows) on osx:

So well I noticed that on the version of osx the version of psychopy was the 1.82.01.

I updated it with pip within open sesame and now I get this:

For some reasons arrows became blue (current version of psychopy 1.90.1). And no matter what I do it stays blue.

Now something else that happened.
In the same experiment I first generate some image with psychopy then use them as stimulus.

from psychopy import visual, core

var.list_letter_orientation = list()

mywin = visual.Window([var.width,var.height], color = var.background)

text_presented = visual.TextStim(win=mywin,font=var.font_family, color = 'black', height = 0.3)

orientation_letter = range(0,360,45)

letter_list = ['F', 'G', 'J', 'R', 'L']

for letter_selected in letter_list:
    text_presented.text = letter_selected


    for int_orient in orientation_letter:
        text_presented.ori = int_orient
        text_presented.draw()
        mywin.getMovieFrame(buffer='back')
        path_file_name = exp.experiment_path + '/' + letter_selected+ '_' + str(int_orient) + '.png'
        var.list_letter_orientation.append(letter_selected+ '_' + str(int_orient) + '.png')
        mywin.saveMovieFrames(path_file_name)
        mywin.clearBuffer()

mywin.close()

When I tried to do that still on OSX, on psychopy 1.82.01 I encountered this error (while it was running well on the version of windows).

https://github.com/psychopy/psychopy/issues/991

Apparently upgrading psychopy resolved this too. But now I have this blue arrow issue which is very odd, and I wonder if what I did by upgrading is safe.

Thanks!

Best,

Sylvain

Comments

  • Hey,

    OK so I just tried the same thing on ubuntu (without upgrading psychopy) and got the same traceback for the second issue I was refering to.

    What solved at least the consistency between OSX and windows is upgrading psychopy with the version 1.85.3 (that is the one the windows version is coming with) on OSX.

    Just did:

    import pip
    pip.main(['install', 'psychopy==1.85.3', '--upgrade'])
    

    Now for some reason I struggle to upgrade my ubuntu version. When doing the same thing (with pip) I got the traceback:

    pip.main(['install', 'psychopy==1.85.3', '--upgrade'])

    AttributeError Traceback (most recent call last)
    in ()
    ----> 1 pip.main(['install', 'psychopy==1.85.3', '--upgrade'])

    AttributeError: 'module' object has no attribute 'main'

    Yeah it is complicated but I have to switch between the three versions for reasons beyond me.

    Best,

    Sylvain

Sign In or Register to comment.