Skip to content

Commit 969c65f

Browse files
authored
add AnnotationSeries example to docs (#1989)
* add AnnotationSeries example to docs * update CHANGELOG
1 parent 9de4d4c commit 969c65f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
### Documentation and tutorial enhancements
99
- Added documentation example for `SpikeEventSeries`. @stephprince [#1983](https://github.com/NeurodataWithoutBorders/pynwb/pull/1983)
10+
- Added documentation example for `AnnotationSeries`. @stephprince [#1989](https://github.com/NeurodataWithoutBorders/pynwb/pull/1989)
1011

1112
### Performance
1213
- Cache global type map to speed import 3X. @sneakers-the-rat [#1931](https://github.com/NeurodataWithoutBorders/pynwb/pull/1931)

docs/gallery/general/plot_file.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
from pynwb import NWBHDF5IO, NWBFile, TimeSeries
132132
from pynwb.behavior import Position, SpatialSeries
133133
from pynwb.file import Subject
134+
from pynwb.misc import AnnotationSeries
134135

135136
####################
136137
# .. _basics_nwbfile:
@@ -285,6 +286,27 @@
285286
# or using the method :py:meth:`.NWBFile.get_acquisition`:
286287
nwbfile.get_acquisition("test_timeseries")
287288

289+
####################
290+
# Other Types of Time Series
291+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^
292+
#
293+
# As mentioned previously, there are many subtypes of :py:class:`~pynwb.base.TimeSeries` that are used to store
294+
# different kinds of data. One example is :py:class:`~pynwb.misc.AnnotationSeries`, a subclass of
295+
# :py:class:`~pynwb.base.TimeSeries` that stores text-based records about the experiment. Similarly to our
296+
# :py:class:`~pynwb.base.TimeSeries` example above, we can create an :py:class:`~pynwb.misc.AnnotationSeries`
297+
# object with text information about a stimulus and add it to the stimulus group in
298+
# the :py:class:`~pynwb.file.NWBFile`.
299+
300+
annotations = AnnotationSeries(name='airpuffs',
301+
data=['Left Airpuff', 'Right Airpuff', 'Right Airpuff'],
302+
description='Airpuff events delivered to the animal',
303+
timestamps=[1.0, 3.0, 8.0])
304+
305+
nwbfile.add_stimulus(annotations)
306+
307+
####################
308+
# This approach of creating a :py:class:`~pynwb.base.TimeSeries` object and adding it to the appropriate
309+
# :py:class:`~pynwb.file.NWBFile` group can be used for all subtypes of :py:class:`~pynwb.base.TimeSeries` data.
288310

289311
####################
290312
# .. _basic_spatialseries:

0 commit comments

Comments
 (0)