Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions iblrig_tasks/_iblrig_tasks_passiveChoiceWorld/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,22 @@ def _run(self):
self.trial_num = trial_num
log.info(f'Delay: {trial.stim_delay}; ID: {trial.stim_type}; Count: {self.trial_num}/300')
sys.stdout.flush()

if trial.stim_type == 'G':
# This will send the current trial info to the Bonsai workflow.
# We do this before the sleep timeout to avoid race conditions.
# We need to make sure Bonsai is in a state to display stimuli.
self.send_trial_info_to_bonsai()

time.sleep(trial.stim_delay)

if trial.stim_type == 'V':
self.valve_open(self.reward_time)
elif trial.stim_type == 'T':
self.sound_play_tone(state_timer=0.102)
elif trial.stim_type == 'N':
self.sound_play_noise(state_timer=0.510)
elif trial.stim_type == 'G':
# this will send the current trial info to the visual stim
# we need to make sure Bonsai is in a state to display stimuli
self.send_trial_info_to_bonsai()
self.bonsai_visual_udp_client.send_message(r'/re', byte_show_stim)
time.sleep(0.3) # todo: this is a very inaccurate way of controlling stim duration!
self.bonsai_visual_udp_client.send_message(r'/re', byte_hide_stim)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
"iblqt>=0.8.0",
"ONE-api>=3.3.0",
"tycmd-wrapper>=0.2.1",
"ibl-photometry>=0.1.1",
"ibl-photometry==0.1.1",
#
# Everything else
"annotated-types>=0.7.0",
Expand Down
Loading