Howdy, Stranger!

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

Supported by

Running Psychopy code in Open Sesame 3.1.2

edited August 2016 in OpenSesame

Hi, I was working on an experiment on eye tracking in Gap Overlap Task. In this, I had to present the random animations for which I wasn't able to figure out in open sesame how to rotate the image as I do not have much experience in inline script python programming so I thought of switching to Psychopy. I have prepared the experiment in Psychopy but wanted the experiment to run in Open Sesame because I also have the questionnaire which is designed in Open Sesame. Now, I read through a similar post by Agata who also asked the same question and I tried the method but I am getting the following error. I am unable able to figure out how to resolve it.

File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
File "", line 18, in
File "/Users/Arpit/.psychopy2/versions/psychopy/data.py", line 12, in
from pandas import DataFrame, read_csv
ImportError: No module named pandas

Can I download the above module in Open Sesame? If so, how?

Thank you for the help!!

Comments

  • Hi arpit,
    It seems psychopy needs pandas while this package isn't included in the OpenSesame Mac package. You can install it yourself by putting this piece of code in an inline script at the start of your experiment, and then run it once. Once pandas is installed, you can remove these lines (or the whole inline script containing them) again.

    import pip
    pip.main(['install', 'pandas'])
    

    If you ever need to install extra packages, see http://osdoc.cogsci.nl/3.1/manual/environment/ for instructions on how to do so.
    Daniel.

    Buy Me A Coffee

  • edited August 2016

    Thank you, Daniel for a quick reply. It resolved the problem of missing pandas module but again running the script I get another error of:
    File "/Users/STEVEMACHINE/.psychopy2/versions/psychopy/gui.py", line 8, in
    import wx
    ImportError: No module named wx

    I tried installing it in a similar manner as suggested by you but I am getting an error.
    I was reading through documentation which mentions downloading wxpython for pyschopy backend. Can I install wxpython? Does it have to be in opens sesame?

  • Right, then you also need wxPython. You should be able to install this with the command

    import pip
    pip.main(['install', 'wxPython'])
    

    Pretty odd though, as you are not using and GUI elements of psychopy so it should not really be needing wx. In any case, this should help you forward.

    Buy Me A Coffee

  • I am not sure what you mean when you said using GUI elements of psychopy. Maybe with some explanation I can say if I am using it or not.
    I tried your code but am getting the following error

    Collecting wxPython
    Could not find a version that satisfies the requirement wxPython (from versions: )
    No matching distribution found for wxPython

    Thanks again

  • I don't think that wxPython can be installed through pip. So installing it into OpenSesame's Python environment will be tricky.

    I am not sure what you mean when you said using GUI elements of psychopy.

    wxPython is the GUI library used by PsychoPy's builder. Apparently, even though you're not actually using the PsychoPy builder, this library is still imported. Could you post your actual script so that we can see where the error comes from?

  • Ok, let's try again, but this time with an attachment ;-)

  • Stop! Please read my comment above. I'll re-open the discussion in a bit, and then you can upload the script as an attachment, post it to pastebin, or whatever--but not thousands of lines posted as comments!

  • Sorry for the mess earlier. I am attaching the link of pastebin for the psychopy code.
    pastebin.com/ST7kmPdt

  • Actually, I figured out the need for Wx python as in the code I was importing GUI from Psychopy so that I could enter the participant's info. I have removed that part of the code but I wanted to know if I can implement a similar method in open sesame as it is being used as the file name.

  • I wish to use the open sesame window to draw the stimuli but instead the psychopy window is being drawn in the inline script. I wish to replace it kindly suggest.
    Also, I am using this window to get the frame rate using win.getActualFrameRate() in psychopy. Can you please suggest the replacement in open sesame.
    Similarly for win.monitorFramePeriod.
    Thanks again.

  • I wish to use the open sesame window to draw the stimuli but instead the psychopy window is being drawn in the inline script. I wish to replace it kindly suggest.

    Your script is intended to be run standalone, and thus creates its own window here:

    win = visual.Window(
        size=(1280, 800), fullscr=True, screen=0,
        allowGUI=False, allowStencil=False,
        monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
        blendMode='avg', useFBO=True)
    

    So you need to remove this line, so that OpenSesame's own win object will be used. You also need to remove the lines that quit experiment (again, OpenSesame does that for you):

    win.close()
    core.quit()
    

    After that, in principle, you should be able to run the experiment.

    I'm not sure that this is the way to go, though. Although you can run your script in OpenSesame, doing so will not automagically make your script play nicely with other parts of your experiment. For example, OpenSesame and PsychoPy use different ways of logging data. And you will need to use the psycho backend, which means that forms will be slow. Perhaps it would be easier to just create two separate experiments? One in PsychoPy, as you've already done; and a separate one in OpenSesame, for the questionnaire.

  • Thanks Sebastian, I made the required changes in the inline script and now it is running fine. Actually, I have made two separate experiments for each questionnaire and the gap task. But I do not want to use two separate environments so I want to only stick to open sesame. Also in pschopy I need to install the pygaze backend which is already installed in open sesame, so this saves some effort.
    I wanted to know how can I use the participant's information entered during the start of experiment as a file name. The information entered at the start of the experiment is stored as which variable and how to use it in inline script.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games