From d3a81759c311a9ccfc4d17d2cb9347b9367cb7d1 Mon Sep 17 00:00:00 2001 From: "Dobbertin, Niclas" Date: Wed, 31 Jul 2024 00:00:03 +0200 Subject: env progr --- modeling/model_env.py | 117 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 46 deletions(-) (limited to 'modeling/model_env.py') diff --git a/modeling/model_env.py b/modeling/model_env.py index 7dcad3e..1ad9495 100644 --- a/modeling/model_env.py +++ b/modeling/model_env.py @@ -1,54 +1,79 @@ #!/usr/bin/env python3 +import random -def generate_environments(): - envs = [] +from modeling import frensch_procedures + + +class Stimuli: + current_stimulus_id = 0 + + def __init__(self, condition, training_N=75, test_N=50): + self.condition = condition + self.training_N = training_N + self.test_N = test_N + + def generate_stimuli(self): + self.training_stimuli = frensch_procedures.constrained_WaterSample() + self.test_stimuli = frensch_procedures.constrained_WaterSample() + + def next_stimulus(self): + self.current_stimulus_id += 1 + if self.current_stimulus_id < self.training_N: + return self.training_stimuli[self.current_stimulus_id] + else: + return self.test_stimuli[self.current_stimulus_id - self.training_N] + + + def update_current_stimulus(self, ): + pass + + def generate_environments(self): + envs = [] - for i in range(3): screen = {} - screen["id"] = {"text": i, "position":(0,0)} - generate_variables(screen) - generate_procedures(screen) + self.generate_variables(screen) + self.generate_procedures(screen) envs.append(screen) - return envs - - -def generate_procedures(screen): - procs = ["procs1", "procs2", "procs3", "procs4", "procs5", "procs6"] - screen["Procedure1"] = {"text": procs[0], "position": (0, 100)} - screen["Procedure2"] = {"text": procs[1], "position": (0, 200)} - screen["Procedure3"] = {"text": procs[2], "position": (0, 300)} - screen["Procedure4"] = {"text": procs[3], "position": (0, 400)} - screen["Procedure5"] = {"text": procs[4], "position": (0, 500)} - - screen["ProcedureOverall"] = {"text": "proc_overall", "position": (0, 600)} - - screen["Answers"] = {"text": "Answers", "position": (100, 100)} - screen["Answer1"] = {"text": 1, "position": (100, 200)} - screen["Answer2"] = {"text": 2, "position": (100, 300)} - screen["Answer3"] = {"text": 3, "position": (100, 400)} - screen["Answer4"] = {"text": 4, "position": (100, 500)} - screen["Answer5"] = {"text": 5, "position": (100, 600)} - - screen["AnswerOverall"] = {"text": "proc_overall", "position": (100, 700)} - -def generate_variables(screen): - # Variables - screen["Algen"] = {"text": "Algen", "position": (400, 100)} - screen["AlgenVar"] = {"text": "3", "position": (400, 200)} - screen["Mineralien"] = {"text": "Mineralien", "position": (500, 100)} - screen["MineralienVar"] = {"text": "9", "position": (500, 200)} - - screen["Gifte"] = {"text": "Gifte", "position": (600, 100)} - screen["GifteVar1"] = {"text": "3", "position": (600, 200)} - screen["GifteVar2"] = {"text": "1", "position": (600, 300)} - screen["GifteVar3"] = {"text": "8", "position": (600, 400)} - screen["GifteVar4"] = {"text": "6", "position": (600, 500)} - - screen["Sandstein"] = {"text": "Sandstein", "position": (700, 100)} - screen["SandsteinVar1"] = {"text": "3", "position": (700, 200)} - screen["SandsteinVar2"] = {"text": "4", "position": (700, 300)} - screen["SandsteinVar3"] = {"text": "5", "position": (700, 400)} - screen["SandsteinVar4"] = {"text": "6", "position": (700, 500)} + return envs + + def generate_procedures(self, screen): + procs = ["procs1", "procs2", "procs3", "procs4", "procs5", "procs6"] + screen["Procedure1"] = {"text": procs[0], "position": (0, 100)} + screen["Procedure2"] = {"text": procs[1], "position": (0, 200)} + screen["Procedure3"] = {"text": procs[2], "position": (0, 300)} + screen["Procedure4"] = {"text": procs[3], "position": (0, 400)} + screen["Procedure5"] = {"text": procs[4], "position": (0, 500)} + + screen["ProcedureOverall"] = {"text": "proc_overall", "position": (0, 600)} + + screen["Answers"] = {"text": "Answers", "position": (100, 100)} + screen["Answer1"] = {"text": 1, "position": (100, 200)} + screen["Answer2"] = {"text": 2, "position": (100, 300)} + screen["Answer3"] = {"text": 3, "position": (100, 400)} + screen["Answer4"] = {"text": 4, "position": (100, 500)} + screen["Answer5"] = {"text": 5, "position": (100, 600)} + + screen["AnswerOverall"] = {"text": "proc_overall", "position": (100, 700)} + + def generate_variables(self, screen): + # Variables + screen["Algen"] = {"text": "Algen", "position": (400, 100)} + screen["AlgenVar"] = {"text": "3", "position": (400, 200)} + screen["Mineralien"] = {"text": "Mineralien", "position": (500, 100)} + screen["MineralienVar"] = {"text": "9", "position": (500, 200)} + + screen["Gifte"] = {"text": "Gifte", "position": (600, 100)} + screen["GifteVar1"] = {"text": "3", "position": (600, 200)} + screen["GifteVar2"] = {"text": "1", "position": (600, 300)} + screen["GifteVar3"] = {"text": "8", "position": (600, 400)} + screen["GifteVar4"] = {"text": "6", "position": (600, 500)} + + screen["Sandstein"] = {"text": "Sandstein", "position": (700, 100)} + screen["SandsteinVar1"] = {"text": "3", "position": (700, 200)} + screen["SandsteinVar2"] = {"text": "4", "position": (700, 300)} + screen["SandsteinVar3"] = {"text": "5", "position": (700, 400)} + screen["SandsteinVar4"] = {"text": "6", "position": (700, 500)} + -- cgit v1.2.3