Skip to content

Instantly share code, notes, and snippets.

@opmorgan
Created October 31, 2025 17:24
Show Gist options
  • Save opmorgan/00fedfcfa26f9541c324a858d8b848bf to your computer and use it in GitHub Desktop.
Save opmorgan/00fedfcfa26f9541c324a858d8b848bf to your computer and use it in GitHub Desktop.
Inquisit: show 20 stimuli drawn from a list of 160 - want to adapt to meet randomization constraints
***********************************************************************
Main Task Script for Nochmani Experiment
***********************************************************************
This script implements the main version of the Nochmani food preference task.
Participants see food images and choose whether Nochmani would "eat" or "don't eat".
Nochmani preferences: like sweets (approach-pos) and insects (approach-neg), hate meat (avoid-pos) and fungi (avoid-neg)
// User-specified variables // TODO: move to config
<parameters>
/ background_color = white
/ foreground_color = black
/ fontfamily_default = "Avenir Next"
/ fontsize_default = 5%
/ fontsize_default_small = 3%
/ nav_button_fontsize_default = 3%
/ fontsize_fixation = 8%
// Stimulus position and size parameters
/ stim_height = 60% // Stimulus height, in % screen size (width 50, height 100 resulted in 50% height)
/ stim_width = 0% //Stimulus width, in % screen size
/ stim_position_y = 50% // Picture x position, should be 47% for "EAT" 4% tall, 50% screen height (but screen height is not working as expected)
/ response_prompt_ypos = 85% // Y position of the prompts (anchored to center)
/ response_prompt_left_xpos = 20% // X Position of the left prompt (e.g., "EAT") (left anchor)
/ response_prompt_right_xpos = 80% // X Position of the left prompt (e.g., "EAT") (right anchor)
</parameters>
<text fixation_cross>
/ items = ("+")
/ fontstyle = (parameters.fontfamily_default, parameters.fontsize_fixation)
/ position = (50%, 50%)
/ halign = center
/ valign = center
</text>
<defaults>
/ fontstyle = (parameters.fontfamily_default, parameters.fontsize_default)
/ canvasaspectratio = (4,3)
/ minimumversion = "6.5.2.0" //TODO:update this
/ fontstyle = ("Avenir Next", parameters.fontsize_default, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = black
/ screencolor = white
</defaults>
***********************************************************************
Stimuli - Food Images
***********************************************************************
<item cake_foods>
/ 1 = "stimuli_cake1_crop.jpg"
/ 2 = "stimuli_cake2_crop.jpg"
/ 3 = "stimuli_cake3_crop.jpg"
/ 4 = "stimuli_cake4_crop.jpg"
/ 5 = "stimuli_cake5_crop.jpg"
/ 6 = "stimuli_cake6_crop.jpg"
/ 7 = "stimuli_cake7_crop.jpg"
/ 8 = "stimuli_cake8_crop.jpg"
/ 9 = "stimuli_cake9_crop.jpg"
/ 10 = "stimuli_cake10_crop.jpg"
/ 11 = "stimuli_cake11_crop.jpg"
/ 12 = "stimuli_cake12_crop.jpg"
/ 13 = "stimuli_cake13_crop.jpg"
/ 14 = "stimuli_cake14_crop.jpg"
/ 15 = "stimuli_cake15_crop.jpg"
/ 16 = "stimuli_cake16_crop.jpg"
/ 17 = "stimuli_cake17_crop.jpg"
/ 18 = "stimuli_cake18_crop.jpg"
/ 19 = "stimuli_cake19_crop.jpg"
/ 20 = "stimuli_cake20_crop.jpg"
/ 21 = "stimuli_cake21_crop.jpg"
/ 22 = "stimuli_cake22_crop.jpg"
/ 23 = "stimuli_cake23_crop.jpg"
/ 24 = "stimuli_cake24_crop.jpg"
/ 25 = "stimuli_cake25_crop.jpg"
/ 26 = "stimuli_cake26_crop.jpg"
/ 27 = "stimuli_cake27_crop.jpg"
/ 28 = "stimuli_cake28_crop.jpg"
/ 29 = "stimuli_cake29_crop.jpg"
/ 30 = "stimuli_cake30_crop.jpg"
/ 31 = "stimuli_cake31_crop.jpg"
/ 32 = "stimuli_cake32_crop.jpg"
/ 33 = "stimuli_cake33_crop.jpg"
/ 34 = "stimuli_cake34_crop.jpg"
/ 35 = "stimuli_cake35_crop.jpg"
/ 36 = "stimuli_cake36_crop.jpg"
/ 37 = "stimuli_cake37_crop.jpg"
/ 38 = "stimuli_cake38_crop.jpg"
/ 39 = "stimuli_cake39_crop.jpg"
/ 40 = "stimuli_cake40_crop.jpg"
</item>
<item fungus_foods>
/ 1 = "stimuli_0_fungus_crop.jpg"
/ 2 = "stimuli_fungus1_crop.jpg"
/ 3 = "stimuli_fungus2_crop.jpg"
/ 4 = "stimuli_fungus3_crop.jpg"
/ 5 = "stimuli_fungus4_crop.jpg"
/ 6 = "stimuli_fungus5_crop.jpg"
/ 7 = "stimuli_fungus6_crop.jpg"
/ 8 = "stimuli_fungus7_crop.jpg"
/ 9 = "stimuli_fungus8_crop.jpg"
/ 10 = "stimuli_fungus9_crop.jpg"
/ 11 = "stimuli_fungus10_crop.jpg"
/ 12 = "stimuli_fungus11_crop.jpg"
/ 13 = "stimuli_fungus12_crop.jpg"
/ 14 = "stimuli_fungus13_crop.jpg"
/ 15 = "stimuli_fungus14_crop.jpg"
/ 16 = "stimuli_fungus15_crop.jpg"
/ 17 = "stimuli_fungus16_crop.jpg"
/ 18 = "stimuli_fungus17_crop.jpg"
/ 19 = "stimuli_fungus18_crop.jpg"
/ 20 = "stimuli_fungus19_crop.jpg"
/ 21 = "stimuli_fungus20_crop.jpg"
/ 22 = "stimuli_fungus21_crop.jpg"
/ 23 = "stimuli_fungus22_crop.jpg"
/ 24 = "stimuli_fungus23_crop.jpg"
/ 25 = "stimuli_fungus24_crop.jpg"
/ 26 = "stimuli_fungus25_crop.jpg"
/ 27 = "stimuli_fungus26_crop.jpg"
/ 28 = "stimuli_fungus27_crop.jpg"
/ 29 = "stimuli_fungus28_crop.jpg"
/ 30 = "stimuli_fungus29_crop.jpg"
/ 31 = "stimuli_fungus30_crop.jpg"
/ 32 = "stimuli_fungus31_crop.jpg"
/ 33 = "stimuli_fungus32_crop.jpg"
/ 34 = "stimuli_fungus33_crop.jpg"
/ 35 = "stimuli_fungus34_crop.jpg"
/ 36 = "stimuli_fungus35_crop.jpg"
/ 37 = "stimuli_fungus36_crop.jpg"
/ 38 = "stimuli_fungus37_crop.jpg"
/ 39 = "stimuli_fungus38_crop.jpg"
/ 40 = "stimuli_fungus39_crop.jpg"
</item>
<item meat_foods>
/ 1 = "stimuli_0_meat_crop.jpg"
/ 2 = "stimuli_meat1_crop.jpg"
/ 3 = "stimuli_meat2_crop.jpg"
/ 4 = "stimuli_meat3_crop.jpg"
/ 5 = "stimuli_meat4_crop.jpg"
/ 6 = "stimuli_meat5_crop.jpg"
/ 7 = "stimuli_meat6_crop.jpg"
/ 8 = "stimuli_meat7_crop.jpg"
/ 9 = "stimuli_meat8_crop.jpg"
/ 10 = "stimuli_meat9_crop.jpg"
/ 11 = "stimuli_meat10_crop.jpg"
/ 12 = "stimuli_meat11_crop.jpg"
/ 13 = "stimuli_meat12_crop.jpg"
/ 14 = "stimuli_meat13_crop.jpg"
/ 15 = "stimuli_meat14_crop.jpg"
/ 16 = "stimuli_meat15_crop.jpg"
/ 17 = "stimuli_meat16_crop.jpg"
/ 18 = "stimuli_meat17_crop.jpg"
/ 19 = "stimuli_meat18_crop.jpg"
/ 20 = "stimuli_meat19_crop.jpg"
/ 21 = "stimuli_meat20_crop.jpg"
/ 22 = "stimuli_meat21_crop.jpg"
/ 23 = "stimuli_meat22_crop.jpg"
/ 24 = "stimuli_meat23_crop.jpg"
/ 25 = "stimuli_meat24_crop.jpg"
/ 26 = "stimuli_meat25_crop.jpg"
/ 27 = "stimuli_meat26_crop.jpg"
/ 28 = "stimuli_meat27_crop.jpg"
/ 29 = "stimuli_meat28_crop.jpg"
/ 30 = "stimuli_meat29_crop.jpg"
/ 31 = "stimuli_meat30_crop.jpg"
/ 32 = "stimuli_meat31_crop.jpg"
/ 33 = "stimuli_meat32_crop.jpg"
/ 34 = "stimuli_meat33_crop.jpg"
/ 35 = "stimuli_meat34_crop.jpg"
/ 36 = "stimuli_meat35_crop.jpg"
/ 37 = "stimuli_meat36_crop.jpg"
/ 38 = "stimuli_meat37_crop.jpg"
/ 39 = "stimuli_meat38_crop.jpg"
/ 40 = "stimuli_meat39_crop.jpg"
</item>
<item insect_foods>
/ 1 = "stimuli_0_insect_crop.jpg"
/ 2 = "stimuli_insect1_crop.jpg"
/ 3 = "stimuli_insect2_crop.jpg"
/ 4 = "stimuli_insect3_crop.jpg"
/ 5 = "stimuli_insect4_crop.jpg"
/ 6 = "stimuli_insect5_crop.jpg"
/ 7 = "stimuli_insect6_crop.jpg"
/ 8 = "stimuli_insect7_crop.jpg"
/ 9 = "stimuli_insect8_crop.jpg"
/ 10 = "stimuli_insect9_crop.jpg"
/ 11 = "stimuli_insect10_crop.jpg"
/ 12 = "stimuli_insect11_crop.jpg"
/ 13 = "stimuli_insect12_crop.jpg"
/ 14 = "stimuli_insect13_crop.jpg"
/ 15 = "stimuli_insect14_crop.jpg"
/ 16 = "stimuli_insect15_crop.jpg"
/ 17 = "stimuli_insect16_crop.jpg"
/ 18 = "stimuli_insect17_crop.jpg"
/ 19 = "stimuli_insect18_crop.jpg"
/ 20 = "stimuli_insect19_crop.jpg"
/ 21 = "stimuli_insect20_crop.jpg"
/ 22 = "stimuli_insect21_crop.jpg"
/ 23 = "stimuli_insect22_crop.jpg"
/ 24 = "stimuli_insect23_crop.jpg"
/ 25 = "stimuli_insect24_crop.jpg"
/ 26 = "stimuli_insect25_crop.jpg"
/ 27 = "stimuli_insect26_crop.jpg"
/ 28 = "stimuli_insect27_crop.jpg"
/ 29 = "stimuli_insect28_crop.jpg"
/ 30 = "stimuli_insect29_crop.jpg"
/ 31 = "stimuli_insect30_crop.jpg"
/ 32 = "stimuli_insect31_crop.jpg"
/ 33 = "stimuli_insect32_crop.jpg"
/ 34 = "stimuli_insect33_crop.jpg"
/ 35 = "stimuli_insect34_crop.jpg"
/ 36 = "stimuli_insect35_crop.jpg"
/ 37 = "stimuli_insect36_crop.jpg"
/ 38 = "stimuli_insect37_crop.jpg"
/ 39 = "stimuli_insect38_crop.jpg"
/ 40 = "stimuli_insect39_crop.jpg"
</item>
<picture cake_image>
/ items = cake_foods
/ position = (50%, parameters.stim_position_y) // X, Y
/ size = (parameters.stim_height, null) // Width, height
/ valign = center
/ halign = center
</picture>
<picture fungus_image>
/ items = fungus_foods
/ position = (50%, parameters.stim_position_y) // X, Y
/ size = (parameters.stim_height, null) // Width, height
/ valign = center
/ halign = center
</picture>
<picture meat_image>
/ items = meat_foods
/ position = (50%, parameters.stim_position_y) // X, Y
/ size = (parameters.stim_height, null) // Width, height
/ valign = center
/ halign = center
</picture>
<picture insect_image>
/ items = insect_foods
/ position = (50%, parameters.stim_position_y) // X, Y
/ size = (parameters.stim_height, null) // Width, height
/ valign = center
/ halign = center
</picture>
***********************************************************************
Values
***********************************************************************
<values>
/ stim_index = 0
/ correct_response = ""
</values>
***********************************************************************
Text Stimuli
***********************************************************************
<text main_instructions>
/ items = ("In this task, you will see images of food. For each image, decide whether the Nochmani people would EAT or DON'T EAT this food.
Remember:
- Nochmani like sweets and insects
- Nochmani hate meat and fungi
Press Z for EAT or / for DON'T EAT")
/ fontstyle = ("Arial", 4%)
/ position = (50%, 15%)
/ halign = center
/ valign = top
/ size = (90%, 20%)
</text>
<text main_instructions_reversed_warning1>
/ items = ("ATTENTION: The keys have been REVERSED!")
/ fontstyle = (parameters.fontfamily_default, 5%, true)
/ position = (50%, 8%)
/ halign = center
/ valign = top
/ txcolor = (255, 0, 0)
</text>
<text main_instructions_reversed>
/ items = ("In this task, you will see images of food. For each image, decide whether the Nochmani people would EAT or DON'T EAT this food.")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (50%, 22%)
/ halign = center
/ valign = top
/ size = (85%, 15%)
</text>
<text main_instructions_reversed_remember>
/ items = ("Remember:
- Nochmani like sweets and insects
- Nochmani hate meat and fungi")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (50%, 42%)
/ halign = center
/ valign = top
/ size = (85%, 15%)
</text>
<text main_instructions_reversed_warning2>
/ items = ("REVERSED KEYS: Press Z for DON'T EAT or / for EAT")
/ fontstyle = (parameters.fontfamily_default, 5%, true)
/ position = (50%, 62%)
/ halign = center
/ valign = top
/ txcolor = (255, 0, 0)
</text>
<text main_response_eat>
/ items = ("EAT (Z)")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (parameters.response_prompt_left_xpos, parameters.response_prompt_ypos)
/ halign = left
/ valign = center
/ txcolor = (0, 150, 0)
</text>
<text main_response_dont_eat>
/ items = ("DON'T EAT (/)")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (parameters.response_prompt_right_xpos, parameters.response_prompt_ypos)
/ halign = right
/ valign = center
/ txcolor = (200, 0, 0)
</text>
<text main_response_eat_reversed>
/ items = ("EAT (/)")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (parameters.response_prompt_right_xpos, parameters.response_prompt_ypos)
/ halign = right
/ valign = center
/ txcolor = (0, 150, 0)
</text>
<text main_response_dont_eat_reversed>
/ items = ("DON'T EAT (Z)")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (parameters.response_prompt_left_xpos, parameters.response_prompt_ypos)
/ halign = left
/ valign = center
/ txcolor = (200, 0, 0)
</text>
<text main_press_space_continue>
/ items = ("Press SPACE to continue")
/ fontstyle = (parameters.fontfamily_default, 4%)
/ position = (50%, 95%)
/ halign = center
/ valign = center
</text>
***********************************************************************
Main Trials
***********************************************************************
<trial cake_trial>
/ stimulustimes = [0 = fixation_cross; 1000 = cake_image, main_response_eat, main_response_dont_eat]
/ validresponse = ("z", "/")
/ correctresponse = ("z")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial fungus_trial>
/ stimulustimes = [0 = fixation_cross; 1000 = fungus_image, main_response_eat, main_response_dont_eat]
/ validresponse = ("z", "/")
/ correctresponse = ("/")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial meat_trial>
/ stimulustimes = [0 = fixation_cross; 1000 = meat_image, main_response_eat, main_response_dont_eat]
/ validresponse = ("z", "/")
/ correctresponse = ("/")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial insect_trial>
/ stimulustimes = [0 = fixation_cross; 1000 = insect_image, main_response_eat, main_response_dont_eat]
/ validresponse = ("z", "/")
/ correctresponse = ("z")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
***********************************************************************
Reversed Trials (Z = DON'T EAT, / = EAT)
***********************************************************************
<trial cake_trial_reversed>
/ stimulustimes = [0 = fixation_cross; 1000 = cake_image, main_response_eat_reversed, main_response_dont_eat_reversed]
/ validresponse = ("z", "/")
/ correctresponse = ("/")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial fungus_trial_reversed>
/ stimulustimes = [0 = fixation_cross; 1000 = fungus_image, main_response_eat_reversed, main_response_dont_eat_reversed]
/ validresponse = ("z", "/")
/ correctresponse = ("z")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial meat_trial_reversed>
/ stimulustimes = [0 = fixation_cross; 1000 = meat_image, main_response_eat_reversed, main_response_dont_eat_reversed]
/ validresponse = ("z", "/")
/ correctresponse = ("z")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
<trial insect_trial_reversed>
/ stimulustimes = [0 = fixation_cross; 1000 = insect_image, main_response_eat_reversed, main_response_dont_eat_reversed]
/ validresponse = ("z", "/")
/ correctresponse = ("/")
/ timeout = 3000
/ inputdevice = keyboard
/ responseinterrupt = immediate
/ posttrialpause = 0
</trial>
***********************************************************************
Instruction Trials
***********************************************************************
<trial trial_main_instructions>
/ stimulustimes = [1 = main_instructions, main_press_space_continue]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>
<trial trial_main_instructions_reversed>
/ stimulustimes = [1 = main_instructions_reversed_warning1, main_instructions_reversed, main_instructions_reversed_remember, main_instructions_reversed_warning2, main_press_space_continue]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>
***********************************************************************
Main Block
***********************************************************************
<block task_main_A>
/ trials = [
1 = trial_main_instructions;
2-21 = random(fungus_trial, meat_trial, insect_trial, cake_trial)
]
/ recorddata = true
</block>
<block task_main_B>
/ trials = [
1 = trial_main_instructions_reversed;
2-21 = random(fungus_trial_reversed, meat_trial_reversed, insect_trial_reversed, cake_trial_reversed)
]
/ recorddata = true
</block>
***********************************************************************
Data Recording
***********************************************************************
//<data>
// columns = (date time blockcode blocknum trialcode trialnum response correct latency stimulusnumber stimulusitem)
<///data>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment