From 11bab9715e6f68c3d90b4ba04a3b2e54f43c06a3 Mon Sep 17 00:00:00 2001 From: Niclas Dobbertin Date: Fri, 18 Aug 2023 10:23:47 +0200 Subject: procedure randomisation --- master_thesis/frensch_task.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'master_thesis/frensch_task.py') diff --git a/master_thesis/frensch_task.py b/master_thesis/frensch_task.py index 309153f..fc4c0ea 100644 --- a/master_thesis/frensch_task.py +++ b/master_thesis/frensch_task.py @@ -4,6 +4,7 @@ from __future__ import annotations from psychopy import constants, core, event, gui, visual from collections import namedtuple import frensch_procedures +import random DisplayVariable = namedtuple("DisplayVariable", ["name", "values"]) @@ -71,7 +72,7 @@ def generate_procedure_display(procedure: DisplayProcedure): return stim_procedure -def run_trial(): +def run_trial(procedure_keys: list): water_sample = frensch_procedures.random_WaterSample() water_sample.print_all() @@ -83,7 +84,8 @@ def run_trial(): stims = generate_variable_display([solid, algae, lime, toxin], x_positions) - p1 = DisplayProcedure(water_sample.index5_str(), water_sample.index1()) + procedures = water_sample.procedure_dict() + p1 = DisplayProcedure(procedures[procedure_keys[0]][1](), procedures[procedure_keys[0]][0]()) p1 = generate_procedure_display(p1) stims.append(p1) @@ -111,9 +113,17 @@ def run_trial(): if "\n" in stim_answer_box.text: not_finished = False - event.waitKeys(keyList=["space"]) return answer -print(f"Answer: {run_trial()}") + +procedure_keys = ["1", "2", "3", "4", "5", "6", "overall"] +train_procedures = procedure_keys[:-1] +random.shuffle(train_procedures) +train_procedures = train_procedures[:-1] +train_procedures.append(procedure_keys[-1]) +print(train_procedures) + + +print(f"Answer: {run_trial(train_procedures)}") -- cgit v1.2.3