Bpod + OpenEphys

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bpod + OpenEphys
#1
Hi Josh,

I was unable to find documentation on either of the wikis on using Bpod with OpenEphys beyond instructions for assembly of the sync board.
Did I miss any content that could speed up my setting up/debugging process?
Specifically, what do data in the all_channels.events file (format Open Ephys) mean in Bpod terms?

best,
Thiago
Reply
#2
Hi Thiago

Thanks for pointing out the missing documentation.
I'll try to get something up in the near future.

For the moment, use
/Bpod/Analysis/OpenEphysEvents2Bpod.m

Run from the command line, and pass the path to your Open Ephys events file as an argument. The function will output each Bpod state in your session, with a matching Open Ephys timestamp. You'll need a file from the Open Ephys repository in your MATLAB path to run the function.

I hope this helps!

Josh
Reply
#3
(11-29-2016, 12:39 AM)Josh Wrote: Hi Thiago

Thanks for pointing out the missing documentation.
I'll try to get something up in the near future.

For the moment, use
/Bpod/Analysis/OpenEphysEvents2Bpod.m

Run from the command line, and pass the path to your Open Ephys events file as an argument. The function will output each Bpod state in your session, with a matching Open Ephys timestamp. You'll need a file from the Open Ephys repository in your MATLAB path to run the function.

I hope this helps!

Josh

Hi, Josh,

I am trying to make sense of the Open Ephys events in terms of the behavioral states. I tried the function but the DecimalEvents returns all 1 and the Timestamps are all the same. I was using Bpodr0.8 and I synchronize Bpod with OpenEphys with TTL signals indicating state transition rather than trial transition. I just wonder whether this is because of the new Bpod or there is something wrong on my end. Thanks a lot!

Best,

Mu

(06-16-2017, 03:09 AM)muqiao Wrote:
(11-29-2016, 12:39 AM)Josh Wrote: Hi Thiago

Thanks for pointing out the missing documentation.
I'll try to get something up in the near future.

For the moment, use
/Bpod/Analysis/OpenEphysEvents2Bpod.m

Run from the command line, and pass the path to your Open Ephys events file as an argument. The function will output each Bpod state in your session, with a matching Open Ephys timestamp. You'll need a file from the Open Ephys repository in your MATLAB path to run the function.

I hope this helps!

Josh

Hi, Josh,

I am trying to make sense of the Open Ephys events in terms of the behavioral states. I tried the function but the DecimalEvents returns all 1 and the Timestamps are all the same. I was using Bpodr0.8 and I synchronize Bpod with OpenEphys with TTL signals indicating state transition rather than trial transition. I just wonder whether this is because of the new Bpod or there is something wrong on my end. Thanks a lot!

Best,

Mu

More specifically, I connected BNC output #1 to one of the Open Ephys BNC I/O Board port for synchronization.
Reply
#4
Hi Mu

The script /Analysis/OpenEphysEvents2Bpod.m is designed for Bpod 0.5.
I have not yet included one for Bpod 0.7-0.8. Thanks for pointing it out - this should be a top priority.
For now, if you load the open Ephys timestamps in with load_open_ephys_data.m, the resulting MATLAB struct should contain an Open Ephys timestamp that matches each BNC high / low event.

-Josh
Reply
#5
Hi Josh,


Continuing this thread, I haven't found any documentation on the OpenEphys sync board and I have the same problem as Mu when running the "OpenEphysEvents2Bpod" function. The DecimalEvents are all equal to 1 and all the Timestamps are the same. I have a Bpod 0.5 and I connected the OpenEphys sync board to the Sync port of the Bpod. 

Can it be that the version of the OpenEphys GUI causes this or is it something else? 

Thank you,
Matina
Reply
#6
Hi Matina,

I can't test the issue because we don't have an Open Ephys in our workshop. It's possible that they released GUI updates that require changes to the analysis code. The info below should help you troubleshoot.

Open Ephys has 8 digital input lines. The GUI software records a timestamp when any of them changes their logic state. Bpod 0.5's "sync" port has 7 lines connected to Open Ephys inputs, which display the current state# of the state machine in binary. The 8th line is connected to the sync board's BNC connector.
For instance, in Bpod state# 3, the 7 lines should read: 0000011, and the BNC line should read 0.

The first line of function OpenEphysEvents2Bpod() imports the Open Ephys event and timing data to MATLAB:

Code:
[data, pinChangeTimestamps, info] = load_open_ephys_data(filename);


For each line change, "data" indicates which Open Ephys digital input channel was changed.
For each line change, "info.eventID" indicates whether the associated line went low->high or high->low.
For each line change, pinChangeTimestamps contains the time of the change event, on the Open Ephys clock.

Each time Bpod changes its state, the Open Ephys sync board may register 1 or more line changes. For instance,  changing from state#3 to state#4 would generate 3 events:


Position 1: High -> Low
Position 2: High -> Low
Position 3: Low -> High

The OpenEphysEvents2Bpod script converts these events into Bpod event codes:

0000011 = 3

to

0000100 = 4

It then aligns the record of state numbers and timestamps in SessionData.RawData, with corresponding timestamps recorded by Open Ephys.

I'm not sure why you're seeing all 1's. Do the variables returned by load_open_ephys_data() look like they contain the expected logic line transitions?

If not, the error could be in hardware.
The 8th pin on the RJ45 connector is a ground, connecting Bpod to the Open Ephys board. Using a multimeter, if you measure resistance between Bpod ground (you can use the rightmost wire terminal ground) and Open Ephys ground, it should read much less than 1 ohm. 

As a last resort, you can handle synchronization manually.
In each state matrix, set a free BNC or wire output channel, to go "high" at the beginning of a trial, and remain high throughout the trial (for instance, by adding {'BNC1', 1} to each state's output actions. If you connect the line to Open Ephys's I/O board, load_open_ephys_data() should return a "high" event + timestamp on each trial start, and a "low" event + timestamp on each trial end. You can use the Open Ephys trial start timestamps to replace Bpod trial start times.

I hope this helps - and I'll update this next time I have a chance to test sync an Open Ephys board.

-Josh
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)