Howdy, Stranger!

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

Supported by

partial randomization of a loop

Hello

I need to design an experiment with 5 color-word Stroop trials in a row (1 congruent, 4 incongruent in a random order), followed by a forced choice math question (say a or b).

A block is 20 repeats of this process, with 10 math questions with response 'a' and 10 with response 'b' that should also be in a random order.

is there a way to do it in the GUI?

if not, a link to the relevant information about how to code it would be appreciated.

Thank you!

Tali.

Comments

  • Hi Tali,

    if the math questions and the stroop trials should be randomized independently from each other, you can't do this in the GUI, but have to program it directly. It isn't that complicated though. Something simple like this will do:

    import random
    
    word_list = ['red', 'green', 'blue']
    
    cong_color_dict = {'red':(255, 0 ,0),
                      'green':(0, 255, 0),
                      'blue':(0, 0, 255)}
    
    incong_color_dict = {'red':[(0, 255, 0), (0, 0 ,255)],
                        'green':[(255, 0, 0), (0, 0 ,255)],
                        'blue':[(0, 255, 0), (255, 0 ,0)]}
    
    
    # make math questions (no idea what you have in mind)
    questions_temp = 20 * ["2 + 10"]
    correct_answers_temp = 20 * [12]
    incorrect_answers_temp = 20 * [11]
    questions_dict = [{'question':q, 'correct_answer':c, 'incorrect_answer':i} for q, c, i in zip(questions_temp, correct_answers_temp, incorrect_answers_temp)]
    answer_array = 10 * ['a', 'b']
    random.shuffle(questions_dict)
    random.shuffle(answer_array)
    
    # containers for the info
    all_trials = dict(stroop_words=[], stroop_colors=[], questions=[],
                     options_a=[], options_b=[], question_correct_resp=[])
    
    for rep in range(20):
       # add stroop trials
       words = []
       for trial in range(5):
           word = random.choice(word_list)
           # every 5th one is congruent the other four are incongruent
           if trial == 0:
               words.append((word, cong_color_dict[word]))
           else:
               words.append((word, random.choice(incong_color_dict[word])))
    
       # randomize the order of the five trials
       random.shuffle(words)
       all_trials['stroop_words'] += [word[0] for word in words]
       all_trials['stroop_colors'] += [word[1] for word in words]
    
       # add forced choice
       all_trials['questions'].append(questions_dict[rep]['question'])
       all_trials['question_correct_resp'].append(questions_dict[rep]['correct_answer'])
       if answer_array[rep] == 'a':
           all_trials['options_a'].append(questions_dict[rep]['correct_answer'])
           all_trials['options_b'].append(questions_dict[rep]['incorrect_answer'])
       elif answer_array[rep] == 'b':
           all_trials['options_a'].append(questions_dict[rep]['incorrect_answer'])
           all_trials['options_b'].append(questions_dict[rep]['correct_answer'])
    

    Now you can have a loop over 120 trials and in the in trial sequence pop the items you need from the prepared list

    Hope this helps a bit,

    Eduard

    Buy Me A Coffee

  • edited May 2023

    Thank you Eduard!

    Is it possible to use pictures instead of text for the stimuli?

    The Stroop words are in Hebrew and the math problems requires pictures.

    I'm just not sure how to connect the file pool to the script.

    If there is a manual that explain it, it would also help


    Thanks again! it really helps!

    Tali

  • Lucky you, there is a manual that explains it: https://osdoc.cogsci.nl/3.3/manual/python/pool/

    Whether text or images, it's all the same for this problem here.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Thank you! I actually found a way to do it using only GUI using several levels of nested loops.

    It's messy and not as elegant, but when it comes to coding, I'm really challenged 😑.

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