Forums
Real time analysis - Printable Version

+- Forums (https://sanworks.io/forum)
+-- Forum: Bpod (https://sanworks.io/forum/forumdisplay.php?fid=1)
+--- Forum: Software (https://sanworks.io/forum/forumdisplay.php?fid=6)
+--- Thread: Real time analysis (/showthread.php?tid=3400)



Real time analysis - X_G - 07-29-2022

Hi Josh, 
I'm new to bpod, and I'm trying to figure out if there's some flexibility with how the Bpod runs the experiment/session.

Some info about my setup- 
I'm using a joystick connected to a load cell (analog input that goes to the analog input module). During one of the states, the animal moves the joystick; if the threshold is crossed, I move to the next state--> which is a reward.
I'm trying to see if there's a way to do a 'pause' between the states in which I can read the data that was recorded during the movement of the joystick and analyzes it (i want first to filter the data and get rid on noise, then I want to see if the threshold was crossed for a specific period, etc... ) and then continue to the next state. I guess a simple computation on 3-5 seconds of recorded data (1 analog channel) shouldn't take longer than a second, which can be the delay period between the movement and the reward- so ideally, it can be a state if the decision if the animal gets the reward or not. 

As I understand, it's not very trivial to do real-time analysis with bpod- in the future; I want to 'guide' the behavior of the animal with cues that will be shaped by the performance (if the animal moved the joystick too far, I'd play a high-frequency sound and vise versa...
Do you think it's possible with bpod? Or should I look for other solutions?  

Thanks in advance!

-Xenia


RE: Real time analysis - Josh - 07-30-2022

Hello Xenia,

The current system does not have a way to do DSP operations on the analog data stream, unfortunately.

One option is to acquire the data with Bonsai, and send soft event codes via TCP/IP to the state machine (e.g. this). On state machine r2 and newer, the next major update will include a second serial port on the PC so that Bonsai can connect directly. Bonsai does not currently have a 'source' for our analog input module, but any NI DAQ card should do. Since Bonsai runs on a different clock, you'll need to synchronize the data streams. You can set up the state machine to output a TTL square waveform in sync with its clock throughout each trial as in this example, and patch it into a second analog channel on the NI board.

-Josh