Howdy, Stranger!

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

Supported by

[solved] nested A.B.B.A structure

edited February 2014 in OpenSesame

I have an experiment with two task (A,B)
in every task I have 120 unique trails (every one is different from the others)
I already have two lists with 120 rows inside.
in my experiment I want to run 60 trails from task A, 120 trails from task B (two 60 trail blocks) and than again 60
from task A.
2 important point:

  1. I want counter balance the tasks between subj (ABBA, BAAB)
  2. I want the exp to "remember" which trail I used and to run every trail and all off the trails once

how can I do that?


  • edited 6:55PM

    Hi Dror,

    I want the exp to "remember" which trail I used and to run every trail and all off the trails once

    This is an interesting question. What I would do first is add a column with a unique identifier for each trial. For example, a variable named trialid that identifies the block (A or B) and the trial number (instead of digit you would have your own conditions, of course):


    The next step would be to keep track of which trial is presented, by adding the trialid to a list at the end of each trial_sequence. You can do this with a simple inline_script (in the run phase):

    # At the end of each trial (run phase)

    Of course, you also need to initialize self.experiment.trials_done at the start of the experiment, again with a simple inline_script:

    # At the start of the experiment (prepare phase)
    self.experiment.trials_done = []

    Now you can use a run-if statement in your trial_sequence to skip all trials that have already been presented, by adding the following run-if statement to all items the trial_sequence". (Note that this a Python-style run-if statement).

    =self.get('trialid') not in self.experiment.trials_done

    Now we're getting somewhere!

    Of course, the first time that the block_loop is executed, we want to present only half the trials (60 of 120 in your case), so we set 'repeat' to 0.5. However, the second time that the block_loop is executed we want to present all trials, and use the run-if statement described above to skip the trials that were already presented (so effectively presenting the other half of the trials). We can do this by changing the repeat setting of the block_loop programmatically, after the block_loop has been executed for the first time:

    # At the end of the the block_sequence (run phase)
    exp.items['block_loop'].repeat = 1

    This is basically it. Now you have a block_loop that runs 50% of the trials on the first execution, and the other 50% on the second execution! It may seem like a lot to take in, but if you first implement the steps above in a simple dummy experiment, you will see the logic of it.

    I want counter balance the tasks between subj (ABBA, BAAB)

    For detailed information about counterbalancing, see this page:


  • edited 6:55PM

    I find your solution very flexible and much simpler then what I used
    thanx - I will use it!
    but one thing I did not understood, how do you control which block type a\b will be presented? are they in a same list or different one?

  • edited 6:55PM

    Hi Dror,

    I would treat blocks A and B as different block loops (block_loop_A and block_loop_B), so your experiment would go like this for some participants:


    And like this for others:


    So you basically perform the trick I described above separately for block_loop_A and block_loop_B.


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 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