Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move check of camera TTL from state-machine to initialization #558

Open
1 task done
bimac opened this issue Nov 27, 2023 · 5 comments · May be fixed by #771
Open
1 task done

move check of camera TTL from state-machine to initialization #558

bimac opened this issue Nov 27, 2023 · 5 comments · May be fixed by #771
Assignees
Labels
enhancement New feature or request

Comments

@bimac
Copy link
Contributor

bimac commented Nov 27, 2023

currently, when starting a session inheriting from ActiveChoiceWorldSession, the task blocks up if no sync pulses from the camera are received on the Bpod's behavior port during the first state of the state-machine:

if i == 0: # First trial exception start camera
log.info('Waiting for camera pulses...')
sma.add_state(
state_name='trial_start',
state_timer=3600,
state_change_conditions={'Port1In': 'stim_on'},
output_actions=[self.bpod.actions.bonsai_hide_stim, ('SoftCode', SOFTCODE.TRIGGER_CAMERA), ('BNC1', 255)],
) # sart camera

could/should this state have a time-out or be entirely optional?

  • adapt state-machine (separate branch)
@bimac
Copy link
Contributor Author

bimac commented Nov 27, 2023

@oliche @samupicard

@bimac bimac self-assigned this Nov 27, 2023
@bimac
Copy link
Contributor Author

bimac commented Nov 27, 2023

also, from a design-perspective - does it make sense to do this in the state-machine at all?

@samupicard
Copy link
Member

I don't know about the design question, but the camera-dependency definitely needs to be parametrized. A buggy video PC can currently block up the entire task pipeline, and there is no workaround

@k1o0 k1o0 mentioned this issue Jan 22, 2024
3 tasks
@bimac bimac changed the title parametrize use of camera move check of camera TTL from state-machine to initialization May 20, 2024
@oliche oliche removed their assignment Jun 17, 2024
@k1o0 k1o0 added the enhancement New feature or request label Jan 23, 2025
@k1o0
Copy link
Contributor

k1o0 commented Jan 23, 2025

also, from a design-perspective - does it make sense to do this in the state-machine at all?

I don't believe it does. This should be part of the pre-session hardware preparation and not executed during the first trial. Because the length of the first trial start pulse is undefined and the Bpod out is multiplexed, our extractors have to 'guess' which pulse to assign to the first trial start event:

https://github.com/int-brain-lab/ibllib/blob/526385b3e7b3962cbd910911409cbf03c4e5a17d/ibllib/io/extractors/ephys_fpga.py#L1149-L1160

This is very unreliable as the valve pulse is also variable in length (depends on water volume and calibration). What's more, if the first trial start pulse is missed on the FPGA (e.g. due to the DAQ starting after task starts, int-brain-lab/ibllib#909) then the first valve pulse may be erroneously interpreted as the trial start. All of this could be resolved by leaving the camera trigger out of the state machine altogether. This could be done elsewhere by manually setting Bpod high until the first Port1In event, or maybe with a pre-task state machine.

@bimac
Copy link
Contributor Author

bimac commented Feb 11, 2025

make sure to use specific version tag when testing

@bimac bimac linked a pull request Feb 20, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants