Skip to content

Commit

Permalink
Add wait to specified duration at end of run
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Mar 10, 2017
1 parent 3850480 commit 01a6501
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions visigoth/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run(self):

try:

# Experiment initialization
# -- Experiment initialization

self.initialize_params()
self.initialize_data_output()
Expand All @@ -58,20 +58,20 @@ def run(self):
self.initialize_display()
self.initialize_stimuli()

# TODO need to add scanner trigger/dummy scans
# TODO need to add scanner trigger

# Wait a certain amount of time before starting the run
# (e.g. for dummy fMRI scans)
# TODO add a countdown or something nice here
self.wait_until(self.check_abort,
timeout=self.p.wait_pre_run)

# Initialize the experimental run
# -- Initialize the experimental run
self.clock.reset()
self.tracker.start_run()
self.iti_start = 0

# Main experimental loop
# -- Main experimental loop

for trial_info in self.generate_trials():

Expand All @@ -85,7 +85,10 @@ def run(self):

self.check_abort()

# TODO need to add leadout to specified run time
# Wait at the end of the run for exact duration
if self.p.run_duration is not None:
timeout = self.p.run_duration - self.clock.getTime()
self.wait_until(self.check_abort, timeout)

except:

Expand Down Expand Up @@ -814,6 +817,8 @@ def iti_end(self, iti_duration, check_abort=True):
perform_acc_target=None,
perform_rt_target=None,

run_duration=None,

output_template="data/{subject}/{session}/{time}",

)

0 comments on commit 01a6501

Please sign in to comment.