Howdy, Stranger!

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

Supported by

Randomise, but force 1st item per talker to be a filler

Hello,

OpenSesame is a such a cool program! I'm currently trying to set up an experiment in which the participants are confronted with three different talkers. Each talker utters a variety of sentences, among which some fillers. I'd like for the order of presentation to be essentially random but with the constraint that the first sentence heard per talker is a filler.

Here's a slimmed down stimulus list.

SentenceID Talker SentenceType
S1 A filler
S2 A filler
S3 B filler
S4 B filler
S5 C filler
S6 C filler
S7 A target
S8 A target
S9 B target
S10 B target
S11 C target
S12 C target

Permissible orders include:

  • S1, S7, S6, S8, S3 etc.
  • S4, S3, S9, S1, S11 etc.
  • S1, S3, S6, etc.

There's no need for the first three items to be fillers by different talkers, just for each talker's first item to be a filler.

Non-permissible orders include:

  • S7 etc. (Talker A is introduced with a target rather than with a filler.)
  • S1, S8, S9 (Talker B is introduced with a target rather than with a filler.)

Any suggestions? Thanks for your time and effort!
Jan

Comments

  • edited February 2018

    Hello,

    I haven't fully implemented the following solution in OpenSesame yet, but this Python code generates lists that satisfy the constraint (see OP):

    # This script generates a pseudorandom order of stimuli.
    
    # We need the shuffle function from the random library.
    from random import shuffle
    
    item_list =     [("S1", "A", "filler"),
                     ("S2", "A", "filler"),
                     ("S3", "B", "filler"),
                     ("S4", "B", "filler"),
                     ("S5", "C", "filler"),
                     ("S6", "C", "filler"),
                     ("S7", "A", "target"),
                     ("S8", "A", "target"),
                     ("S9", "B", "target"),
                     ("S10", "B", "target"),
                     ("S11", "C", "target"),
                     ("S12", "C", "target")]
    
    # Restrictions on randomisation:
    # - The first stimulus for each talker (second column) needs to be a filler.
    
    # Pick the first stimulus. This needs to be a filler.
    items_notpicked = item_list
    
    # Only retain the stimuli that may be picked, viz., filler items
    under_consideration = [row for row in items_notpicked if 'filler' in row[2]]
    # Shuffle these and take the first item
    shuffle(under_consideration)
    items_picked = [under_consideration[0]]
    
    # Remove the items picked from the available items, i.e., only
    # retain a row if it doesn't contain the sentenceID.
    sentences_selected = [i[0] for i in items_picked]
    talkers_selected = [i[1] for i in items_picked]
    items_notpicked = [i for i in items_notpicked if not i[0] in sentences_selected]
    
    for items in range(len(items_notpicked)):
    # only consider filler items or sentences from talkers already selected
        under_consideration = [row for row in items_notpicked if ('filler' in row[2]) or (row[1] in talkers_selected)]
    # shuffle, take the first one, append to item list
        shuffle(under_consideration)
        items_picked += [under_consideration[0]]
    # update sentence and talker lists
        sentences_selected = [i[0] for i in items_picked]
        talkers_selected = [i[1] for i in items_picked]
        items_notpicked = [i for i in items_notpicked if not i[0] in sentences_selected]
    

    A couple of runs produced lists such as these:

    [('S5', 'C', 'filler'),
     ('S3', 'B', 'filler'),
     ('S9', 'B', 'target'),
     ('S11', 'C', 'target'),
     ('S4', 'B', 'filler'),
     ('S6', 'C', 'filler'),
     ('S12', 'C', 'target'),
     ('S10', 'B', 'target'),
     ('S1', 'A', 'filler'),
     ('S8', 'A', 'target'),
     ('S7', 'A', 'target'),
     ('S2', 'A', 'filler')]
    
    [('S5', 'C', 'filler'),
     ('S2', 'A', 'filler'),
     ('S4', 'B', 'filler'),
     ('S1', 'A', 'filler'),
     ('S12', 'C', 'target'),
     ('S9', 'B', 'target'),
     ('S8', 'A', 'target'),
     ('S11', 'C', 'target'),
     ('S7', 'A', 'target'),
     ('S10', 'B', 'target'),
     ('S3', 'B', 'filler'),
     ('S6', 'C', 'filler')]
    
    [('S6', 'C', 'filler'),
     ('S12', 'C', 'target'),
     ('S4', 'B', 'filler'),
     ('S5', 'C', 'filler'),
     ('S9', 'B', 'target'),
     ('S11', 'C', 'target'),
     ('S2', 'A', 'filler'),
     ('S3', 'B', 'filler'),
     ('S1', 'A', 'filler'),
     ('S10', 'B', 'target'),
     ('S8', 'A', 'target'),
     ('S7', 'A', 'target')]
    
  • Quick follow-up:At the end of the inline script, I've now added

    global sentences
    items_picked.reverse() # the "pop" method used later works from the back to the front,so just reverse the list here
    sentences = [i[0] for i in items_picked]
    global talkers
    talkers = [i[1] for i in items_picked]
    

    Then I used an inline script before the trial presentation with the following content:

    global sentences
    current_sentence = sentences.pop()
    global talkers
    current_talker = talkers.pop()
    
    exp.set("my_sentence", current_sentence)
    exp.set("my_talker", current_talker)
    

    my_sentence and my_talker can then be used in the trial's sketchpad.

    This seems to do the trick. Hopefully this is useful to other users. Thanks again for developing OpenSesame!

  • Hi Jan,

    nice that you sorted things out yourself. I haven't looked at your code in detail, but just a few small remarks.

    1) It shouldn't be necessary to declare your variables as globals. All the inline_scripts share a common workspace

    2) In a comment you say: # the "pop" method used later works from the back to the front,so just reverse the list here. Actually, you can specify which item should be popped from a list. The default value is -1 I believe, but if you pass 0 it will pop from the beginning.

    3) exp.set("my_sentence", current_sentence) can be replaces with var.my_sentence = current_sentence

    Hope this is a little useful to you.

    Good luck,

    Eduard

    Buy Me A Coffee

  • Very much so, 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