Skip to content

Commit 9f554e3

Browse files
rlyclaude
andauthored
Recommend /events as single location for EventsTable; add source attribute (#690)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 489cc31 commit 9f554e3

6 files changed

Lines changed: 79 additions & 47 deletions

File tree

core/nwb.behavior.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,17 @@ groups:
6666
- neurodata_type_def: BehavioralEvents
6767
neurodata_type_inc: NWBDataInterface
6868
default_name: BehavioralEvents
69-
doc: DEPRECATED. Use an EventsTable instead.
70-
TimeSeries for storing behavioral events. See description of BehavioralEpochs
71-
for more details.
69+
doc: 'DEPRECATED. Use an `EventsTable` instead, placed in the top-level `/events`
70+
group of the `NWBFile`. Each `TimeSeries` formerly stored under
71+
`BehavioralEvents` becomes one `EventsTable`. The `timestamps` field maps to
72+
the `timestamp` column, and the `data` field maps to an additional column
73+
named after the event marker (e.g., `reward_magnitude`, `port_number`); for
74+
multi-dimensional `data`, use one column per field. Any other per-event
75+
metadata becomes additional columns. Use the `source_description` attribute
76+
on the `EventsTable` to record where the events came from (e.g., "Acquisition
77+
system", "Thresholding of analog signal ANALOG1 at 3 V", "Manual video
78+
review"). Original definition: TimeSeries for storing behavioral events. See
79+
description of BehavioralEpochs for more details.'
7280
groups:
7381
- neurodata_type_inc: TimeSeries
7482
doc: TimeSeries object containing behavioral events.

core/nwb.event.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ groups:
4848
is absent, optional, or mixed across rows. Additional columns may be added to
4949
store metadata about each event, such as the duration of the event. Examples
5050
include TTL pulses, licks, rewards, stimulus onsets, and detected ripples.
51+
Each `EventsTable` should hold events of a single type, so that all rows share
52+
the same set of per-event metadata columns. Events of different types (e.g.,
53+
licks and stimulus presentations) should be stored in separate `EventsTable`
54+
instances.
5155
attributes:
5256
- name: description
5357
dtype: text
@@ -57,6 +61,18 @@ groups:
5761
different types of events using a strobed or N-bit encoding, then the description
5862
should describe which channels were used and how the event time is computed,
5963
e.g., as the rise time of the first bit.
64+
- name: source_description
65+
dtype: text
66+
doc: Optional short text description of where the events came from, applying
67+
to every row in the table. For example, "Acquisition system" for events
68+
emitted directly by the acquisition system (e.g., TTL edges or hardware
69+
event channels); "Thresholding of analog signal ANALOG1 at 3 V" for events
70+
produced by a detection algorithm run on acquired data; or "Manual video
71+
review" for events added by a human annotator. This is a free-text label of
72+
origin only; use `description` for the longer narrative of how the event
73+
times were computed (channels used, encoding scheme, algorithm parameters,
74+
etc.).
75+
required: false
6076
datasets:
6177
- name: timestamp
6278
neurodata_type_inc: TimestampVectorData

core/nwb.file.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,19 @@ groups:
406406
doc: Optional additional table(s) for describing other experimental time intervals.
407407
quantity: '*'
408408
- name: events
409-
doc: Primary experimental event tables for the session, stored as `EventsTable`
410-
instances. This location is intended for event data that are ready to be used
411-
in downstream analysis. It replaces the deprecated `BehavioralEvents` placement.
412-
Events emitted directly by the acquisition system (TTL edges, hardware event
413-
channels) belong in `/acquisition/`. Events derived by user processing
414-
(filtering, detection algorithms, annotation with experimental context) belong
415-
in a `ProcessingModule` under `/processing/`. For periods with required start
416-
and stop times, see `/intervals/`. For continuous acquired signals or stimulus
409+
doc: Experimental event tables for the session, stored as `EventsTable`
410+
instances. This is the recommended location for all event tables in the file,
411+
regardless of whether the events were emitted directly by the acquisition
412+
system (TTL edges, hardware event channels), derived by user processing
413+
(filtering, detection algorithms), or added as post-hoc annotations. The
414+
provenance of each table can be recorded in the `source_description`
415+
attribute of the `EventsTable` and described in more detail in its
416+
`description`. Each
417+
`EventsTable` should hold events of a single type (i.e., events sharing the
418+
same per-event metadata columns). For periods with required start and stop
419+
times, see `/intervals/`. For continuous acquired signals or stimulus
417420
templates from which events may have been derived, see `/acquisition/` or
418-
`/stimulus/`. For more guidance on choosing between `/events/`, `/acquisition/`,
419-
`/processing/`, and `/analysis/`, see the schema docs FAQ.
421+
`/stimulus/`.
420422
quantity: '?'
421423
groups:
422424
- neurodata_type_inc: EventsTable

core/nwb.misc.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ groups:
4747

4848
- neurodata_type_def: AnnotationSeries
4949
neurodata_type_inc: TimeSeries
50-
doc: DEPRECATED. Use an EventsTable instead. Stores user annotations made during an experiment. The data[]
51-
field stores a text array, and timestamps are stored for each annotation (ie,
52-
interval=1). This is largely an alias to a standard TimeSeries storing a text
53-
array but that is identifiable as storing annotations in a machine-readable way.
50+
doc: 'DEPRECATED. Use an `EventsTable` instead, placed in the top-level `/events`
51+
group of the `NWBFile`. The `timestamps` field maps to the `timestamp` column,
52+
and the `data` field (annotation strings) maps to the `annotation` column on
53+
`EventsTable`. Use the `source_description` attribute on the `EventsTable` to
54+
record where the annotations came from (e.g., "Manual video review"). Original definition: Stores
55+
user annotations made during an experiment. The data[] field stores a text
56+
array, and timestamps are stored for each annotation (ie, interval=1). This
57+
is largely an alias to a standard TimeSeries storing a text array but that
58+
is identifiable as storing annotations in a machine-readable way.'
5459
datasets:
5560
- name: data
5661
dtype: text

docs/format/source/format_description.rst

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -380,24 +380,25 @@ continuously (e.g., a 30 kHz 0/1 trace of a TTL channel) is a ``TimeSeries``. Ed
380380
times derived from that trace are an ``EventsTable``. The continuous-vs-edges
381381
distinction is independent of where the data is stored in the file hierarchy.
382382

383-
*Place EventsTable instances based on how the data was derived.* ``EventsTable`` is
384-
allowed in multiple groups, mirroring ``TimeSeries`` placement conventions:
385-
386-
- ``/acquisition`` — events emitted directly by the acquisition system (Neuralynx ``.nev``, Open Ephys event channels, TTL edges parsed from a directly-recorded digital line).
387-
- ``/processing/<module>`` — events derived by user processing: filtering, debouncing, detection algorithms, or events annotated with experimental context.
388-
- ``/events`` — primary experimental event tables for the session, ready to be used in downstream analysis. The ``BehavioralEvents`` replacement case from NWBEP001.
389-
- ``/analysis`` — events tied to final scientific analysis.
390-
391-
The ``/events`` versus ``/processing/behavior/`` choice is the most common source of
392-
confusion. Prefer ``/events`` when the table is a top-level experimental annotation
393-
ready for downstream analysis. Prefer ``/processing`` when the table is an
394-
intermediate output consumed by other processing steps.
395-
396-
For the borderline case of edge times derived from a directly-recorded digital line,
397-
default to ``/acquisition``. Edge detection on a binary line is information-preserving
398-
— the events are what the acquisition system would have emitted if configured to do
399-
so. Reserve ``/processing`` for cases involving actual decisions (thresholding analog
400-
signals, debouncing, filtering, selection).
383+
*Place all EventsTable instances in /events.* Event tables are organized by data
384+
modality, not by processing stage. All ``EventsTable`` instances for the session
385+
go in the top-level ``/events`` group.
386+
387+
Use the optional ``source_description`` attribute on each ``EventsTable`` to record
388+
where the events came from, as a short human-readable phrase. Examples:
389+
390+
- ``"Acquisition system"``
391+
- ``"Thresholding of analog signal ANALOG1 at 3 V"``
392+
- ``"Manual video review"``
393+
394+
Use the longer ``description`` attribute for the narrative of how the event times
395+
were computed (channels used, encoding scheme, algorithm parameters, etc.).
396+
397+
*Each EventsTable holds events of a single type.* All rows in a given table should
398+
share the same set of per-event metadata columns. Store events of different types
399+
(licks vs. stimulus presentations vs. rewards) in separate ``EventsTable``
400+
instances within ``/events``. APIs may provide helpers to merge tables across
401+
sources for downstream analysis.
401402

402403

403404
Tables and ragged arrays

docs/format/source/format_release_notes.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ Release Notes
88

99
Major changes
1010
^^^^^^^^^^^^^
11-
- Implemented NWBEP001 -- Added new neurodata types ``EventsTable``, ``TimestampVectorData``, and ``DurationVectorData``.
11+
- Implemented NWBEP001 -- Added new neurodata types ``EventsTable``, ``TimestampVectorData``, and ``DurationVectorData``. (#645)
1212
- Incorporated HDMF Common Schema 1.9.0 which added new data types ``MeaningsTable`` and support for ``MeaningsTable`` in ``DynamicTable``.
13-
- Added support for an optional ``HERD`` object at ``/general/external_resources``.
14-
- Deprecated ``BehavioralEvents`` in favor of placing ``EventsTable`` tables in ``NWBFile/events``.
15-
Each ``TimeSeries`` formerly stored under ``BehavioralEvents`` becomes one ``EventsTable``: the
16-
``timestamps`` field maps to the ``timestamp`` column, and any per-event metadata becomes
17-
additional columns. See the schema docs FAQ for guidance on choosing between ``/events/``,
18-
``/acquisition/``, ``/processing/``, and ``/analysis/``.
19-
- Deprecated ``AnnotationSeries`` in favor of creating an ``EventsTable`` with an ``annotation``
20-
column. The ``timestamps`` field maps to the ``timestamp`` column, and the ``data`` field
21-
(annotation strings) maps to the new ``annotation`` column. Event markers from acquisition systems
22-
that were previously stored as ``AnnotationSeries`` typically belong in ``/acquisition/`` rather
23-
than ``/events/``.
13+
- Added support for an optional ``HERD`` object at ``/general/external_resources``. (#646)
14+
- Deprecated ``BehavioralEvents`` and ``AnnotationSeries`` in favor of ``EventsTable``. All
15+
``EventsTable`` instances for a session belong in the top-level ``/events`` group of the
16+
``NWBFile``, regardless of provenance; the optional ``source_description`` attribute on each
17+
table captures where the events came from (e.g., ``"Acquisition system"``, ``"Thresholding of
18+
analog signal ANALOG1 at 3 V"``, ``"Manual video review"``). For ``BehavioralEvents``:
19+
each ``TimeSeries`` formerly stored under ``BehavioralEvents`` becomes one ``EventsTable``,
20+
with ``timestamps`` mapping to the ``timestamp`` column and any per-event metadata mapping
21+
to additional columns. For ``AnnotationSeries``: ``timestamps`` maps to the ``timestamp``
22+
column and ``data`` (annotation strings) maps to the new ``annotation`` column. See the
23+
schema docs FAQ for details. (#688, #690)
2424

2525
Minor changes
2626
^^^^^^^^^^^^^

0 commit comments

Comments
 (0)