Howdy, Stranger!

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

Supported by

from with display block

edited February 2017 in Expyriment

I intended to represent 3 stimuli at the same time in each trial on the screen. In the next step, we will ask from participant to choose between one of two options and select the most relevant words to the target. In each trial, stimuli display on the screen for 6 sec and within this 6 sec participant has to answer the question and then we go to next trial. The code is as below: ( I removed not important lines)

    ## display each stimuli
    def disply_block(stim1,stim2,stim3):
        canvas = expyriment.stimuli.Canvas(size=(600, 600)) 
        canvas.present()
        fixcross.present()
        exp.clock.wait(500) 
        stim1.present(update=False)
        stim2.present(clear=False, update=False)
        stim3.present(clear=False)
        exp.clock.wait(6000)
        button, rt = exp.keyboard.wait(keys=response_keys,duration=6000)_




    block = design.Block()
    ## initialize experiment
    exp = expyriment.design.Experiment(name="task")
    expyriment.control.initialize(exp)
    # Define and preload standard stimuli
    blank = stimuli.BlankScreen()
    blank.preload()

    # left and right arrow keys for responses
    response_keys = [misc.constants.K_LEFT, misc.constants.K_RIGHT]
    # display triangle stimulus for  block cf
    block_one= expyriment.design.Block(name="block1")

    #trial 1
    trial1, stim1,stim2,stim3=draw_stimuli(trials['Trial0'][0],trials['Trial0'][1],trials['Trial0'][2])
    trial2, stim4,stim5,stim6=draw_stimuli(trials['Trial1'][0],trials['Trial2'][1],trials['Trial2'][2])
    add_trial_block(trial1,trial2)

    expyriment.control.start()
    #
    disply_block(stim1,stim2,stim3)
    disply_block(stim3,stim4,stim5)
    blank_page(10000)
    expyriment.control.end()

I have few question regarding this code and I would appreciate if you provide me a solution: it seems each trial display for 12 sec instead of 6 sec. It seems it is relevant to this part of code:

exp.clock.wait(6000)
button, rt = exp.keyboard.wait(keys=response_keys,duration=6000)

Question1: how can I give the time to the participant to answer the question only within that 6 sec that stimuli display on the screen?
Question 2: how can record exact response time?
Question2: how can I be sure that only first attempt of the participant to answer the question will be recorded?
Question3: how can I be sure that even if the participant answer after 6 sec, no response will be recorded anymore?
Question4: as my participants are French speaker, how can I initialize experiment ( cut down timer/ read) in French?

Your help is highly appreciated in advance.

Comments

  • Hi,

    1. delete exp.clock.wait(6000)
      If you want to show the stimulus always 6000ms, irrespective of whether the participant answered earlier, just wait the remaining time after the exp.keyboard.wait line: exp.clock.wait(6000-rt)
    2. why would rt not be exact?
    3. see 1
    4. see 1; if the participants answers after 6000ms, then your code proceeds (e.g. shows next trial)
    5. you cannot. the countdown is only meant for the researcher, to signal that the Python core needs 10 seconds in the beginning to stabilize, in order to be timing accurate

    I hope that helped. Let me know if you have any further questions.

  • edited February 2017

    Hi Flad, thank you very much for your informative reply. After I changed it as below:

            button, rt = exp.keyboard.wait(keys=response_keys,duration=6000)
            exp.clock.wait(6000-rt)
    

    I got this error:

                    exp.clock.wait(6000-rt)
                    TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'
    

    I try to understand what this error means.

    It's always a pleasure to exchange with you. Thank you very much and I appreciate your comments.

  • Oh sorry, I forgot the case that the participant does not respond within 6000ms. In this case the return value is None, None.

    So the correct code should be:

    button, rt = exp.keyboard.wait(keys=response_keys,duration=6000)
    if rt is not None:
        exp.clock.wait(6000-rt)
    
  • Thank you very much. The problem is fully solved.

  • To explain the error message a bit: It means that you were trying to use the - operator on two things that were of different types. The 6000 is an integer, while the rt apparently was None, which is an instance of the NoneType. Python does not know how to use the - operator on these two items (as subtraction is only defined on two numerical types), and it hence threw the error you say. But with the code in my last reply this should not happen anymore, as exp.clock.wait(6000-rt) will only be called when rt is not None (which it only is when no button has been pressed; if a button has been pressed it will be an integer, that can be subtracted from the 6000ms without an error). I hope this explanation clarifies things a bit more.

  • Thank you. Your explanations are very clear to me. I appreciate your favor to explain it fully.

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