Howdy, Stranger!

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

Supported by

sampling a nested loop without replacements

Hi all,

I tried to be brief, and failed :#. Hopefully it's readable and someone would be able to help.
I will really appreciate it a lot!

I'm designing an artificial grammar learning (AGL) task in which participants see a sequence of 3-10 letters
and need to type them at the end.

The sequences are taken from a pool, and selected randomly for every participant.
For example, say that I have 120 sequences from every length of sequence (e.g., 120 sequences of 3 letters; 120 sequences of 4 letters, etc., and each participant see 20 different sequences of 3, 20 different sequences of 4, etc.).
The different length sequences should appear randomly (i.e., not first a sequence of 3 letters, and then a sequence of 4, etc.). It is important that a participant will not see the same sequence more than once.

Right now, I have a main loop (indicating what the length of the sequence will be),
and nested loops (a loop for every sequence length), that run if the condition for running it occur (more details in the attached file).

The nested loop breaks after one trial and going back to the main loop, and in the new trial the random sampling starts again, creating sampling with replacement that is problematic in this design.

Is there a way to sample without replacement? for example, deleting a line in the loop that was already executed?

Thanks for reading!
Looking forward to your responses,



  • Hi Tali,

    One option would be to set the inner loop's Break-if statement to always, and uncheck the Evaluate on first cycle option. That way the inner loop will only run for one cycle. Then you can check the Resume after break option so that the inner loop will pick up where it left off when it is called again by the outer loop. This will implement random sampling without replacement. Does that make sense?

    I'm not entirely sure whether nested loops are even necessary here, or whether you'd also be able to implement this through clever use of advanced loop operations. (Maybe, maybe not—it's not obvious to me.)


    Buy Me A Coffee

  • Hi Sebastiaan

    Thanks for your response!
    You are right, I didn't need any nested.
    I designed it now with advanced loop options and I checked the "resume after break" option.
    Now for some reason it crushes in the middle of the experiment (Every time),
    and the sampling is still with replacement.

    Do you have any idea why?

    Thanks a lot again,

  • Do you have any idea why?

    No because you haven't provided any error message!

    Buy Me A Coffee

  • :)
    There was no error message, just that the experiment stopped, but I attached the file


  • It will always say something when the experiment ends, even if you don't see a detailed stack trace. For example, it may say that Python crashed, or that the experiment ended successfully.

    Buy Me A Coffee

  • ok that's weird. Today it worked without crashing.
    I'm attaching the file if anyone will want to use it as a template for an AGL task.


  • Sorry to do it again, but it crashed without any changes.
    It ran twice without any problem but crashed in the third time.
    That's the message I got:

  • I was afraid of that. This means that the Python interpreter crashed. That's always a bug somewhere in the underlying libraries, not a problem in your experiment, nor in OpenSesame (well, the underlying libraries are part of OpenSesame, in a sense, but not in the OpenSesame code).

    Can you find some system to the crashes? I.e. does it always crash at the same moment of the experiment? And do other experiments using the legacy backend crash as well on this computer?

    Buy Me A Coffee

  • I ran it on two different computers, one running windows 7 and one running windows 10.
    When it crashed, it did so after different number of trials. So far I didn't have any other problem
    with other experiments...

  • it does happen after I run the experiment for 3 or 4 times one after another

  • it does happen after I run the experiment for 3 or 4 times one after another

    Ok, so then there's at least one obvious workaround: Close and restart OpenSesame after running an experiment.

    This sounds like there are carry-over effects from one experiment to the next, which in turn suggests that the inprocess runner is used (which doesn't start a new process for each experiment). Is that correct? If you go to Menu → Tools → Preferences, can you change the Runner to Multiprocess, or is this already the case?

    Buy Me A Coffee

  • Hi Sebastiaan
    It's already on Multiprocess

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