Howdy, Stranger!

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

Supported by

Sequential Timing for Sketchpad

Hello, I'm new to Opensesame so I apologize if this is a simple question:

I'm trying to set up an experiment with varying sketchpad timings, but I can't figure out how to set up the variables. Here's what it should look like:

1st block of trials: sketchpad shows for 60s ->5s ->5s...etc

2nd block of trials: sketchpad shows for 20s -> 5s -> 5s and so forth

At the same time, I also have other variables that I would like to present on the sketchpad (e.g. the placement of an image) in a randomized manner.

Is there any way to do this? Any help would be much appreciated!

Comments

  • Hi @opensesame,

    If what you'd like to do is to be able to set the duration of a sketchpad to vary it from trial to trial, the simplest solution is to include a column in your loop table that will contain the duration of your sketchpad and then call upon that variable when setting up your sketchpad.

    (I'm assuming that you're just referring to displaying sketchpads only, not displaying sketchpads and collecting responses. If you're after collecting a response to the sketchpad, you'd need a different solution).

    Set up the loop to include the duration as a variable. You can call this variable anything. Here I call it duration.

    Then set up the duration of your sketchpad to retrieve the value from that variable:

    You can download my example here (note that it is very basic; e.g., it does not contain a logger or take responses; the purpose is just to show you how to vary the duration of a sketchpad):

    Good luck!

    Fabrice.

    Buy Me A Coffee

  • edited September 2021

    Hello @Fab

    Thank you very much! It was very helpful. However, I have now run into a different issue:

    I have variables in the loop that I would like to present randomly, however, I intend for the duration of the sketchpad to follow a sequential order. Is there any way to do this? Perhaps an image would explain it better:


    The variable stimulus is ties to correct_response, and I would like them to be presented randomly

    I have tried to use the shuffle cue but cannot figure out how to get 2 columns to vary together

    Thank you!

  • Hi @opensesame,

    In order to achieve what you're after, you'll have to use some code (Python or Javascript if you're running your experiment in OS, and Javascript if you're aiming to run it with OSWeb).

    The general idea is to declare an array where the elements to be randomized are stored, shuffle it (if need be applying some conditions), and then output them to the loop as the task runs.

    Have a look at these examples to see how this works: https://forum.cogsci.nl/discussion/comment/23977#Comment_23977https://forum.cogsci.nl/discussion/comment/24005#Comment_24005https://forum.cogsci.nl/discussion/comment/23974#Comment_23974

    You'd also have to set the order property of the loop table to "sequential" so that duration of the sketchpad follows the order appearing in the table (the rest of the columns will be randomized using the code).

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab

    Thank you very much! Will try it out.

  • Hi @opensesame,

    Here's an implementation of the solution I posted here: https://forum.cogsci.nl/discussion/comment/23974#Comment_23974

    I'm using Javascript code to (1) create an array containing the list of possible stimuli, (2) shuffle it, and (3) retrieve an element of the shuffled array to present it in the current trial.

    Here's the Javascript code used to create a function that shuffles the elements of an array (function shuffleArray(array)), create an array containing five stimuli (A, B, C, D, E) (let arr = ["A", "B", "C", "D", "E"];) and shuffles it (arr = shuffleArray(arr);). I also use code to ouput the shuffled array to the console, for monitoring.

    // 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 = ["A", "B", "C", "D", "E"];
    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]);
    

    With this method, note that the stimulus variable in the loop no longer needs to contain any information (the order method is set to sequential to make sure that the duration ispresented in the order specified in the loop table)...

    ... for it will be populated on the fly using the code contained in the retrieves_trial_info:

    // increment trial counter
    vars.trial_counter=vars.trial_counter+1
    
    // retrieves stimulus from vars.arr based on inblock trial counter -1 (because array goes from 0 to the array's length)
    vars.stimulus=vars.arr[vars.trial_counter-1]
    console.log("Trial number: "+vars.trial_counter)
    console.log("Duration: "+vars.duration+", stimulus:"+vars.stimulus)
    

    The method could be applied to other variables if you need to randomize several variables independently.

    Good luck,

    Fabrice.

    Modified example:

    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