Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate EventWaveform class #1940

Draft
wants to merge 3 commits into
base: nwb_schema_2.8.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/gallery/domain/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@
# :py:class:`~pynwb.ecephys.ElectricalSeries` objects as :ref:`acquisition <basic_timeseries>` data, and use
# the :py:class:`~pynwb.ecephys.EventDetection` class for identifying the spike events in your raw traces.
# If you do not want to store the raw voltage traces and only the waveform 'snippets' surrounding spike events,
# you should use the :py:class:`~pynwb.ecephys.EventWaveform` class, which can store one or more
# :py:class:`~pynwb.ecephys.SpikeEventSeries` objects.
# you should store the snippets with :py:class:`~pynwb.ecephys.SpikeEventSeries` objects.
#
# The results of spike sorting (or clustering) should be stored in the top-level :py:class:`~pynwb.misc.Units` table.
# Note that it is not required to store spike waveforms in order to store spike events or mean waveforms--if you only
Expand Down
4 changes: 1 addition & 3 deletions docs/gallery/general/plot_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
:py:class:`~pynwb.behavior.EyeTracking`.

* **Extracellular electrophysiology:** :py:class:`~pynwb.ecephys.EventDetection`,
:py:class:`~pynwb.ecephys.EventWaveform`,
:py:class:`~pynwb.ecephys.FeatureExtraction`,
:py:class:`~pynwb.ecephys.FilteredEphys`,
:py:class:`~pynwb.ecephys.LFP`.
Expand Down Expand Up @@ -571,8 +570,7 @@

####################
# .. [#] Some data interface objects have a default name. This default name is the type of the data interface. For
# example, the default name for :py:class:`~pynwb.ophys.ImageSegmentation` is "ImageSegmentation" and the default
# name for :py:class:`~pynwb.ecephys.EventWaveform` is "EventWaveform".
# example, the default name for :py:class:`~pynwb.ophys.ImageSegmentation` is "ImageSegmentation".
#
# .. [#] HDF5 is the primary backend supported by NWB.
#
Expand Down
11 changes: 9 additions & 2 deletions src/pynwb/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ class SpikeEventSeries(ElectricalSeries):
"""
Stores "snapshots" of spike events (i.e., threshold crossings) in data. This may also be raw data,
as reported by ephys hardware. If so, the TimeSeries::description field should describing how
events were detected. All SpikeEventSeries should reside in a module (under EventWaveform
interface) even if the spikes were reported and stored by hardware. All events span the same
events were detected. All events span the same
recording channels and store snapshots of equal duration. TimeSeries::data array structure:
[num events] [num channels] [num samples] (or [num events] [num samples] for single
electrode).
Expand Down Expand Up @@ -162,6 +161,7 @@ def __init__(self, **kwargs):
@register_class('EventWaveform', CORE_NAMESPACE)
class EventWaveform(MultiContainerInterface):
"""
DEPRECATED as of NWB 2.8.0 and PyNWB 3.0.0.
Spike data for spike events detected in raw data
stored in this NWBFile, or events detect at acquisition
"""
Expand All @@ -174,6 +174,13 @@ class EventWaveform(MultiContainerInterface):
'create': 'create_spike_event_series'
}

def __init__(self, **kwargs):
if not self._in_construct_mode:
raise ValueError(
"The EventWaveform neurodata type is deprecated. If you are interested in using it, "
"please create an issue on https://github.com/NeurodataWithoutBorders/nwb-schema/issues."
)


@register_class('Clustering', CORE_NAMESPACE)
class Clustering(NWBDataInterface):
Expand Down
11 changes: 4 additions & 7 deletions tests/integration/hdf5/test_ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
Clustering,
ClusterWaveforms,
SpikeEventSeries,
EventWaveform,
EventDetection,
FeatureExtraction,
)
Expand Down Expand Up @@ -184,7 +183,7 @@ def roundtripExportContainer(self, cache_spec=False):
return super().roundtripExportContainer(cache_spec)


class EventWaveformConstructor(NWBH5IOFlexMixin, TestCase):
class SpikeEventSeriesConstructor(NWBH5IOFlexMixin, TestCase):

def getContainerType(self):
return "SpikeEventSeries"
Expand All @@ -201,18 +200,16 @@ def addContainer(self):
description='the first and third electrodes',
table=table)
ses = SpikeEventSeries(
name='test_sES',
name='SpikeEventSeries',
data=((1, 1), (2, 2), (3, 3)),
timestamps=[0., 1., 2.],
electrodes=region
)

ew = EventWaveform()
self.nwbfile.add_acquisition(ew)
ew.add_spike_event_series(ses)
self.nwbfile.add_acquisition(ses)

def getContainer(self, nwbfile: NWBFile):
return nwbfile.acquisition['EventWaveform']
return nwbfile.acquisition['SpikeEventSeries']


class ClusterWaveformsConstructor(AcquisitionH5IOMixin, TestCase):
Expand Down
22 changes: 2 additions & 20 deletions tests/unit/test_ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,9 @@ def test_init(self):

class EventWaveformConstructor(TestCase):

def _create_table_and_region(self):
table = make_electrode_table()
region = DynamicTableRegion(
name='electrodes',
data=[0, 2],
description='the first and third electrodes',
table=table
)
return table, region

def test_init(self):
table, region = self._create_table_and_region()
sES = SpikeEventSeries('test_sES', list(range(10)), list(range(10)), region)

pm = ProcessingModule(name='test_module', description='a test module')
ew = EventWaveform()
pm.add(table)
pm.add(ew)
ew.add_spike_event_series(sES)
self.assertEqual(ew.spike_event_series['test_sES'], sES)
self.assertEqual(ew['test_sES'], ew.spike_event_series['test_sES'])
with self.assertRaises(ValueError):
EventWaveform()


class ClusteringConstructor(TestCase):
Expand Down
Loading