Howdy, Stranger!

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

Supported by

[solved] Adding random events throughout a block

edited January 2015 in OpenSesame

Hi all,

This is more out of curiosity than anything else :-)
I am working on an attention experiment in which there are two types of blocks: a safe and a threat block. During the safe block nothing really happens, the participants goes on completing several trials of the attentional task without anything especial going on. In contrast, during the threat block, they are told that they may receive an aversive stimuli (a burst of white noise or a mild electric shock, for instance) at any moment during the block. These aversive stimuli just happen, they are not linked to their performance or to any other task condition whatsoever (except the block type, of course, they only happen during threat blocks).

Within these threat blocks, they may receive a variable (randomly defined) number of aversive stimuli (min 2 max 6 per block, for example). Crucially, these stimuli must be delivered at completely random points during the block, so that they are not at all predictable. The point is to make the aversive stimuli as unpredictable as possible, in order to keep the sense of threat stable (and high) throughout the block.

Now, I have managed to program it with all these conditions, except that the aversive stimuli are always delivered in-between trials. I think this should work out just fine for my purposes, but I was wondering: Is there any way to program these aversive stimuli so that they pop-up at completely random moments, regardless of what the participant is doing or the stage of the trial?

I would really appreciate your thoughts about how to make it work like that. I thought it might work with a parallel element which runs along the block sequence, and just pops the aversive stimuli without interfering with the block flow, but I'm not sure how to make it work out.

Like I said, any ideas would be great. It would be interesting for me to know if such a set-up can be arranged in OpenSesame.

Thanks, and looking forward to any comments!

Daniel

Comments

  • edited January 2015

    Hi Daniel,

    I would advise against using the parallel plug-in, unless it is absolutely necessary. Assuming you are using an inline_script to present the aversive stimulus, your trial sequence will look something like this:

    - sketchpad (fixation)
    - sketchpad (stimulus)
    - keyboard_response
    - inline_script (for noise/shock)
    

    Alternatively, you could make it look like this:

    - inline_script (determine whether shock happens)
    - inline_script (noise/shock)
    - sketchpad (fixation)
    - inline_script (noise/shock)
    - sketchpad (stimulus)
    - inline_script (noise/shock)
    - keyboard_response
    - inline_script (noise/shock)
    

    Where the first inline_script determines whether there will be a shock this trial. I will assume you have already implemented this, using some probability of a shock occurring, like below (although the 0.2 is probably a variable in your case).

    import random
    
    # shocks occur in 20% of trials
    exp.shock_this_trial = random.random() < 0.2
    
    # shock has not occurred yet
    exp.shocked_this_trial = False
    

    Each further inline_script starts with the following snippet:

    # check if the current trial is a shock trial,
    # and no shock has occurred yet
    if exp.shock_this_trial and not exp.shocked_this_trial:
    
        # 25% chance of the shock occurring in this inline_script
        # (100% divided by the number of times this
        # inline_script is repeated in the trial)
        exp.shocked_this_trial = random.random() < 0.25
    
        # aversive stimulus
        if exp.shocked_this_trial:
    
            # SHOCK CODE HERE
    

    Of course, this is a bit of a crude way to do it. However, it's quick-and-dirty, and nicely random and thus very unpredictable (even for the experimenter!).

    Hope this gives you some inspiration!

  • edited 11:46AM

    Hey Edwin,

    That will do nicely, good idea! I'II will have to break down my trial inlines to make it work (I usually have the entire trial sequence scripted in a single inline), but I agree, by implementing it like you recommended definitely makes it quite unpredictable.

    Thanks a lot for your input,

    Daniel

  • edited January 2015

    No worries! Hope you can make it work!

    BTW: If you're already scripting all the way, I've implemented something similar in the past in Python (using PyGaze, but using PyGame or PsychoPy directly would also do the trick). The idea there was simple: the main Thread was used to display pictures, while one sub-Thread was used to play sounds and another to log keypresses (the onsets of which were compared afterwards). The point is that, if you are already going through the effort of coding everything in OpenSesame, you might try to code an experiment from scratch in Python with only a bit more effort.

    Of course, using OpenSesame is still quicker for more straightforward designs. But if you want to do things in parallel, Python provides excellent tools for multithreading (and even proper parallel processing, although the differences between multithreading and parallel processing usually don't matter a lot for experiments).

    Either way: good luck!

    Edwin

    PS: Marking this one as solved, but please don't hesitate to post here again (and mark the thread open) if further questions arise!

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