Howdy, Stranger!

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

Supported by

[Solved] Affect Misattribution Procedure

edited October 2021 in OpenSesame

I am trying to do the AMP on OpenSesame but I can’t seem to figure out how to randomly present the target stimuli for each prime.

I have 30 primes and 10 target stimuli but I’m not sure how to get the target stimuli to be randomly presented after each of the 30 primes. Need a little help with this thank you!

Comments

  • Hi @Ashleigh,

    Could you be a little more specific or upload a basic version of your task? Are you using an orthogonal design in which each target is to be presented with a fixed set of 3 primes with trials in a random order? Or are you trying to pair purely randomly (and in a different random arrangement for each subject) targets and primes? Are you presented 10 trials (10 targets) and want to select a prime at random? Selection with or without replacement? What have you tried so far?

    A clearer description of what you're trying to achieve would be great in order to try to help you.

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    Thanks for the reply! To explain more specifically, I am hoping to have

    • 4 blocks of 30 trials each
    • Within each block of 30 trials, there are 30 primes, 15 for each of 2 prime conditions
    • Within each block of 30 trails, there are 30 targets. The pairing of targets and primes to be completely random (i.e., each target does not need to be paired with each prime). Since the targets and trials are equal, each target should appear once.

    I am stuck with the third point above. Hope this description helps.

    Regards,

    Ashleigh

  • Hi @Ashleigh,

    Thanks for the clarification. I think I understand what you want to do now: you have 30 trials per block, and you want 30 targets to be presented in random order and randomly paired with primes.

    There may be several ways of achieving this. I'll suggesting one involving some coding. the coding could be done in Python or in Javascript. Here, I've used Javascript (if you're planning to run your experiment in a browser or online with OSWeb, you'd have to opt for the latter).

    Since you want a random pairing of the targets and primes, you can't put the details of both into a loop, because the pairing would then be fixed. So here's what I'm suggesting:

    In the loop, only specify the primes and leave targets blank. Store the list of targets in an array, shuffle the array, then pull data from the array using the trial counter as index.

    Here is some Javascript code that declares a shuffling function (which will work regardless of the length of your array), and then code that declares the array (where you can see I declared targets as target1, target2, ..., target 30).

    // defines function to shuffle the content of an array
    function shuffleArray(array) {
    let curId = array.length;
    // There remain elements to shuffle
    while (0 !== curId) {
    // Pick a remaining element
    let randId = Math.floor(Math.random() * curId);
    curId -= 1;
    // Swap it with the current element.
    let tmp = array[curId];
    array[curId] = array[randId];
    array[randId] = tmp;
    }
    return array;
    }
    // Usage of shuffle
    // arr contains the list of targets
    let arr = ["target1", "target2", "target3", "target4", "target5","target6", "target7", "target8", "target9", "target10","target11", "target12", "target13", "target14", "target15","target16", "target17", "target18", "target19", "target20","target21", "target22", "target23", "target24", "target25","target26", "target27", "target28", "target29", "target30"];
    arr = shuffleArray(arr);
    console.log("Shuffled order :"+arr);
    console.log ("arr[0]:"+arr[0]);
    // passing arr to vars.arr in order to be able to use it outside this inline_javascript object
    vars.arr=arr;
    // ressting trial number to 0
    vars.trial_counter=0;
    
    console.log ("vars.arr[0]:"+vars.arr[0]);
    

    This is to be executed in ahead of running the block of trials.

    Next, you'd simply have to retrieve the a target from the vars.arr array, using the trial number as index, so if the shuffled list of targets starts with target26, target2, target9,..., the task will show target26 in trial 1, target2 in trial 2, target 9 in trial 3 and so on.

    I attach the little task I put together here, so you can try it out:

    Now, beware that I only implemented one block. It's just to show you the method; you'll have to adapt it to your task. Also, for simplicity, I just used text stimuli for primes and targets. In your case, you'd have to adapt it to whatever you're using (pictures, for example).

    I included various console commands to help track what's going on. I recommend you do the same in your task as you adapt it to use the code above.

    Hope this helps. Good luck!

    Best,

    Fabrice.

    PS: when replying in the forum, it's better if you use user handles by typing "@" and the first letters of your correspondent's handle, then selecting from the list. That way, your correspond gets a notification about your message (otherwise, they won't see it unless they happened to revisit a conversation). So, for example, if you type "@F", you'll see this:

    _____________________________________________________________________________________

    If you found my reply helpful and wish to invite me to a coffee, you can do so here 😉: https://www.buymeacoffee.com/psyfab

    Buy Me A Coffee

  • Hi @Fab,

    This was really helpful, thank you!

    Just a follow up question, if I would like to use pictures as my targets, how should I do it in the javascript? Apologies as I am very unfamiliar with javascript.

    Regards,

    Ashleigh

  • FabFab
    edited August 2021

    Hi @Ashleigh,

    The Javascript code simply randomizes alphanumerical strings. It is not what defines whether your stimuli are text, picture, sounds etc.

    It is worth familiarizing yourself a little with the Javascript code to understand what each bit does (that way you'll find it easier to modify the code if needed or to debug possible problems). If you look carefully at the code, you'll see that all it does is to shuffle the order of the elements of the arr array, and later on to allocate each element of the shuffled array to the target variable (vars.target). From then on, the objects in the task can access the content of that variable using [target]. In a nutshell, the Javascript creates a randomized list of elements that are then inserted into the loop as each trial runs.

    So, all the Javascript code does is to randomize strings that you can replace with filenames or use as part of a filename if you prefer. The same way as the random selection randomizes the order of the trials in the loop:

    So, you can use these strings to refer to pictures in the same way as you would in the loop. Obviously, you'll have to refer to [target] and [prime] when you define the picture objects on the relevant sketchpads in your task. You can do that in two ways.

    Method 1: change the strings to "target1.jpg", "target2.jpg", etc., and "primeA1.jpg", "primeA2.jpg", etc.

    Step 1: edit the Javascript code to change the content of the arr array to add the ".jp" suffix to every element of the array:

    https://forum.cogsci.nl/uploads/243/IZP2WCW2IBIH.png There was an error displaying this embed.

    Step 2: in the loop, make sure to use the complete filenames:

    https://forum.cogsci.nl/uploads/216/53O5MNYDLI67.png There was an error displaying this embed.

    Using this method, the information you'll find in your output data will be the filenames (target1.jpg, primeA1.jpg, etc.).

    Method 2: don't change anything to the Javascript code but simply add the file suffix in the script of the sketchpads to tell OS where to get the filenames from:

    You'd have to do that for the sketchpad containing your prime and for the sketchpad containing your target. I'm assuming you're familiar with the sketchpad script and know how to insert pictures in sketchpads.

    Of course, with either method, make sure that all your pictures are loaded into OS's file pool.

    Good luck!

    Fabrice.


    _____________________________________________________________________________________

    If you found my reply helpful and wish to invite me to a coffee, you can do so here 😉: https://www.buymeacoffee.com/psyfab

    Buy Me A Coffee

  • Hi @Fab,

    That was really helpful, thanks so much!

    Regards,

    Ashleigh

  • Hi @Fab

    I did the same proccedure im my experiment.

    First of all, thank you for this response.

    Second, in my experiment the images are not pull from the pool. I followed every single step but when i run the experiment i get "target.jpg" text in the sketchpad and not the image.

    Do you have any idea how to solve it?


    Zohar.

  • Hi @zohar ,


    It sounds like you are drawing text rather than an image on top of your background. Instead of having a line such as this


    draw textline center=1 color=white font_bold=no font_family=serif font_italic=no font_size=32 html=yes show_if=always text="[target]" x=0 y=0 z_index=0
    

    in your OpenSesame script, you should have something like this:


    draw image center=1 file=[target] scale=1 show_if=always x=0 y=0 z_index=0
    


    Do you see the difference?


    Good luck!


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • YES!! It works graet.

    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