Howdy, Stranger!

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

Supported by

Trying to replicate the Gabor patch from the book "Python for experimental psychologist"

Hi !

I bought the book "Python for experimental psychologists" and I am at the Gabor patch section. I am using the package WinPyhton-PyGaze-0.6.0

My "constants.py" code has the following parameters :

DISPSIZE = (1920, 1080)

DISPTYPE = 'psychopy'

My "experiment.py" code for the gabor patch replicates the book code with the Pygaze version

import pygaze

from psychopy.visual import GratingStim

from pygaze.display import Display

from pygaze.screen import Screen

import pygaze.libtime as timer

disp = Display()

gabor = GratingStim(pygaze.expdisplay, tex='sin', mask='gauss', sf=0.05, size=200)

gaborscreen = Screen()

gaborscreen.screen.append(gabor)

disp.fill(gaborscreen)

disp.show()

timer.pause(1000)

disp.close()


But I got the following error message and I don't get it, so if you help me, it would be great, thanks a lot !


FreeType import Failed: expected string or Unicode object, NoneType found

Traceback (most recent call last):

 File "experiment.py", line 21, in <module>

  disp = Display()

 File "C:\Users\JEANR\Documents\WinPython-PyGaze-0.6.0\WinPython-PyGaze-0.6.0\python-2.7.3\lib\site-packages\pygaze\display.py", line 45, in __init__

  self.__class__.__init__(self, **args)

 File "C:\Users\JEANR\Documents\WinPython-PyGaze-0.6.0\WinPython-PyGaze-0.6.0\python-2.7.3\lib\site-packages\pygaze\_display\psychopydisplay.py", line 70, in __init__

  screen=self.screennr, units='pix')

 File "C:\Users\JEANR\Documents\WinPython-PyGaze-0.6.0\WinPython-PyGaze-0.6.0\python-2.7.3\lib\site-packages\psychopy\visual\window.py", line 237, in __init__

  self.scrWidthCM = self.monitor.getWidth()

AttributeError: 'NoneType' object has no attribute 'getWidth'

0.8789 ERROR  avbin.dll failed to load.

           Try importing psychopy.visual as the first library

           (before anything that uses scipy)

           and make sure that avbin is installed.

0.8931 ERROR  avbin.dll failed to load.

           Try importing psychopy.visual as the first library

           (before anything that uses scipy)

           and make sure that avbin is installed.

0.9754 WARNING     Creating new monitor...

Comments

  • Looks like PsychoPy didn't set up a default monitor. You could pass your own one to the Display when creating it, e.g. by doing the following:

    from psychopy.monitors import Monitor
    
    # Create a new monitor. Set the width and height to values that
    # match your own setup. They are the screen's width and height
    # as measured in centimetres.
    my_monitor = Monitor("Freddy", width=32.0, height=18.0)
    
    # Now pass the monitor to the Display.
    disp = Display(monitor=my_monitor)
    

    P.S. We're working on an update of this book; should be out later this year. Given the changes to Python, PyGaze, and PsychoPy, it's quite necessary!

  • Thank you for the reply ! I am looking forward reading the new version of the book .

    I did the following :

    # "JR" is the name of my laptop

    # 39 and 21 are the actual size of the screen in cm

    my "constants.py" file has the following parameter :

    DISPSIZE = (1920, 1080)

    DISPTYPE = 'psychopy'

    And I got the following error message, but, again, I can't resolve it


  • edited April 3

    Oh, sorry, looks like it assumes height! You can just drop that parameter.

    my_monitor = Monitor("Freddy", width=32.0)
    

    While we're on the topic, you could opt to set the distance between you and the screen (also in cm):

    my_monitor = Monitor("Freddy", width=32.0, distance=67.0)
    


    BTW, this is PsychoPy's API documentation on the Monitor class: https://psychopy.org/api/monitors.html

  • I wrote the line as such : my_monitor = Monitor("JR", width=39.0, distance = 67.0). I got the following. I won't bother you too much with this, I can try the "Psychopy" version of the code that is also in the book



  • Just for information, with the pure Psychopy version of the code, the stim is displayed but still got message error

  • Looks like the actual error no longer appears. The other messages aren't relevant unless you actually use avbin.

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