prepare for adding active/passive instruction content using two private funcs

parent 52295523
"""Functions that either provide an instruction flow or a string to display."""
import os.path as op
import numpy as np
import pandas as pd
import sp_experiment
from sp_experiment.utils import get_final_choice_outcomes
......@@ -19,7 +22,6 @@ def run_instructions(kind, monitor='testMonitor', font='', lang='em'):
win = visual.Window(color=(0, 0, 0), # Background color: RGB [-1,1]
fullscr=True, # Fullscreen for better timing
monitor=monitor,
units='deg',
winType='pyglet')
# Hide the cursor
......@@ -33,19 +35,67 @@ def run_instructions(kind, monitor='testMonitor', font='', lang='em'):
txt_stim.height = 1
txt_stim.font = font
# prepare image stim
img_stim = visual.ImageStim(win)
img_stim.pos = (0.5, 0)
# general image directorys
init_dir = op.dirname(sp_experiment.__file__)
img_dir = op.join(init_dir, 'image_data')
# START INSTRUCTIONS
if kind == 'general':
txt_stim.text = _provide_general_instr_str(lang=lang)
txt_stim.draw()
win.flip()
event.waitKeys()
elif kind == 'active':
pass
texts = _provide_active_instr_strs(lang=lang)
for text in texts:
txt_stim.text = text
txt_stim.draw()
if '' in text:
img_stim.image = op.join(img_dir, 'bbtk_layout.png')
img_stim.draw()
win.flip()
event.waitKeys()
elif kind == 'passive':
pass
texts = _provide_passive_instr_strs(lang=lang)
for text in texts:
txt_stim.text = text
txt_stim.draw()
if '' in text:
img_stim.image = './bbtk_layout.png'
img_stim.draw()
win.flip()
event.waitKeys()
win.close()
def _provide_active_instr_strs(lang='en'):
"""Provide active instr texts."""
texts = list()
if lang == 'de':
pass
elif lang == 'en':
pass
return texts
def _provide_passive_instr_strs(lang='en'):
"""Provide passive instr texts."""
texts = list()
if lang == 'de':
pass
elif lang == 'en':
pass
return texts
def _provide_general_instr_str(lang='en'):
"""Provide a welcome screen text."""
if lang == 'de':
......@@ -56,7 +106,8 @@ def _provide_general_instr_str(lang='en'):
'Aufgabe gestartet. Wenn Sie mit dieser Aufgabe '
'fertig sind, wird die zweite Aufgabe in den selben '
'Schritten durchgeführt. Das heißt: Erst Anweisung, '
'dann Test, dann Durchführung der Aufgabe.')
'dann Test, dann Durchführung der Aufgabe. '
'Druecken Sie eine beliebige Taste.')
elif lang == 'en':
welcome_str = ('Welcome! You will perform two tasks, one after the '
'other. In the following you will get instructions '
......@@ -65,7 +116,7 @@ def _provide_general_instr_str(lang='en'):
'. After you are done, the second task will be '
'started using the same procedure. That is, first '
'instructions, then practice, then execution of the '
'second task.')
'second task. Press any button.')
return welcome_str
......@@ -97,7 +148,7 @@ def provide_blockfbk_str(data_file, current_nblocks, nblocks, lang):
' Am Ende des Experiments werden Ihre Punkte'
' in Euro umgerechnet und Ihnen als Bonus gezahlt.'
' Machen Sie jetzt eine kurze Pause.'
' Druecken Sie einen beliebigen Knopf um'
' Druecken Sie eine beliebige Taste um'
' fortzufahren.')
elif lang == 'en':
block_feedback = (f'Block {current_nblocks}/{nblocks} done!' # noqa: E999 E501
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment