Howdy, Stranger!

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

Supported by

Inconsistent functioning of "Break if" / "run if" [response]

I'm using OS 3.3.11 on a Mac (OS X 10.15.6) - but am also testing this on Dell (Windows 10). I've tried this with Legacy and Expyriment backends (my only options as my videos in media_player_mpy only work here).

I'm running a task with interleaving blocks with young children as participants. I need to be able to pause a block if the child looks away, and also to skip to the next block if the baseline has been presented for long enough.

To pause a block I followed instructions from here: https://forum.cogsci.nl/discussion/1048/solved-i-would-like-a-pause-button. It works! However, it seem glitchy/inconsistent for me. Sometimes I press the 'p' key to indicate run the pause sequence, and it works, sometimes there's no response (the block just continues as normal). Sometimes I'll press the 'p' key a few times and it eventually works.

To skip to the next block I just used the 'break if' function in the Block_loop. I inserted [response] = space. Again this sometimes works. But sometimes doesn't, or sometimes works after a few presses.

Prior to each block I've used an inline script with exp.set('response', 'None')to ensure the variable 'response' is known. So the task does run, and the response buttons do work as expected, but only sometimes.

I'm a bit stuck on how to get these working reliably.

Thanks, Robin

Comments

  • Hi Robin,

    The only source of inconsistency that I can imagine is the timing of the response relative to the presentation. How do you structure your experiment? Is there a long response phase where the keyboard item is polling continuously until a response was made? Or is there a fixed response window?

    If not, then I guess the responses fall outside the response window, either before or after, so that a key press is not registered. If you show your experimental setup it will be easier to find out what is going on, and whether it is fixable.

    Eduard

    Buy Me A Coffee

  • ah, many thanks for the reply @eduard.

    Ok, not sure best way to show the experimental setup. Happy to share the actual experiment if that's easier. But here's a screenshot (I'm an OS newbie so hopefully my design is not too clunky!):

    new_inline_script_1 - this is exp.set('block_starttime', self.time()) to get a time stampfor the block start

    new_inline_script_2 - this exp.set('response', 'None') to prevent the baseline loop complaining that the variable response is not known.

    inline_script_baselineBlock - oxy.WriteEvent("b", "Baseline") to send a trigger to my fNIRS software (Oxysoft) to indicate start of the baseline block.

    In the trial_sequence_2 I have this:


    Then I have the pause_sequence and this is followed by:

    new_inline_script -

    import random

    var.stim_duration = random.randint(1000,3000)

    - i'm presenting a series of jpg's for a random duration controlled by this. The block continues for ~40sec.

    new_inline_script_PauseTrigger - oxy.WriteEvent("p", "pause") to send a trigger to Oxysoft indicating a pause occurred.

    Apologies, I'm sure this is not the most efficient way to show you the design. I wonder if I should move anything around? The new_keyboard_response at the end of the block_loop perhaps? Participants do not respond at all - they keyboard is just being used to send triggers and pause the task.

    Thanks for any further thoughts you might have.

    Robin

  • Yes, share the experiment please :)

    Buy Me A Coffee

  • So, like I thought, you have periods in your experiment in which you don't poll responses. Whatever you press during those phases, will simply be ignored. Specifically, you set the duration of sketchpads to values larger than 0. So, before the experiment will proceed to the keyboard response after, the experiment will stall (be unresponsive) for whatever value you put in duration. If you set that value to 0, you should have more or less direct responsiveness (breaking and pausing a loop).

    To make sure you still have stimulus presentation built in (so a response time of 2000 + duration of the sketchpad, you can use that as input to the duration of the keyboard response.

    You know what I mean?

    Aside of that, I would recommend, that you try to use fewer items in your experiment (combine the inline_scripts, and wrap your baseline, social, nonsocial blocks in a loop), like that the memory foot print of your experiment will be better. (feel free to ignore this advice if you have no problems with the way it is now)

    Eduard

    Buy Me A Coffee

  • Thanks so much @eduard .

    1. First on the sketchpad / keyboard response timing. I think you meant to change the sketchpad duration to 0, and then add the variable [stim_duration] for the Timeout value? This seems to work nicely! Thanks so much.

    I'm actually a bit unsure of the function of Timeout in keyboard_response. In my original design, i had this set to 2000. does this mean that no response is accepted after 2000 ms (ie it times out)? I think i just inherited this from copying from another task.


    2. Next, thanks for the suggestion of using fewer items. I think I have been finding the operation of this task a bit buggy, crashing occasionally - and I wondered if it was too large/cumbersome (I did move videos and jpg's out of the File pool which might've helped a bit. I've combined some of the inline scripts along these lines:

    oxy.WriteEvent("b", "Baseline")
    
    # get a timestamp for the block start
    exp.set('block_starttime', self.time())
    
    #preventing the baseline loop from complaining that the variable response is not known, 
    and to avoid the loop from not executing any cycles at all - due to the break_if 
    response equals space in loop
    exp.set('response', 'None')
    

    Is that what you had in mind?

    My only question here is that I'm trying to get various triggers sent using COM interface. In my baseline block I have one trigger ("p") when I pause the block. And then another trigger when i restart the block ("s"). I think these would need to be in separate inline scripts? (given that in the trial_sequence these are separately set to only Run if [response] = p or [response] = s).

    3. Is there anywhere you can point me towards an example of wrapping different blocks in a loop? I sort of get the principle, but can't see how this would happen. Is it in the experimental_loop that this would be controlled, with only 1 baseline sequence, 1 social sequence, 1 non-social sequence needed, but they get run/looped?

    Thanks again, this is super helpful.

  • I'm actually a bit unsure of the function of Timeout in keyboard_response. In my original design, i had this set to 2000. does this mean that no response is accepted after 2000 ms (ie it times out)? I think i just inherited this from copying from another task.

    No, it mean that the experiment waits for 2000 ms before it will proceed (and sets the response to None), unless of course a key was pressed, then it will proceed immediately.

    Is that what you had in mind?

    Yeah, basically.


    I think these would need to be in separate inline scripts? (given that in the trial_sequence these are separately set to only Run if [response] = p or [response] = s

    Not entirely sure whether it is that easy, but if you want to send trigger p if the response is p and trigger s if the response is s, you could simply use something like:

    if var.response in ['s', 'b','p']:
        oxy.WriteEvent(var.response, message[var.response])
    

    with message being a dictionary mapping keys to messages:

    message['b':"Baseline", 'p': "pause"]
    

    Alternatively, it is not a big deal to have multiple inline_scripts. The experiment is just getting a little cluttered.

    . Is there anywhere you can point me towards an example of wrapping different blocks in a loop?

    Here a generic example. I haven't looked into your code in detail, but it is very well possible that you could even collapse the baseline, social and nonsocial conditions into a single loop/sequence, instead of specific loop/sequence for each condition, but then work with block type variables in the loop table, and variables in the components of the loop that depend on blocktype.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Thanks again @eduard this is super helpful.

    I've economised my blocks by using a loop. I think it's running more reliably now.

    I think I might quit while I'm ahead and keep my separate inline scripts to send separate triggers from the keyboard (though I would like to know for the future - in your suggested code, is the second code message['b': "baseline", 'p': "pause"]  just a new line in the same inline script for the first code you added? or is this inserted somewhere else?


    More importantly, I hope I could trouble you for one more related question. I have not been able to get one of my inline scripts to send an x trigger to oxysoft (fNIRS software). I just have a simple inline script:

    oxy.WriteEvent("x", "Ignore_Block")
    

    The Inline script appears in a sequence (which is in a loop). The sequence has the inline script, then a video (media_player_mpy) with duration set to 20,000, and then I have a keyboard_response with no correct response and Timeout set to 0.

    The idea is that mostly the sequence will run a few videos and no trigger is needed. But occasionally i'll need to send an x trigger.

    I have this basic trigger script working in another sequence in a separate loop. The only difference I can see is that this sequence has a sketchpad with duration 0, and then a keyboard_response with Timeout set to variable [stim_duration].

    I think maybe it's how i've set up the keyboard_response?

    Robin

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