Commit c2f7937e authored by Hao-Ting Wang's avatar Hao-Ting Wang

python3 syntax

parent 83ed8187
......@@ -7,9 +7,6 @@ build the main program here
import os
import sys
INFO = {
'Experiment': 'nback_expsampling', # compulsory
'Subject': '001', # compulsory
......@@ -29,7 +26,9 @@ def run_experiment():
from psychopy import core, event, logging, visual
from settings import *
from src.experiment import *
from src.experiment import (event_logger, Paradigm, fixation_cross,
Text, Question, responsescreen, instructions,
subject_info)
from src.fileIO import read_only, write_csv
# collect participant info
experiment_info = subject_info(INFO)
......@@ -85,8 +84,9 @@ def run_experiment():
# generate trials
Experiment.trials = next(trial_generator)
# wait trigger
instructions.waitTrigger(trigger_code)
if experiment_info['Environment'] is 'mri':
# wait trigger
instructions.waitTrigger(trigger_code)
# get a global clock
timer = core.Clock()
......@@ -154,8 +154,7 @@ def run_experiment():
# now run this thing
if __name__ == "__main__":
# set working directory as the location of this file
_thisDir = os.path.dirname(os.path.abspath(__file__)
).decode(sys.getfilesystemencoding())
_thisDir = os.path.dirname(os.path.abspath(__file__))
os.chdir(_thisDir)
run_experiment()
......
......@@ -181,7 +181,7 @@ def get_settings(env, ver, test=False):
elif ver == 'B':
settings.update(EXP_SAMPLING_B)
else:
raise ValueError, 'Version "{0}" not supported.'.format(ver)
raise ValueError('Version "{0}" not supported.'.format(ver))
if env == 'lab':
settings.update(LAB)
......@@ -191,7 +191,7 @@ def get_settings(env, ver, test=False):
settings.update(MRI)
else:
raise ValueError, 'Environment "{0}" not supported.'.format(env)
raise ValueError('Environment "{0}" not supported.'.format(env))
# Update it with either the test or production settings
......
......@@ -272,7 +272,7 @@ class trial_builder(object):
init_task_t, init_go_n = experiment_parameters.create_counter()
for block in blocks:
self.initialise(init_task_t, init_go_n) # HW- hard coding go_n this for now
self.initialise(init_task_t, init_go_n)
# get the specific go trials according to the block you are in
trial_NoGo, trial_Go = self.block_trials(
......@@ -339,7 +339,7 @@ class trial_builder(object):
if self.task_t != 0:
# if this list of trials is not good for the block, restart
init_task_t, init_go_n = experiment_parameters.create_counter()
self.initialise(init_task_t, init_go_n)# HW- hard coding go_n this for now
self.initialise(init_task_t, init_go_n)
self.trial_index = trial_idx_tmp
else:
# if it's good save this block to the run
......
......@@ -329,7 +329,7 @@ def get_keyboard(timer, respkeylist, keyans):
def quitEXP(endExpNow):
if endExpNow:
print 'user cancel'
print('user cancel')
core.quit()
......@@ -429,7 +429,7 @@ def subject_info(experiment_info):
return experiment_info
else:
core.quit()
print 'User cancelled'
print('User cancelled')
def event_logger(logging_level, LogFile):
......
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