Running asynchronous Python script within Bonsai #1119
Unanswered
rjibanezalcala
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I'm doing some open-field arena animal tracking with a custom microcontroller system communicating with my PC through serial port. I've also written a custom Python library specifically to communicate with the microcontroller and generate randomised trial lists, as well as a script that has the entire trial control. I'm using Basler cameras and contour tracking to track my rats on my arena and have defined some regions of interest to indicated whether my rat steps into any one of the zones.
In the Python script I have a bounded for loop that automatically iterates through each trial from a list of randomly generated numbers (using numpy). My problem is that I'd like to run this script to run the trials and send the appropriate commands to the microcontroller, while at the same time tracking my rat's position and sending boolean flags to it so that actions can be taken accordingly at specific points in the trial.
I'm very new to Bonsai but have already made a workflow that tracks my rat and gives me each zone's status. I also have another workflow that's basically the whole trial, but is finnicky to set up, which is why I moved my trial control to Python.
I'd just like to know if it is possible to run my script in a workflow, and how to pass these flags over to it. I've attached the simplest workflow I have that only tracks the rat and give me the zone status. I'd also like to know how to import my Python package to use within Bonsai.
Thank you for any help you can provide!
Raquel
Live_rat_tracking.zip
Beta Was this translation helpful? Give feedback.
All reactions