Accelerometer Data recorded from open ephys - extraction help

689 views
Skip to first unread message

Beata Kaminska-Kordowska

unread,
Apr 16, 2020, 8:17:28 PM4/16/20
to Open Ephys
Hi all! Hope that everyone is doing well during this different time of our lives. 

I was hoping that someone would have code that extracts acceleration information. 

I’m recording with the OpenEphys Gui with the Intan RHD 64 channel chip that has a built in 3-axis accelerometer. I’m interested in extracting general movement information. The accelerometer data is recorded in the flat binary continuous.dat format.  I’ve tried my hand at extracting it but have found the results don't align with movement from video footage. 

Any help would be greatly appreciated. 

All the best, 
Beata

Jon Newman

unread,
Apr 17, 2020, 11:20:20 AM4/17/20
to Beata Kaminska-Kordowska, Open Ephys
Hi,

So to clarify the issue: you are able to get the data loaded and are having trouble because you are not seeing the XYZ accel data jiggle around at  moments int the video at which the animal is obviously moving?

If that is the case, what steps did you take to get information about the video frame times into your ephys data? For example, did you run put the shutter active signal from the camera into to an auxiliary input on the OE box? Did you start the camera after you started acquiring ephys data?

Best,

Jon



--
You received this message because you are subscribed to the Google Groups "Open Ephys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-ephys+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-ephys/4e18fe69-7946-4a48-80a1-cfdad0b73430%40googlegroups.com.


--
Jonathan Newman
Postdoctoral Fellow, MIT

Beata Kaminska-Kordowska

unread,
Apr 17, 2020, 9:04:59 PM4/17/20
to Jon Newman, Open Ephys

Hi Jon, 

 

Yes, that is exactly the issue. 

 

Unfortunately, we did not run put the shutter active signal from the camera into to an auxiliary input on the OE box. Yes we did start the video after we started recording the ephys data and we are lining up the video with behavioral timestamps. 

 

I loaded the data for all three axes using load_open_ephys_binary, applied a butterworth filter to each, and took the Euclidean norm of the three (because all we care about is general movement). I was wondering if I missed any common procedures when dealing with accelerometer data. 


Thanks!


Beata Kaminska-Kordowska
Neuroscience and Behavior Program (Ph.D. candidate)
518 Tobin Hall
135 Hicks Way
University of Massachusetts
Amherst, MA 01003

Jon Newman

unread,
Apr 21, 2020, 12:54:13 PM4/21/20
to Beata Kaminska-Kordowska, Open Ephys
Hi Beata,

OK, thanks for clarifying. In this case, I fear that you might be out of luck. The camera and open ephys are running on their own clocks, so without some form of physical synchronization, its going to be difficult to align the data. 

If you are only interested on events on the order of seconds, and your very confident your camera is not dropping frames (which is extremely common with consumer grade devices and even machine vision cameras that have not be set up correctly), then you might be able to get away with synchronizing based on recording file start times.

However, in general, this a very bad approach. You need some form of physical synchronization between your data sources.

1. If your camera shares a shutter signal via a GPIO, then record that on an OE aux input
2. If not, you can e.g. flash an LED in the camera view and record the voltage driving the LED in your OE aux input. 
3. If your camera has a shutter input, you can drive it and the aux OE input with a common clock source like an micro-controller pin

Lots of other variants. But ultimately this is a GIGO issue. 

- Jon

王策群

unread,
Oct 18, 2021, 8:09:19 AM10/18/21
to Open Ephys
Hi Jon,

Thanks, that is what I tried to do, sync the ephys data and camera. currently I use a Logitech USB webcam and a Intan RHD2000 board.

1. At the beginning, I tried to record ephys and video in Bonsai,  like you said: "then you might be able to get away with synchronizing based on recording file start times."
I also use your Bonsai library to send data to the OE for visualization. but the data is weird, not sure if the adcscale's problem? 

微信图片_20211014150751.png微信图片_20211014150757.png

2. After a post on the bonsai forum, and follow Brunocruz's suggestion, use a Arduino to send TTL to flash an LED in the camera view and also to OE. 

3. Could the open ephys team provides a general bonsai workflow and OE signal chain for syncing data? I think most OE users try to figure out sync ephys and camera recording. 

My best,
Cequn

Jon Newman

unread,
Oct 18, 2021, 9:37:55 AM10/18/21
to 王策群, Open Ephys
Hi,

Im answering inline below

On Mon, Oct 18, 2021 at 5:09 AM 王策群 <uest...@gmail.com> wrote:
Hi Jon,

Thanks, that is what I tried to do, sync the ephys data and camera. currently I use a Logitech USB webcam and a Intan RHD2000 board.

1. At the beginning, I tried to record ephys and video in Bonsai,  like you said: "then you might be able to get away with synchronizing based on recording file start times."
I also use your Bonsai library to send data to the OE for visualization. but the data is weird, not sure if the adcscale's problem? 

微信图片_20211014150751.png微信图片_20211014150757.png

The issue is that the ephys socket assumes the datatype of the data inside each open CV matrix being sent on the Bonsai side. The matrix needs to hold 16-bit unsigned integers. If you are using ADCScale, its very likely that your internal data is a 32-bit floating point number. We should really have the ability to change this on the GUI side.
 

2. After a post on the bonsai forum, and follow Brunocruz's suggestion, use a Arduino to send TTL to flash an LED in the camera view and also to OE. 

This is a classic way to sync video and ephys. 

Newer methods use machine vision cameras which have the ability to control or record the shutter. However, if you only have a webcam, this is a good solution but requires some post processing.
 

3. Could the open ephys team provides a general bonsai workflow and OE signal chain for syncing data? I think most OE users try to figure out sync ephys and camera recording. 

The issue with using a webcam is that there is no explicit, self-contained workflow that will sync everything because the ephys and camera are running on independent clocks. You could post hoc timestamp and dump the frames before the start of the ephys recording. This will be accurate enough for almost all behavioral analysis but is not synchronization.

camera-ephys-start-together.png
I've attached this workflow as well.
 
camera-ephys-start-together.bonsai
Reply all
Reply to author
Forward
0 new messages