Skip to content

Commit

Permalink
Add more info on aligning continuous and event data
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Jul 7, 2024
1 parent 6f9e88d commit b608d57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/User-Manual/Recording-data/Binary-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ Reading data in Matlab
#######################

* Use the `open-ephys-matlab-tools` <https://github.com/open-ephys/open-ephys-matlab-tools>`__ library.


8 changes: 8 additions & 0 deletions source/User-Manual/Recording-data/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ Once the synchronizer has been configured, starting data acquisition will automa
.. image:: ../../_static/images/recordingdata/recordnode-06.png
:alt: View of the record node when synchronized

Aligning continuous and event data
####################################

Within a given data stream, events and/or spikes can be aligned to samples in the continuous data by finding the index at which the sample numbers match. For example, if the continuous data sample numbers range from 100 to 1000, a TTL event that occurred at sample number 500, would be aligned with the 400th sample in the continuous data. The same principle applies to spikes. The matching index can also be found by subtracting the first continuous data sample number from the event's sample number. Using the stream start sample numbers found in :code:`sync_messages.txt` is no longer recommended for this, as it is less accurate.

In order to align events and continuous data from different streams, these streams must be synchronized first. If data streams have been synchronized online, the timestamps can be used without modification, as these represent global times in seconds. Since different streams are likely sampled at slightly different times, a method such as :code:`numpy.searchsorted` should be used to find the continuous data timestamp that most closely matches that of the event.

If the streams were not synchronized online, they can be synchronized offline assuming all streams share at least one event line in common. See the :ref:`datasynchronization` tutorial for more information about synchronizing data streams.

.. _NumPy: https://numpy.org/
.. _Neurodata Without Borders: https://www.nwb.org/
Expand Down

0 comments on commit b608d57

Please sign in to comment.