Thanks for sending this!
The pyopenephys library was developed prior to the addition of Record Nodes to the GUI, which explains why it doesn't work with your recording.
For loading the Rhythm FPGA data saved by Record Node #1, I'd recommend using the
open-ephys-python-tools library, which is maintained by the Open Ephys team.
For the Record Node saving the tracking plugin data, you’ll have the load the data manually because the event data is saved in a format that's specific to the Tracking Plugin.
I was able to read in the data array like this:
da = np.load(‘data_array.npy’)
x = np.frombuffer(da.flatten(), dtype=np.single)[::4]
y = np.frombuffer(da.flatten(), dtype=np.single)[1::4]
width = np.frombuffer(da.flatten(), dtype=np.single)[2::4]
height = np.frombuffer(da.flatten(), dtype=np.single)[3::4]
The last four lines are converting the byte buffer into float values, then extracting the x and y position, as well as the image width and height values (which are constant). It would be great to have a more elegant solution for this, but this will require some additional work.
I'm seeing a total of 601 values in the Tracking Plugin data array, and 3110 TTL frame trigger timestamps. Because the TTL line is recording both "on" and "off" events, the actual number of triggers is 1/2 of the total recorded events, or 1555.
There are a few reasons why there could be more timestamps than tracking values:
1) The Bonsai workflow was started after the frame triggers started, or stopped before the frame triggers ended. To help troubleshoot this, it would be helpful to save the camera frames in Bonsai using a SaveImage operator, to confirm how many frames are actually being captured.
2) Not all frames have events that are received by Open Ephys. It possible that, due to the way OSC messages are being buffered by the Tracking Plugin, information about some frames is being lost. Do the Tracking Plugin events have timestamps associated with them? If so, those could be used to determine whether the events are being received at a constant rate, or if there are gaps.
Let me know if that makes sense!
Josh