Skip to content

Commit a051226

Browse files
bendichterrly
andauthored
add waveforms to Units table (#448)
* add waveforms to Units table * add release notes for Units.waveforms * Update core/nwb.misc.yaml Co-authored-by: Ryan Ly <rly@lbl.gov> * Update core/nwb.misc.yaml Co-authored-by: Ryan Ly <rly@lbl.gov> * change waveforms data to numeric * Update docstring for waveforms, add basic table docs (in progress) Co-authored-by: Ryan Ly <rly@lbl.gov>
1 parent e71b3d2 commit a051226

7 files changed

Lines changed: 101 additions & 1 deletion

File tree

core/nwb.misc.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,49 @@ groups:
281281
value: volts
282282
doc: Unit of measurement. This value is fixed to 'volts'.
283283
required: false
284+
- name: waveforms
285+
neurodata_type_inc: VectorData
286+
dtype: numeric
287+
dims:
288+
- num_waveforms
289+
- num_samples
290+
shape:
291+
- null
292+
- null
293+
doc: "Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index'
294+
column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform
295+
was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column
296+
to indicate which spike events belong to a given unit. For example, if the
297+
'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column
298+
correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond
299+
to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to
300+
the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then
301+
the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different
302+
electrodes for the first spike time of the first unit. See
303+
https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical
304+
representation of this example. When there is only one electrode for each unit (i.e., each spike time is
305+
associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is
306+
the number of spike events. The number of electrodes for each spike event should be the same within a given unit.
307+
The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order
308+
of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in
309+
the 'electrodes' column of this table. The number of samples for each waveform must be the same."
310+
quantity: '?'
311+
attributes:
312+
- name: sampling_rate
313+
dtype: float32
314+
doc: Sampling rate, in hertz.
315+
required: false
316+
- name: unit
317+
dtype: text
318+
value: volts
319+
doc: Unit of measurement. This value is fixed to 'volts'.
320+
required: false
321+
- name: waveforms_index
322+
neurodata_type_inc: VectorIndex
323+
doc: Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail.
324+
quantity: '?'
325+
- name: waveforms_index_index
326+
neurodata_type_inc: VectorIndex
327+
doc: Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more
328+
detail.
329+
quantity: '?'
137 KB
Loading
82 KB
Loading
49.6 KB
Binary file not shown.
216 KB
Loading

docs/format/source/format_description.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,56 @@ The timestamps\_link and data\_link fields refer to links made between
345345
time series, such as if timeseries A and timeseries B, each having
346346
different data (or time) share time (or data). This is much more
347347
important information as it shows structural associations in the data.
348+
349+
350+
Tables and ragged arrays
351+
------------------------
352+
353+
The NWB schema includes several tables, such as for storing data/metadata
354+
about trials, epochs, single units and multi-units, electrodes, and ROIs.
355+
All of the tables in NWB derive from the base data type, DynamicTable.
356+
DynamicTable is a column-based representation of a table that allows
357+
users to add custom columns (of type VectorData) that are not
358+
pre-defined in the specification. This is useful for handling types of
359+
data where every experiment or lab may want to store information
360+
unique to that experiment or lab, e.g., metadata
361+
related to the trials in a session or spike sorting metrics.
362+
363+
DynamicTable objects typically contain columns that are of equal length,
364+
where the i-th element of a column corresponds to the i-th element of
365+
all of the other columns. In other words, each row has a single item
366+
in each column. However, in some situations, users may wish to store and
367+
associate multiple items in a single column for each row. For example,
368+
in the Units table, each row represents a single sorted unit and each
369+
unit has multiple spike times associated with it, where the number of
370+
spike times differs between units (rows). This is sometimes called a
371+
ragged array or jagged array.
372+
373+
Ragged array columns can be created by creating a primary VectorData
374+
column that contains all of the data values (e.g., spike times) and
375+
creating a secondary VectorIndex column that contains a mapping from rows
376+
to elements of its target VectorData column. The VectorIndex column has the same
377+
number of elements (rows) as the rest of the table.
378+
379+
The values of the VectorIndex column follow the mapping such that the data
380+
associated with the first row is at VectorData[0:VectorIndex[0]], and the data
381+
associated with the second row is at VectorData[VectorIndex[0]:VectorIndex[1]],
382+
and so on.
383+
384+
.. image:: figures/units_spike_times.png
385+
:width: 800
386+
:alt: Demonstration of how spike times are stored in a ragged array column in the Units table.
387+
388+
Doubly ragged arrays
389+
---------------------
390+
391+
.. image:: figures/units_waveforms.png
392+
:width: 800
393+
:alt: Demonstration of how waveforms are stored in a double ragged array column in the Units table.
394+
395+
References to rows of a table
396+
------------------------------
397+
398+
.. image:: figures/units_electrodes.png
399+
:width: 800
400+
:alt: Demonstration of how references to rows of the electrodes table are stored in the electrodes column of the Units table.

docs/format/source/format_release_notes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ Release Notes
44
2.3.0 (Upcoming)
55
----------------
66

7+
- Add optional ``waveforms`` column to the ``Units`` table.
78
- Add optional ``strain`` field to ``Subject``.
89
- Add to ``DecompositionSeries`` an optional ``DynamicTableRegion`` called ``source_channels``.
910
- Add to ``ImageSeries`` an optional link to ``Device``.
11+
- Add optional ``continuity`` field to ``TimeSeries``.
1012
- Clarify documentation for electrode impedance and filtering.
11-
- Add optional "continuity" field to `TimeSeries`.
1213
- Update hdmf-common-schema to version 1.2.0. Release notes:
1314
- Add software process documentation.
1415
- Fix missing dtype for ``VectorIndex``.

0 commit comments

Comments
 (0)