Howdy, Stranger!

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

Supported by

[solved] Experiment help

edited October 2014 in OpenSesame

I'm designing an RSVP task. There will be a Target-Distractor ensemble that will move throughout the stream (early versus late). There are 25 target-distractor pairs. I'm having difficulty programming the experiment so that calling a distractor for say image 3 of the stream will subsequently call its paired target at position 5 in the stream. The distractors are presented above and below the stream then the target is presented centrally, always at lag 2. I need to have it so the distractors will be randomly assigned to the top or bottom position while also still being paired with the target. I would appreciate any help with this!

Comments

  • edited 9:00PM

    Hello,

    1) Pairing distractors with targets

    How about you define a dictionary with the distractors as keys and the targets as values in the beginning of your experiment? This makes it easy to retrieve the target that belongs to a certain distractor, even if distractors are randomized. You can do that in an inline script.

    2) Randomization and position of distractor-targer ensemble

    Correct me if I am wrong, but as far as I understand your experiment has two independent variables: position in stream (early vs. late) and position on screen (above vs. below the center). If so, you can use the variable wizard in the loop element, to fully cross these two conditions. See this tutorial, if you need details on how to do that.

    3) Make sure that a target follows at lag 2 after distractor

    To make this work, it is helpful to also have the position in the stream of both distractor and target in the variable assistant. I don't know whether you want your independent variable "position in stream" from above to be dichotomous (early vs. late), or continuous (1,2,3,..., last). If you have already latter, you can simply add another variable ("target position") and assign the correct value to it (always, 2 more than the distractors obviously).
    In the other case, it is not much different, because I guess you have some kind of criterion which position is considered to be early and which late. According to these scheme, you can create just another variable for the exact distractor position and make sure that the table in the variable assistantis coherent.

    Was this helpful?

    Eduard

    Buy Me A Coffee

  • edited 9:00PM

    Essentially the stream is 14 images long. I want Target positions at 5, 6 and 7 (corresponding Distractor pair at 3, 4 and 5) for the "early" condition and Target at 9, 10 and 11 (corresponding Distractor pair at 7, 8 and 9) for the "late" condition. I tried creating a variable for "target_position_early" and "target_position_late" using a randint(5,7) for early and randint(9,11) for late.

    My variable list has 25 pairs of Targets and Distractors which is crossed with Early versus Late for another variable "Stream_Position". So I have 50 trials (25 Early, 25 Late) where each line of the variable list contains each pair. I also have the filler images as variables. Each column is a different filler image. Together, each row of my variable list gives me a full RSVP trial including the target and distractor pair. I'm sure this isn't the most efficient coding (I am not terribly familiar with coding and this is a tweak on a previous student's design).

    Here is what I coded (isn't working).

    Stream_Position = "[Stream_Position]"
    exp.set('Stream_Position', "[Stream_Position]")

    if Stream_Position == "Early":
    exp.set('Target_Position_Early', randint(5,7))

    elif Stream_Position == "Late":
    exp.set('Target_Position_Late', randint(9,11))

    Here is my code for the trial sequence
    The numbers represent position in the RSVP stream (1 through 14)

    Filler is just a random filler image

    Distractor shows a filler image in the center with two distracting images above and below the center stream. One of the Distractors is a part of the Target-Distractor pair, the other is a random filler image.

    Target is just the corresponding target of the target-distractor pair.

    run 1_filler "always"
    run 2_filler "always"
    run 3_filler "[Target_Position_Early]!=5"
    run 3_distractor "[Target_Position_Early]=5"
    run 4_filler "[Target_Position_Early]!=6"
    run 4_distractor "[Target_Position_Early]=6"
    run 5_filler "[Target_Position_Early]!=7"
    run 5_distractor "[Target_Position_Early]=7"
    run 5_target "[Target_Position_Early]=5"
    run 6_filler "[Target_Position_Early]!=6"
    run 6_target "[Target_Position_Early]=6"
    run 7_filler "[Target_Position_Early]!=7 and [Target_Position_Late]!=9"
    run 7_distractor "[Target_Position_Late]=9"
    run 7_target "[Target_Position_Early]=7"
    run 8_filler "[Target_Position_Late]!=10"
    run 8_distractor "[Target_Position_Late]=10"
    run 9_filler "[Target_Position_Late]!=9"
    run 9_target "[Target_Position_Late]=9"
    run 10_filler "[Target_Position_Late]!=10"
    run 10_target "[Target_Position_Late]=10"
    run 11_filler "[Target_Position_Late]!=11"
    run 11_target "[Target_Position_Late]=11"
    run 12_filler "always"
    run 13_filler "always"
    run 14_filler "always"

    I attached an image of the variable list

    Would you like to see my program as well? You seem very knowledgeable and seem like you could help me out. Most of it works, I just am having troubles with the Late versus Early aspect.

  • edited 9:00PM

    image

  • edited 9:00PM

    image

  • edited 9:00PM

    Sorry, the code I pasted into the comment got formatted differently, the image above shows it in Open Sesame.

  • edited 9:00PM

    I think I have everything set up to how I want it. I think all I need is a couple lines of code that randomly assign a number between 5 and 7 for Early and 9 and 11 for Late. I have a variable "Stream_Position" that is either Early or Late (1/2 and 1/2).

    I think I need code that translate the following "English" into "Python"

    "When Stream_Position is equal to 'Early', then assign a random number between 5 and 7 to 'Target_Position_Early'"

    "When Stream_Position is equal to 'Late', then assign a random number between 9 and 11 to 'Target_Position_Late'"

    During the trial sequence, it calls the variables "Target_Position_Early/Late" in order to present the target or distractor image display (which I already have coded and it works.

    The way I have it coded now does both on the same trial, so I have trials where a target screen is presented at position 5 and then again at 10.

    target_position_early = randint(5,7)
    exp.set('Target_Position_Early', target_position_early)

    target_position_late = randint(9,11)
    exp.set('Target_Position_Late', target_position_late)

    When I tried to make this into an "if" statement, it doesn't work

    Stream_Position = "[Stream_Position]"
    exp.set('Stream_Position', "[Stream_Position]")

    if Stream_Position == "Early":
    exp.set('Target_Position_Early', randint(5,7))

    elif Stream_Position == "Late":
    exp.set('Target_Position_Late', randint(9,11))

    If you could help me fix this, I think I will be good! I would be unbelievably grateful as well. I've spent the last 3 days trying to figure this out for at least 20 hours total now.

  • edited 9:00PM

    Hi,

    The reason why your code doesn't work is that the experiment_set function is not applicable if you want to set complex data types. That is, you can only set "simple" data, like integers, floats, ... with it. When you're trying to set something more complex like an object, it will simply converted to a string. Therefore, your randint(5,7) is not evaluated, see here.
    What you can do, is this:

    position = randint(5,7)
    exp.set("position", position)
    

    This should do the trick. However, here some more suggestions:

    1 ) As far as I see, there it is not necessary that you keep the target position for early and late trials separate. The variable "stream position" should be enough to log this information. So, you could adjust your script like this:

    import random
    early_min = 5
    early_max = 7
    late_min = 9
    late_max = 11
    
    if stream_position == "early":
        target_position = randint(early_min, early_max)
    elif stream_position == "late":
        target_position = randint(late_min, late_max)
    
    exp.set("target_position", target_position)
    

    2) From your posts, I don't know where you define the target positions. I assume you're using an inline_script. In this case, please keep in mind to put the code in the prepare phase, otherwise the experiment won't work. Also, I want to point out that you don't have much control over the exact target position with the current design. In principal, it is possible that you always pick the same position in the early condition and another one for the late one, which of course undermines the idea of randomization.
    If you want to obtain a better counterbalanced sequence, you can create the randomized target positions before you enter the trial_sequence, like so:


    import random early_positions = [5,6,7] * 9 late_positions = [9,10,11] * 9 random.shuffle(early_positions) random.shuffle(late_positions)

    and pop an item from respective list in the trial_sequence :

    if stream_position == "early":
        target_position = early_positions.pop()
    elif stream_position == "late":
        target_position = late_positions.pop()
    

    I hope this helped.

    Buy Me A Coffee

  • edited 9:00PM

    My good sir, you are a saint!! Words cannot express my gratitude. I have spent this whole semester working on this project, hours upon hours struggling with this, asking everyone I could think of for help, with no results. Your solution works perfectly!! Thank you so much!!

  • edited 9:00PM

    No worries. That's what this forum is there for.

    Good luck with your experiment.

    Buy Me A Coffee

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