Skip to content

Live plot of state matrix and event progress#34

Draft
ogeesan wants to merge 5 commits intosanworks:developfrom
ogeesan:feature/protocol-plot-hook
Draft

Live plot of state matrix and event progress#34
ogeesan wants to merge 5 commits intosanworks:developfrom
ogeesan:feature/protocol-plot-hook

Conversation

@ogeesan
Copy link
Contributor

@ogeesan ogeesan commented Jul 15, 2025

Work in progress branch with a live updating plot showing progress of state matrix. Similar to BpodSystem.SoftCodeHandlerFunction, BpodSystem.StateHandlerFunction enables the byte-read loop to run arbitrary code. Hooking into this with an object that accesses the same information used to update the Console's state and event readout allows a live plot of trial progress to be created.

To test it out, in the protocol setup:

lu = LiveStatePlot(BpodSystem);
lu.settings.defaultMaxTime = 10; % set the starting window width as 10 seconds
BpodSystem.StateHandlerFunction = @lu.update;

The key change is that some of RunStateMachine internal variables (e.g. event codes and timings) have been exposed in BpodSystem.Status for access during the trial.

  • Modify RunStateMachine to call a function handle when checking for state machine codes.
  • Modify TrialManagerObject
  • Create live state plot
  • Create live event plot
    • Configurable focus events (there are like 100 possible events for a state machine)
    • Lick lines
  • Create trial outcome/state entry notifier plugin
  • Test performance and optimise
  • Test on physical state machine
  • Create unit tests
    • Testing of new functions and classes
    • Create new protocol run testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant