Replies: 1 comment 3 replies
-
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Bonsai community,
I have built up a workflow to present visual stimuli to animals when they are in certain state.
The workflow is working as fine as I can tell but Claude has some concerns over the use of
BehaviorSubjectinsideSelectMany(to deliver visual stimuli). Therefore, I was hoping to ask for a second opinion here.Also, the logics and nodes of the workflow are based on many discussion here and on the archived google group. I did not find a workflow that serves exactly the same function so I thought it would be good to publish it in case people find it useful.
Keywords: state-dependent stimulation (Schmitt trigger), refactory period, BonVision, fictrac,
The experiment is about presenting visual stimuli to head-fixed locusts only when they started to walk for longer than 1 second. Then the minimal interval between stimuli are 35 seconds (from the onset of previous stimulus to the onset of the next stimulus )
The animal's behaviour is estimated based on a third-party software, fictrac, which outputs the animal's heading direction, and x, y positions.
These outputs go into the workflow. Then rolling average of velocity is calculated with nodes taken from #2086
To create the condition of "walk for longer than 1 second", inside the node of
WalkStatesStimuli, I first set two thresholds for the velocity under different state transition (Schmitt trigger, for more details), and then only pass stimulation trigger when the walk state lasts more than 1 second with nodes taken from #1278Actually, once I implement Schmitt trigger and 1-second span, I can probably just use instaneous speed instead of rolling average
Additionally, to prevent delivering multiple stimuli at once, I set the refactory period to block stimulation trigger within 35 seconds (see here for more details). Lastly,
SelectManyreceives the stimulation trigger and the stimulus is present (50% of the trials is stimulus and the other 50% is transparent control, or skipped trial).Here is the question. When I send the workflow to Claude and ask it to proof-reading the workflow based on the workflow guidelines. It raised a concern over the implementation inside
SelectMany (PlayStimulus)Particulary, the concerns seem to be about me specifying QuadState (sync pulse state) with
MulticastSubject,BehaviorSubjectand receiving parameters withPropertyMapping. Based on the API documentation, I could get some idea whatAsyncSubjectis about. However, I still do not understand why usingAsyncSubjectinside theSelectMany. Could anyone give some suggestion?Below is the screenshot inside
SelectManyand insideWalkStatesStimuliand the workflowstate_dependant_visual_stimuli.bonsai.zip
Hope you enjoy reading my journey.
Please feel free to let me know if you have any comments on any part of the workflow. No matter it is not implemented efficently or causes some kind of race condition like that.
Beta Was this translation helpful? Give feedback.
All reactions