New user having trouble finding documentation for ephys package; trying to use ephys data to control LED in real time.

493 views
Skip to first unread message

Jeronimo Plata

unread,
Jun 21, 2017, 12:05:17 PM6/21/17
to Bonsai Users
I am totally new to Bonsai, with very little experience in electrophysiology, and only an undergraduate, so forgive me if I seem completely out of my depth (I am). I'm having trouble finding documentation for the ephys package. The FAQ says that examples can be found under the "files" menu, but this doesn't seem to be the case for Bonsai 2.3. The Bitbucket page is also lacking any documentation for ephys. Is there any documentation at all for the ephys or other packages?

Basically, I'm trying to use spike data to control LED output on an arduino in real time. We have 32 single electrodes implanted in a mouse cortex and are acquiring data using the Open Ephys acquisition board. What we would like to do is record the number and frequency of spikes (greater than ~50 microvolts) in electrode potential and, if conditions are met, use that as output to turn on an LED in real time. The end goal is to train a mouse to control the LED on it's own. I tried to use the Open Ephys GUI, but was unsuccessful in using spike events to control arduino pin output. In any case, Bonsai seems to provide much better functionality and larger throughput. Obviously, I want to avoid high latency - my graduate student swayed me away from trying to use LabView because she said we might expect to see a delay of ~1 second between spikes and LED output. 

I've attached the workflow from this post (untested, but will be trying it out today), but am unsure of what some of the ephys functions actually do. What is AdcScale for? Do I need to use the TtlState transform, or the TtlOut Output option from the RHD2000EvalBoard source in the data stream before connecting to the arduino DigitalOutput sink? If I want to apply a band pass filter, would I put it immediately after the RHD2000 source, or after the Source.AmplifierData node?

I apologize if this is all a little vague. I've been struggling with this project and honestly worry that I look incompetent to my graduate student. Any help would be greatly appreciated. 

Best,
Jeronimo Plata
RHD2164_30KSamplesSec.bonsai
RHD2164_30KSamplesSec.bonsai.layout

Jeronimo Plata

unread,
Jun 21, 2017, 5:44:12 PM6/21/17
to Bonsai Users
After trying for the last four hours to get the workflow to process data from the Open Ephys board, I'm completely lost. I've run into every error mentioned in this post. After looking all over this forum, I can only assume there's a problem with the rhd2000_usb3.bit bitfile, but I have no idea what, or how to fix it.

Gonçalo Lopes

unread,
Jun 21, 2017, 6:28:37 PM6/21/17
to Jeronimo Plata, Bonsai Users
Hi Jeronimo and welcome to the forums!

I'm sorry to hear you struggled getting the workflow to run. In general documentation always needs to improve, and the role of the forums is partly to stimulate this.

I will address your points in turn:

1) The FAQ entry needed to be updated, thank you for that. Since the release of Bonsai 2.3, examples can now be found in the Tools->Bonsai Gallery menu. The reason is that now users can contribute themselves to the example repository, with the hope was that the number of available examples will increase. However, it is possible that you will still not find the exact example you are looking for.

2) The raw amplifier data format is 16-bit unsigned integers, as described in the Intan reference manual. However, much of the online filtering operations work better with floating point precision (32-bit). The AdcScale node converts from the 16-bit amplifier step representation to 32-bit floating point units in Volts. You should place it after Source.AmplifierData, and after that should come the bandpass filter node (FrequencyFilter), so that you can take advantage of the higher precision arithmetics.

3) The TtlState node is actually used to split the result from the digital inputs of the OpenEphys board into an independent digital channel representations, but this is not necessarily what you want to feed the Arduino. It seems that instead you want to compute a digital signal from spike data, so you won't actually use the board level digital inputs.

To do this I guess you could use the DetectSpikes node to compute spike events on the filtered data and you could use the number of detected events as a condition to trigger the Arduino output. Depending on the size of the time bin over which you want to count spikes, you may need to use the Buffer node to increase the window over which you count events (default coming from the board is a buffer of 2ms).

4) Regarding your issue running the example, it seems like you are using a bitfile for a USB 3.0 board. Are you using an OpenEphys USB 3.0 board? Unfortunately, the USB 3.0 boards are currently not supported in Bonsai. The biggest reason is that I don't currently have access to one of these boards. I will try to figure a solution soon, but in the meantime, do you have any way to use one of the older USB 2.0 boards?

Hope this helps and do let us know if you have any further questions.

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/c578c494-e765-40fd-9c2a-8d0ec5d1970c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jeronimo Plata

unread,
Jun 22, 2017, 2:46:02 PM6/22/17
to Bonsai Users, jtu...@gmail.com
Thanks so much for getting back to me. Turns out we have an Intan board that uses the older USB-2 Opal Kelly board. I can process the signal, but now I'm having trouble with the arduino output. I've tried to use the DigitalOutput and AnalogOutput sinks at various points in the workflow, but keep getting this error message: "No overload method found for the given arguments."

I got this error a few times yesterday when working with the OpenEphys board, so I'm assuming this means that Bonsai isn't recognizing the arduino. I have standardfirmata uploaded to the arduino, and the baud rate is right, so I'm unsure what's going wrong. I've attached the workflow I'm using.

Thanks again for your help!


To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
ephys_amplifiers.bonsai
ephys_amplifiers.bonsai.layout

Gonçalo Lopes

unread,
Jun 23, 2017, 6:26:02 AM6/23/17
to Jeronimo Plata, Bonsai Users
Hi Jeronimo,

The error you are seeing indicates that the output of DetectSpikes is not compatible with the DigitalOutput node. This node expects to receive boolean values (true/false) but the output of DetectSpikes is a collection of waveforms (i.e. all the spikes that were detected in the time bin).

You can check what is the type of each node by right-clicking on it. I guess what you would need to do is to turn this collection of spikes into a boolean. If you want the test to depend on the number of spikes you could do it in two steps. First, right-click on the DetectSpikes node and select the Count property. This will give you the number of spikes detected. Then you can use the GreaterThan node to test whether you have more than a specified number of spikes. The output of this node should then be a boolean that you can connect to DigitalOutput.

Hope this helps.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.

KPerks

unread,
Jul 8, 2021, 2:53:11 PM7/8/21
to Bonsai Users

The links to the FAQ and bitbucket pages don't seem to exist. Is this correct? Where does this documentation live now?
Thanks!

Gonçalo Lopes

unread,
Jul 11, 2021, 9:00:03 PM7/11/21
to KPerks, Bonsai Users
Hi Krista,

The bitbucket repository has been deleted after bitbucket made the decision to delete all mercurial repositories a few years ago, so we had no choice but to move to github. More recently all documentation is (or will be) hosted at Bonsai (bonsai-rx.org)

Hope this helps

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages