MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / update

Function update

brainworkshop.py:4695–4722  ·  view source on GitHub ↗
(dt)

Source from the content-addressed store, hash-verified

4693# tick = ticks_per_trial - 1: tick is reset to 0.
4694# tick = 1: etc.
4695def update(dt):
4696 if mode.started and not mode.paused: # only run the timer during a game
4697 if (not mode.flags[mode.mode]['selfpaced'] or
4698 mode.tick > mode.ticks_per_trial-6 or
4699 mode.tick < 5):
4700 mode.tick += 1
4701 if mode.tick == 1:
4702 mode.show_missed = False
4703 if mode.trial_number > 0:
4704 stats.save_input()
4705 mode.trial_number += 1
4706 mode.trial_starttime = time.time()
4707 trialsRemainingLabel.update()
4708 if mode.trial_number > mode.num_trials_total:
4709 end_session()
4710 else: generate_stimulus()
4711 reset_input()
4712 # Hide square at either the 0.5 second mark or sooner
4713 positions = len([mod for mod in mode.modalities[mode.mode] if mod.startswith('position')])
4714 positions = max(0, positions-1)
4715 if mode.tick == (6+positions) or mode.tick == mode.ticks_per_trial - 1:
4716 for visual in visuals: visual.hide()
4717 if mode.tick == mode.ticks_per_trial - 2: # display feedback for 200 ms
4718 mode.tick = 0
4719 mode.show_missed = True
4720 update_input_labels()
4721 if mode.tick == mode.ticks_per_trial:
4722 mode.tick = 0
4723pyglet.clock.schedule_interval(update, TICK_DURATION)
4724
4725angle = 0

Callers

nothing calls this directly

Calls 7

end_sessionFunction · 0.85
generate_stimulusFunction · 0.85
reset_inputFunction · 0.85
update_input_labelsFunction · 0.85
save_inputMethod · 0.80
updateMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected