<commit_before><!doctype html>
<html>
    <head>
    <title>Find the Target!</title>
        <script src="js/jquery.js"></script>
        <script src="js/jspsych/jspsych.js"></script>
        <script src="js/jspsych/plugins/jspsych-single-stim.js"></script>
    </head>
    <body><commit_msg>gonogo tutorial<commit_after><!doctype html>
<html>
    <head>
    <title>Find the Target!</title>
        <script type="text/javascript" src="jquery-latest.js"></script>
        <script type="text/javascript" src="js/jspsych/jspsych.js"></script>
        <script type="text/javascript" src="js/jspsych/plugins/jspsych-text.js"></script>
        <script type="text/javascript" src="js/jspsych/plugins/jspsych-visual-search-circle.js"></script>
        <script type="text/javascript" src="js/jspsych/plugins/jspsych-single-stim.js"></script>
    	<link type="text/css" rel="stylesheet" href="js/jspsych/css/jspsych.css"></link>
    </head>
    <body>
	<script>

		// define stimuli
		var test_stimuli = [
		  {
		    image: "img/png/blue_single.png",
		    data: { response: 'present' }
		  },
		  {
		    image: "img/png/blue_double.png",
		    data: { response: 'absent' }
		  }
		];
		
		// randomize order
		var all_trials = jsPsych.randomization.repeat(test_stimuli, 10, true);

		var post_trial_gap = function() {
		  return Math.floor( Math.random() * 1500 ) + 750;
		}

		var welcome_block = {
		  type: "text",
		  text: "Welcome to the experiment. Press any key to begin."
		};

		var instructions_block = {
		  type: "text",
		  text: "<p>In this experiment, a circle will appear in the center " +
		      "of the screen.</p><p>If the circle is <strong>blue</strong>, " +
		      "press the letter F on the keyboard as fast as you can.</p>" +
		      "<p>If the circle is <strong>orange</strong>, do not press " +
		      "any key.</p>" +
		      "<div class='left center-content'><img src='img/blue.png'></img>" +
		      "<p class='small'><strong>Press the F key</strong></p></div>" +
		      "<div class='right center-content'><img src='img/orange.png'></img>" +
		      "<p class='small'><strong>Do not press a key</strong></p></div>" +
		      "<p>Press any key to begin.</p>",
	      timing_post_trial: 2000
		};

		var debrief_block = {
		  type: "text",
		  text: function() {
		    return "<p>Your average response time was <strong>" +
		    getAverageResponseTime() + "ms</strong>. Press " +
		    "any key to complete the experiment. Thank you!</p>";
		  }
		};


		function getAverageResponseTime() {

		  var trials = jsPsych.data.getTrialsOfType('single-stim');

		  var sum_rt = 0;
		  var valid_trial_count = 0;
		  for (var i = 0; i < trials.length; i++) {
		    if (trials[i].response == 'go' && trials[i].rt > -1) {
		      sum_rt += trials[i].rt;
		      valid_trial_count++;
		    }
		  }
		  return Math.floor(sum_rt / valid_trial_count);
		}


		/*test block */
		var test_block = {
		  type: "single-stim",
		  stimuli: all_trials.image,
		  choices: ['F'],
		  data: all_trials.data,
		  timing_response: 1500,
		  timing_post_trial: post_trial_gap
		};


		var experiment = [];
		experiment.push(welcome_block);
		experiment.push(instructions_block);
		experiment.push(test_block);
		experiment.push(debrief_block);

		jsPsych.init({
			experiment_structure: experiment,
			on_finish: function() {
				jsPsych.data.displayData();
			}



		});

	</script>




{'fraction_non_alphanumeric': 0.16622379687038677, 'fraction_numerical': 0.006200177147918512, 'mean_word_length': 2.8897818599311136, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6371802', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1129, 'n_words': 239}