Howdy, Stranger!

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

Supported by

[solved] How to get around frame sync issues

edited January 2014 in OpenSesame

Hi,

At the moment I'm trying to create rotating objects for a new paradigm. To avoid timing issues I used the number of frames instead of ms for stimulus presentation.

I wrote the following inline script (the 'run phase' part):

#presentation of stimuli in nr of frames
nrframes = 300
nrsteps = -nrframes /10
#speed at which rotation takes place
rate = 2

#autodraw fixation dot
fixdot.setAutoDraw(True)

#Show fixation + cue arrow for memorization
for frameN in range(30):
    if self.get('memorize') == 'left':
        ArrowL.draw()
        self.experiment.window.flip()
    else:
        ArrowR.draw()
        self.experiment.window.flip()


# Initial fixation
for frameN in range(15):
    self.experiment.window.flip()

#Set autodraw for objects
ImLeft.setAutoDraw(True)
ImRight.setAutoDraw(True)
fixdot.setAutoDraw(True)

#array of points where rotation takes place
rotl = [x-((random.randrange(0, -nrsteps, 10) -(nrsteps/2))) for x in range(nrframes, 0, nrsteps)]
rotr = [x-((random.randrange(0, -nrsteps, 10) -(nrsteps/2))) for x in range(nrframes, 0, nrsteps)]
rots = [x-((random.randrange(0, -nrsteps, 10) -(nrsteps/2))) for x in range(nrframes, 0, nrsteps)]

#Starting point of rotation
r = 0
l = 0
#rotate forward or backward
randr = random.choice([-1, +1])
randl = random.choice([-1, +1])

#Rotating objects according to points in array + congruent/ incongruent sound
for frameN in range(nrframes):
    if rotl.count(frameN):
        randl = randl * -1
        if self.get('congruent') == 'left':
            tone.play()
    if rotr.count(frameN):
        randr = randr * -1
        if self.get('congruent') == 'right':
            tone.play()
    if self.get('congruent') == 'none':
        if rots.count(frameN):
            tone.play()
    r = r + (randr * rate)
    l = l + (randl * rate)
    ImRight.setOri(r)   
    ImLeft.setOri(l)
    self.experiment.window.flip()
#stop autodraw to clear canvas  
ImLeft.setAutoDraw(False)
ImRight.setAutoDraw(False)

#Retention interval
for frameN in range(120):
    self.experiment.window.flip()
#Clear canvas
fixdot.setAutoDraw(False)
self.experiment.window.flip()

I created this on my home pc with a excellent graphics card and it worked great!
Unfortunately, the stimulus pcs in our labs only have onboard graphics cards and there this script doesn't work. I think it has to do with 'frame sync'. I checked the psychopy forum which says: "Some graphics cards, such as Intel GMA graphics chips under win32, don’t support frame sync. Avoid integrated graphics for experiment computers wherever possible." (pretty clear ;) ), however it does not give any alternatives if you have no choice but to work with integrated graphics cards.

While it's going to be part of an EEG experiment in which I need the accurate timing, I do want to do some behavioral runs aswell where timing doesn't have to be as precise, so I could use, for example, the self.sleep() command? However, I have no idea how to do the same thing I did with the frames if I can only use the self.sleep() command.
for example the following part:

for frameN in range(nrframes):
    if rotl.count(frameN):
        randl = randl * -1
        if self.get('congruent') == 'left':
            tone.play()

Any help is appreciated!

Regards,

Michel

Comments

  • edited 8:44AM

    Hi Michel,

    In what sense doesn't the script work? Does the experiment run way too slowly? In that case, as you already suggest, the problem is probably that your computer's video card isn't fast enough to generate the stimuli online. I'm not sure what you have in mind when you want to use self.sleep(), but at any rate: Sleeping will only slow things down even further, so it won't solve anything!

    I'm afraid that if the video card isn't fast enough, there isn't much that can be done about it. Do you preload a lot of stimuli, or do you have a lot of sketchpads etc. in OpenSesame (these are implicitly preloaded)? If so, you could see if removing some things will speed up your experiment. And, if it does, you could try to come up with a more efficient experimental structure.

    Another option would be to reimplement the experiment using the legacy backend, which is generally faster on systems with poor video cards. But this clearly undesirable, because you will end up with two versions of the same experiment. And it will be a lot of extra work.

    Or maybe convince @durk to buy some decent video cards!

    Cheers,
    Sebastiaan

  • edited 8:44AM

    Hi Sebastiaan,

    Thank you for your quick reply!
    So, yeah, my post wasn't really clear. The 'experiment' actually seems to run to fast on a pc with a onboard graphics card!

    instead of taking around 16,7 ms for 1 frame (depending on refresh ofcourse), getting a smooth rotation of objects, it seems to rush through al commands in order getting a blur of pictures and beeps.

    I don't really know how to make my problem clear in words, since I have no idea of what's going on, so maybe you can take a quick peek at the 'experiment'?
    I posted a link with the experiment and some stimuli:
    dropbox

    You would probably need a pc with and a pc without a good graphics card to see what I mean ;)

    I did convince @Durk to buy some decent videocards, but it's the departement here that I have to convince, and that's not working so far ;)

    Michel

  • edited 8:44AM

    Hi Michel,

    A right, I see. In that case, the blocking flip doesn't work, which means that the computer doesn't wait until a display is actually presented before win.flip() returns.

    And yes, you could just insert a self.sleep() command after every win.flip() call to slow presentation speed down. You'll have to manually tweak the amount of sleeping so that it appears to run at the correct pace. Probably something just short of 16 should do the trick. You're probably aware of this, but this is a hack to throttle presentation speed, and it will not make the blocking flip work again.

    Btw, are you running Windows 7 with graphical effects? If so, disabling these effects may resolve your issue. See also here (there's lots more info on that page):

    Cheers!
    Sebastiaan

  • edited May 2014

    I thought as much. The self.sleep() command works as expected, so I'll just use that.

    I have my windows 7 set on 'best performance', so no pesky visual glitter and glamour. Also it gave the same problem on the lab winXP pcees.

    Thank you for your help!

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