Shared Scripts, Data, Stimuli, Files, and Demos

Perceptual style measure Run Experiment

Perceptual style measure

Marina pc

No comments yet
 




Comments

No comments yet

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

 
// This script will display all the trials for the dispositional measure of local/global style

//Capture PROLIFIC_PID from URL
var obj = util.getURLParameters();
  log(obj.PROLIFIC_PID,"PROLIFIC_PID");

  delete obj.a; //Delete extra parameter 'a=1' that we have to avoid errors in Psytoolkit

// Define needed functions 
function getKeyName(key) {
  for (var k in keys) {
    if (key === keys[k]) {
      return k;
    }
  }
}

function redirect_2(url,url_parameters_object)
{
    var s = url,
        p = url_parameters_object ? $.param(url_parameters_object) : "";
    
    s = p ? s + "&" + p : s;
    
    closesession();         // make sure all data has been saved to server
    window.location = s;
}


//main.setfontsize(70)

//input("Enter your Prolific ID","Prolific_PID");

//var obj=response;

// Present instructions
text(
  " Welcome to the next step of the study! 

" + "This part should not take longer than 5 minutes.

" + "Now you will see three images: a standard shape on " + "the top, and two exemplars in the bottom

" + "Click next to see an example and more instructions", 50); var buttonBlockSize = [8, 5]; var buttonLocationHeight = 80; //create next button var buttonOK = main .addblock( "center", buttonLocationHeight, buttonBlockSize[0], buttonBlockSize[1] ) .button("Next", "nextbutton", "nextbuttoninput", "ques1buttonid") .style("background", "lightgrey", "#ques1buttonid") .style("border-radius", "5%", "#ques1buttonid") .style("font-size", "50%", "#ques1buttonid") .align("center", "#ques1buttonid"); await (1000); // delay for clicking to make sure they don't just click through buttonOK.await("click"); main.removeblock(buttonOK); clear(); // Screen 2. More instructions var top_instr = main.addblock("center", 5, 100, 20); var center_instr = main.addblock("center", 25, 100, 56.25); center_instr.preload("instructions.jpg"); image.await("preloading_completed"); top_instr.text( " For each trial, press the left or right arrow to select which one of the two exemplar shapes (the one on the left or the one on the right) BEST corresponds to the standard shape on the top. Please respond as quickly as possible.", 50 ); center_instr.showimage("instructions.jpg"); // Create variables for all the images var test_0 = [ "t1.0.jpg", "t2.0.jpg", "t3.0.jpg", "t4.0.jpg", "t5.0.jpg", "t6.0.jpg", "t7.0.jpg", "t8.0.jpg", ], test_1 = [ "t1.1.jpg", "t2.1.jpg", "t3.1.jpg", "t4.1.jpg", "t5.1.jpg", "t6.1.jpg", "t7.1.jpg", "t8.1.jpg", ], test_2 = [ "t1.2.jpg", "t2.2.jpg", "t3.2.jpg", "t4.2.jpg", "t5.2.jpg", "t6.2.jpg", "t7.2.jpg", "t8.2.jpg", ], fill_0 = [ "f1.0.jpg", "f2.0.jpg", "f3.0.jpg", "f4.0.jpg", "f5.0.jpg", "f6.0.jpg", "f7.0.jpg", "f8.0.jpg", "f9.0.jpg", "f10.0.jpg", "f11.0.jpg", "f12.0.jpg", "f13.0.jpg", "f14.0.jpg", "f15.0.jpg", "f16.0.jpg", ], fill_1 = [ "f1.1.jpg", "f2.1.jpg", "f3.1.jpg", "f4.1.jpg", "f5.1.jpg", "f6.1.jpg", "f7.1.jpg", "f8.1.jpg", "f9.1.jpg", "f10.1.jpg", "f11.1.jpg", "f12.1.jpg", "f13.1.jpg", "f14.1.jpg", "f15.1.jpg", "f16.1.jpg", ], fill_2 = [ "f1.2.jpg", "f2.2.jpg", "f3.2.jpg", "f4.2.jpg", "f5.2.jpg", "f6.2.jpg", "f7.2.jpg", "f8.2.jpg", "f9.2.jpg", "f10.2.jpg", "f11.2.jpg", "f12.2.jpg", "f13.2.jpg", "f14.2.jpg", "f15.2.jpg", "f16.2.jpg", ], stimuli_0 = []; //Shuffle everything once: but we don't want to have different orders for different participants. //stimuli_0 = stimuli_0.concat(test_0, fill_0); // Combine two arrays into one new one //stimuli_0 = shuffle(stimuli_0); //Here we shuffle what will determine the order of the trials (conditions) for each participant. //Resulting order when shuffling once. We'll use this in our experiment. stimuli_0 = [ 't2.0.jpg', 'f10.0.jpg', 'f7.0.jpg', 'f4.0.jpg', 'f6.0.jpg', 'f8.0.jpg', 'f14.0.jpg', 'f11.0.jpg', 'f9.0.jpg', 't6.0.jpg', 't4.0.jpg', 't1.0.jpg', 'f3.0.jpg', 'f16.0.jpg', 't3.0.jpg', 'f15.0.jpg', 'f1.0.jpg', 't5.0.jpg', 'f13.0.jpg', 't8.0.jpg', 'f2.0.jpg', 't7.0.jpg', 'f12.0.jpg', 'f5.0.jpg' ]; // Based on this, the other two stimuli (left and right) will be displayed. // Create left, right and center blocks where stimuli will be presented var left_screen = main.addblock(-20, 50, 70, 39.375), right_screen = main.addblock(50, 50, 70, 39.375), center_screen = main.addblock("center", 15, 70, 39.375); // Preload all images in which the file includes the numbers from 1 to (but not including) x right_screen.preload_range("f{0}.1.jpg", 1, 17); right_screen.preload_range("f{0}.2.jpg", 1, 17); right_screen.preload_range("t{0}.1.jpg", 1, 9); right_screen.preload_range("t{0}.2.jpg", 1, 9); left_screen.preload_range("f{0}.1.jpg", 1, 17); left_screen.preload_range("f{0}.2.jpg", 1, 17); left_screen.preload_range("t{0}.1.jpg", 1, 9); left_screen.preload_range("t{0}.2.jpg", 1, 9); center_screen.preload_range("f{0}.0.jpg", 1, 17); center_screen.preload_range("t{0}.0.jpg", 1, 9); image.await("preloading_completed"); // Once everything preloaded, present 'next button' //next button var buttonOK = main .addblock( "center", buttonLocationHeight, buttonBlockSize[0], buttonBlockSize[1] ) .button("Next", "nextbutton", "nextbuttoninput", "ques1buttonid") .style("background", "lightgrey", "#ques1buttonid") .style("border-radius", "5%", "#ques1buttonid") .style("font-size", "50%", "#ques1buttonid") .align("center", "#ques1buttonid"); //console.log("we got till here!"); buttonOK.await("click"); main.removeblock(center_instr); main.removeblock(top_instr); main.removeblock(buttonOK); text(" Press the space bar when you feel ready to start! ", 60); awaitkey(" "); clear(); var position = [], counter_fill = 0, counter_test = 0, cond_pos_f = [], //Create variable for the condition of the position of left and right stimuli cond_pos_t = [], left_stimulus = [], right_stimulus = [], correct = [], score_test = 0, //Of global style. Each time participant selects global, +1 score_fill = 0; // Select stimulus in the center and then based on that for (i = 0; i < 24; ++i) { //Blank screen first center_screen.style("opacity", 0); left_screen.style("opacity", 0); right_screen.style("opacity", 0); //Wait for 1s await (1000); //Present stimuli center_screen.style("opacity", 1); left_screen.style("opacity", 1); right_screen.style("opacity", 1); var center_stimulus = stimuli_0[i]; position = Math.floor(Math.random() * 2); if (center_stimulus.length === 8) { //Extract trial number var trial = center_stimulus.substr(1, 1); } else { var trial = center_stimulus.substr(1, 2); } var cond = center_stimulus.substr(0, 1); // extract condition from name of center stimulus //Define left and right stimuli based on condition (defined by center stimulus) if (cond === "f") { //If condition is fill counter_fill = counter_fill + 1; if (counter_fill % 2 === 0) { //If even number, then present with default order (right answer on the left and non-similar figure on the right) cond_pos_f = 0; left_stimulus = fill_1[trial - 1]; right_stimulus = fill_2[trial - 1]; } else { // If uneven number, present inversed order (right answer on the right and non-similar figure on the left) cond_pos_f = 1; left_stimulus = fill_2[trial - 1]; right_stimulus = fill_1[trial - 1]; } } else if (cond === "t") { //If condition is test counter_test = counter_test + 1; if (counter_test % 2 === 0) { //If counter is even then keep default position cond_pos_t = 0; // Default position. Global feature: on the right (left_stimulus = test_1[trial - 1]), (right_stimulus = test_2[trial - 1]); } else { //If counter is uneven cond_pos_t = 1; //Invert position (left_stimulus = test_2[trial - 1]), (right_stimulus = test_1[trial - 1]); } } center_screen.showimage(center_stimulus); //showimage left_screen.showimage(left_stimulus); right_screen.showimage(right_stimulus); response_key = awaitkey("LEFT_ARROW,RIGHT_ARROW"); var r_key = getKeyName(response_key.key), left_screen_select = main.addblock(-20, 50, 70, 39.375), right_screen_select = main.addblock(50, 50, 70, 39.375); // Mark arrow selection (visual feedback of response) if (r_key === "LEFT_ARROW") { left_screen_select.style("border", "black solid 0.05em"); //right_screen.style('opacity', 0.2) //in case we want to make opaque the stimuli that was not selected } else if (r_key === "RIGHT_ARROW") { right_screen_select.style("border", "black solid 0.05em"); //left_screen.style('opacity',0.2); } await (1000); //1 s to show visual feedback //Remove visual feedback main.removeblock(left_screen_select); main.removeblock(right_screen_select); //Define correctness based on response for the fill trials, and global/local for the test condition //For fill condition correct=1 --> correct response, and correct=0 --> incorrect if (cond == "f") { if (r_key === "LEFT_ARROW" && cond_pos_f === 0) { //When position is default, correct response is on the left correct = 1; score_fill = score_fill + 1; } else if (r_key === "RIGHT_ARROW" && cond_pos_f === 1) { //When position is inverted (1), correct response is on the right correct = 1; score_fill = score_fill + 1; } else { correct = 0; } //Local will correspond to correct=2, and global to correct=3 } else if (cond === "t") { if (r_key === "LEFT_ARROW" && cond_pos_t === 0) { //If cond_pos_t===0, then local is on the left and global on the right correct = 2; } else if (r_key === "RIGHT_ARROW" && cond_pos_t === 0) { correct = 3; score_test = score_test + 1; } else if (r_key === "LEFT_ARROW" && cond_pos_t === 1) { correct = 3; score_test = score_test + 1; } else if (r_key === "RIGHT_ARROW" && cond_pos_t === 1) { correct = 2; } } text(correct); clear(); logtrial(response_key.RT, "RT", r_key, cond, correct, i); } log(score_fill, "Score_fill"); log(score_test, "Score_test"); main.removeblock(center_screen); main.removeblock(left_screen); main.removeblock(right_screen); text("All done, great job!! :)", 90); await (3000); text("Now press space to move on to the next part", 90); awaitkey("SPACE"); redirect_2("https://www.psytoolkit.org/c/3.3.2/survey?s=xZhcz",obj);

Data inspection is forthcoming!

In the mean time, authors may download their own data and make it available as an Excel file. Check out the 'Stimuli and Files' tab.

Related Experiments