Howdy, Stranger!

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

Supported by

[solved] I am not able to keyboard to work with Odd Ball Task

edited April 2013 in OpenSesame

Lotje,

I was able to put together an auditory Odd ball task this weekend. Everything works! The odd ball task never occurs two times in a row. I do want to add the key board and have the person hit the space key every time they hear the target sound. I have tried to follow the tutorial creating a Gaze Cuing Experiment and have placed the key board in my experiment but when I check the excel worksheet it does not record the keystroke of the space bar.

Is there something I need to type in the script you provided for the Key board to record the hitting of the space key when a person hears the target sound?

I am sorry to bother you with this and I am hoping on can figure out the connection with Emotiv and setting the triggers on my own.

Kind Regards,

AJ

Comments

  • edited April 2013

    Hi AJ,

    Did you insert a logger item after your keyboard_response item?

    Or did you add self.log(myvar) to the code in your inline_script item? (if you're using an inline_script)

    Cheers!
    Edwin

  • edited April 2013

    Before I got your response I found your keyboard functions page and I made a _inline_script and placed it under trial sequence:

    from openexp.keyboard import keyboard
    my_keyboard = keyboard(exp, keylist=['space'], timeout=400)
    start_time = self.time()
    key, end_time = my_keyboard.get_key()
    self.experiment.set('response', key)
    self.experiment.set('response_time_keyboard_response', end_time - start_time). 
    

    The problem is that on the excel worksheet the correct response and response time will be recorded but always for the trial below the Target:

    26  None    400 non_target
    27  None    400 non_target
    28  None    400 non_target
    29  None    400 non_target
    30  None    400 target
    31  space   31  non_target
    32  None    400 target
    33  space   130 non_target
    34  None    400 non_target
    35  None    400 non_target
    36  None    400 non_target
    37  None    400 non_target
    38  None    400 non_target
    39  None    400 non_target
    40  None    400 non_target
    41  None    400 non_target
    42  None    400 non_target
    43  None    400 target
    44  space   39  non_target
    45  None    400 non_target
    46  None    400 non_target
    47  None    400 non_target
    48  None    400 non_target
    

    What am I doing wrong? is this sometime type of timing problem or did I just put the script in the wrong place. I am it is something simple I just can not figure it out.

    Best,

    AJ

  • edited 10:37PM

    From the looks of it, I'd say that your logger seems to be placed before your inline script, meaning that it will log the values of the previous trial. To verify this, could you perhaps post a screenshot of your overview (or of the relevant part only)?

  • edited April 2013

    I am sorry, I am working on a lap tap and I can not find the print screen button. Are you asking the information under trial sequence. If that is what you are requesting the order is determine_ trial_ type (script)

    # Determine the trial type of the current trial 
    # by 'popping' (i.e. taking without replacement) 
    # one item from the previously-defined trial list.
    
    # We do this by using the built-in Python function pop():
    trial_type = trial_list.pop()
    
    # Next, we should set the variable 'trial_type' to
    # make it available in the GUI (notably, the Run-if 
    # boxes in the trial_sequence item).
    
    # We do this by using the built-in OpenSesame experiment 
    # function exp.set():
    exp.set("trial_type", trial_type)
    
    ~~
    
    Then the script I placed in my last email: determine_keyboard_response
    non-target sampler
    target sampler
    sketch pad
    logger 
    
    If this may help you, block sequence has the following script:
    
    ~~~ .python
    # Import the built-in Python module random:
    import random
    
    # Define counters:
    nTarget = 50
    nNonTarget = 500
    
    
    # Create a list containing for example 50 targets and 
    # 500 non target:
    trial_list = ["target"]*nTarget+ ["non_target"]*nNonTarget
    
    # Shuffle the list by using the random.shuffle() function:
    random.shuffle(trial_list)
    
    # Check for two targets in a row:
    
    # Give the Boolean keepRunning a starting value:
    keepRunning = True
    
    # We walk through the list until our criteria are met:
    while keepRunning:
    
        # Set keepRunning to False
        keepRunning = False
    
        # For every item in the list, check whether this item AND the next
        # one are 'target' (note that we skip the very last one because
        # it has no following item):
        for i in range(len(trial_list)-1):
    
            # If the current item and the next one are 'target':
            if trial_list[i] == trial_list[i+1] == "target":
    
                # Set keepRunning to True, meaning the list doesn't meet our criteria yet:
                keepRunning = True
    
                # Swap the content of the current item and the previous one:
                trial_list[i], trial_list[i-1] = trial_list[i-1], trial_list[i]
    
                # And break from the current loop to walk through the list again:
                break
    
    # Make the trial_list global such that it becomes available in future inline_sript
    # items as well:
    global trial_list
    

    Thank you so much for being patient with me and helping me figure this out
    Kind Regards,
    AJ

  • edited April 2013

    Oh Man,
    that last comment was a mess.
    Trial Sequence:
    determine_trial_order
    determine_keyboard_response
    non_target
    target
    sketchpad
    logger

    Script for determine_trial:


    # Determine the trial type of the current trial # by 'popping' (i.e. taking without replacement) # one item from the previously-defined trial list. # We do this by using the built-in Python function pop(): trial_type = trial_list.pop() # Next, we should set the variable 'trial_type' to # make it available in the GUI (notably, the Run-if # boxes in the trial_sequence item). # We do this by using the built-in OpenSesame experiment # function exp.set(): exp.set("trial_type", trial_type)

    Script for block sequence determine_trial_order

     # Import the built-in Python module random:
    import random
    
    # Define counters:
    nTarget = 50
    nNonTarget = 500
    
    
    # Create a list containing for example 50 targets and 
    # 500 non target:
    trial_list = ["target"]*nTarget+ ["non_target"]*nNonTarget
    
    # Shuffle the list by using the random.shuffle() function:
    random.shuffle(trial_list)
    
    # Check for two targets in a row:
    
    # Give the Boolean keepRunning a starting value:
    keepRunning = True
    
    # We walk through the list until our criteria are met:
    while keepRunning:
    
        # Set keepRunning to False
        keepRunning = False
    
        # For every item in the list, check whether this item AND the next
        # one are 'target' (note that we skip the very last one because
        # it has no following item):
        for i in range(len(trial_list)-1):
    
            # If the current item and the next one are 'target':
            if trial_list[i] == trial_list[i+1] == "target":
    
                # Set keepRunning to True, meaning the list doesn't meet our criteria yet:
                keepRunning = True
    
                # Swap the content of the current item and the previous one:
                trial_list[i], trial_list[i-1] = trial_list[i-1], trial_list[i]
    
                # And break from the current loop to walk through the list again:
                break
    
    # Make the trial_list global such that it becomes available in future inline_sript
    # items as well:
    global trial_list
    
    

    Sorry again for the comment above. I hope this helps you figure things out.

    Thank You

    AJ

  • edited 10:37PM

    Let me try this one more time.

    Trial sequence
    determine_trial_ type
    determine keyboard response
    non_target: player
    Target: player
    sketch pad: fixation dot
    Logger

    I will put script for determine_ trial_ type and determine trail order in the next comment so I do not mess up again

  • edited April 2013

    determine_ trial_ type:

    # Determine the trial type of the current trial 
    # by 'popping' (i.e. taking without replacement) 
    # one item from the previously-defined trial list.
    
    # We do this by using the built-in Python function pop():
    trial_type = trial_list.pop()
    
    # Next, we should set the variable 'trial_type' to
    # make it available in the GUI (notably, the Run-if 
    # boxes in the trial_sequence item).
    
    # We do this by using the built-in OpenSesame experiment 
    # function exp.set():
    exp.set("trial_type", trial_type)
    

    determine_ trial_ order

     Import the built-in Python module random:
    import random
    
    # Define counters:
    nTarget = 50
    nNonTarget = 500
    
    
    # Create a list containing for example 50 targets and 
    # 500 non target:
    trial_list = ["target"]*nTarget+ ["non_target"]*nNonTarget
    
    # Shuffle the list by using the random.shuffle() function:
    random.shuffle(trial_list)
    
    # Check for two targets in a row:
    
    # Give the Boolean keepRunning a starting value:
    keepRunning = True
    
    # We walk through the list until our criteria are met:
    while keepRunning:
    
        # Set keepRunning to False
        keepRunning = False
    
        # For every item in the list, check whether this item AND the next
        # one are 'target' (note that we skip the very last one because
        # it has no following item):
        for i in range(len(trial_list)-1):
    
            # If the current item and the next one are 'target':
            if trial_list[i] == trial_list[i+1] == "target":
    
                # Set keepRunning to True, meaning the list doesn't meet our criteria yet:
                keepRunning = True
    
                # Swap the content of the current item and the previous one:
                trial_list[i], trial_list[i-1] = trial_list[i-1], trial_list[i]
    
                # And break from the current loop to walk through the list again:
                break
    
    # Make the trial_list global such that it becomes available in future inline_sript
    # items as well:
    global trial_list
    
  • edited 10:37PM

    Thank you so much! just moving the script and now everything works. Again I am so sorry for making such a mess of this post. Thank you also for being so patient with me

  • edited April 2013

    Haha, I think it might be useful to know that you can post text in it's original layout by using '< pre >' and '< /pre >' tags (without the spaces, mind you!), like so:

    This is some text.
        This is some more text.
    ==================
    

    Good to know that you've fixed it! If I understand correctly, you did indeed misplace the script a bit?

    Good luck with further testing!

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