Howdy, Stranger!

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

Supported by

Nested loops

Hi there,

Just a quick question about nested loops in OpenSesame. We are currently creating an experiment divided in two parts: the first part is considered as an induction phase where we want to display a prime picture before each trial (same picture for every trials randomly selected from a list of 350 pictures). Then, we have the actual experiment (in a different loop) where participants can either have the same picture as in the induction phase or a different one for each trial.
For now, I combined two loops: the first loop consists of the actual trial list and the second loop consists of the pictures list (350) and by changing the "set repeat" to 0.003 I can randomly select a different prime picture for each trial.

So I can easily program the experiment so that a different picture is selected for each trial but I'm struggling to randomly select one picture that will be used both for the induction and test phases. Any hints ?

Many thanks in advance for the help !

Best,

CL

Comments

  • Ok, let me clarify the paradigm first, because it's kind of complicated:

    • You have a priming experiment, in which a picture (the prime) is followed by a target stimulus.
    • During the induction phase, the prime is always the same picture. This picture is randomly selected for each participant from a pool of 350 pictures.
    • During the testing phase, the prime is:
      • Sometimes (50%?) the same picture as used during the induction phase; and
      • Sometimes (50%?) another picture, randomly drawn from the pool of 349 remaining pictures.

    Is that correct?

    Cheers,
    Sebastiaan

  • Yes, this is correct. Except that this is a between subject manipulation (same or different primes for the testing phase; 2 experiment files).

    For half the participants, the picture chosen for the testing phase is the same as the induction phase (2 different loops).

    For the other half of the participants, the picture for the induction phase is always the same (randomly selected) and for the testing phase, it's a new one for each trial (randomly selected)

    Does this make things clearer ?

    Many thanks in advance,

    CL.

  • Hi,

    So I can easily program the experiment so that a different picture is selected for each trial but I'm struggling to randomly select one picture that will be used both for the induction and test phases. Any hints

    Right—so the only thing you're struggling with is randomly selecting an image during one loop (induction phase), and then keeping that same image for the next loop (testing phase)? If that's it, then it's really simple: Don't redefine the prime during the second loop!

    Once you've define a variable (prime, say), it will persist until you explicitly delete it (which is rare) or give it another value. So if you don't add a prime column to the second loop, then prime will keep having the value that it had at the end of the first loop. Does that make sense?

    Cheers,
    Sebastiaan

  • Hi there,

    Thanks for the answer ! I'm struggling to select the same image for the whole loop and then sticking to it for the second one. Here is how I select a random prime for each trial:

    I have three levels in my experiment (3 levels for the induction phase and 3 levels for the testing phase)

    _ TrialLoop (with the list of every trials & variables)
    - FaceLoop (with the list of 350 faces, with a repetition set at 0.003 to get only one new face per trial in the TrialList)
    - Trial sequence: defining the trial structure (fixation, prime, response)

    I'm not sure how to get the "Prime" variable to be the same image for all trials of the induction phase (I didn't work when I manipulated the 'set repeat' parameter). Once I'll manage to do that, I guess I understand what you mean by "not redifining the prime for the second loop". But, as I'm stucked at the first step, this is hard to test :)

    So sorry, I'm sure this is an obvious manipulation but I cannot make it work !

    Thanks for the help

  • Could you attach the experiment file? That will make it a bit easier to talk about.

  • Hi there,

    Sorry for the delay ! Here is the file. Some things might be a bit messy, any hints for improvement are always welcome :)

    Thanks for your help !

  • Hi Cletess,

    I see two solutions for your problem.

    1. Don't select the random image from the loop_table but from a list in an inline_script. Do it once before you enter the prime phase.
    import random
    no_faces = 100 # not sure how many different faces you have
    faces = []
    for i in range(no_faces):
        faces.append('face_'+str(i)+'.JPG')
    
    selected_face = random.choice(faces)
    
    1. First thing you do in the loop is creating a new image variable that you will use henceforth. In every other loop, you skip over this initial defining of that variable.
    if trial_no == 1:
        real_image = selected_image
    # after the first iteration the variable real_image won't change anymore
    # note, trial_no is not a default variable name in Opensesame, you'll have to compute it for your experiment
    

    I prefer the first one, but both should do the trick.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Thanks a lot for this ! I'll give it a go and come back at you !

  • Worked like a charm ! Thank you !

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