From 3d9b22e64fa39d9cac68a4caf3425605a27d6246 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:09:02 -0800 Subject: [PATCH] add AnnotationSeries example to docs --- docs/gallery/general/plot_file.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/gallery/general/plot_file.py b/docs/gallery/general/plot_file.py index b410d4b69..d80db10ac 100644 --- a/docs/gallery/general/plot_file.py +++ b/docs/gallery/general/plot_file.py @@ -131,6 +131,7 @@ from pynwb import NWBHDF5IO, NWBFile, TimeSeries from pynwb.behavior import Position, SpatialSeries from pynwb.file import Subject +from pynwb.misc import AnnotationSeries #################### # .. _basics_nwbfile: @@ -285,6 +286,27 @@ # or using the method :py:meth:`.NWBFile.get_acquisition`: nwbfile.get_acquisition("test_timeseries") +#################### +# Other Types of Time Series +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# As mentioned previously, there are many subtypes of :py:class:`~pynwb.base.TimeSeries` that are used to store +# different kinds of data. One example is :py:class:`~pynwb.misc.AnnotationSeries`, a subclass of +# :py:class:`~pynwb.base.TimeSeries` that stores text-based records about the experiment. Similarly to our +# :py:class:`~pynwb.base.TimeSeries` example above, we can create an :py:class:`~pynwb.misc.AnnotationSeries` +# object with text information about a stimulus and add it to the stimulus group in +# the :py:class:`~pynwb.file.NWBFile`. + +annotations = AnnotationSeries(name='airpuffs', + data=['Left Airpuff', 'Right Airpuff', 'Right Airpuff'], + description='Airpuff events delivered to the animal', + timestamps=[1.0, 3.0, 8.0]) + +nwbfile.add_stimulus(annotations) + +#################### +# This approach of creating a :py:class:`~pynwb.base.TimeSeries` object and adding it to the appropriate +# :py:class:`~pynwb.file.NWBFile` group can be used for all subtypes of :py:class:`~pynwb.base.TimeSeries` data. #################### # .. _basic_spatialseries: