-
Notifications
You must be signed in to change notification settings - Fork 84
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
[WIP] Add changes to facilitate lookup of SpikeEventSeries from Units table #819
Open
bendichter
wants to merge
2
commits into
dev
Choose a base branch
from
enh/unit_time_series
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
from .base import TimeSeries, _default_resolution, _default_conversion | ||
from .core import NWBContainer, NWBDataInterface, MultiContainerInterface, DynamicTableRegion | ||
from .device import Device | ||
from .misc import DecompositionSeries | ||
|
||
|
||
@register_class('ElectrodeGroup', CORE_NAMESPACE) | ||
|
@@ -19,20 +18,25 @@ class ElectrodeGroup(NWBContainer): | |
__nwbfields__ = ('name', | ||
'description', | ||
'location', | ||
'device') | ||
'device', | ||
{'name': 'spike_event_series', 'child': False, 'doc': 'doc'}) | ||
|
||
@docval({'name': 'name', 'type': str, 'doc': 'the name of this electrode'}, | ||
{'name': 'description', 'type': str, 'doc': 'description of this electrode group'}, | ||
{'name': 'location', 'type': str, 'doc': 'description of location of this electrode group'}, | ||
{'name': 'device', 'type': Device, 'doc': 'the device that was used to record from this electrode group'}, | ||
{'name': 'spike_event_series', 'type': 'SpikeEventSeries', | ||
'doc': 'SpikeEventSeries recorded from this group', 'default': None}, | ||
{'name': 'parent', 'type': 'NWBContainer', | ||
'doc': 'The parent NWBContainer for this NWBContainer', 'default': None}) | ||
def __init__(self, **kwargs): | ||
call_docval_func(super(ElectrodeGroup, self).__init__, kwargs) | ||
description, location, device = popargs("description", "location", "device", kwargs) | ||
description, location, device, spike_event_series = popargs("description", "location", "device", | ||
'spike_event_series', kwargs) | ||
self.description = description | ||
self.location = location | ||
self.device = device | ||
self.spike_event_series = spike_event_series | ||
|
||
|
||
_et_docval = [ | ||
|
@@ -58,14 +62,16 @@ class ElectricalSeries(TimeSeries): | |
""" | ||
|
||
__nwbfields__ = ({'name': 'electrodes', 'required_name': 'electrodes', | ||
'doc': 'the electrodes that generated this electrical series', 'child': True},) | ||
'doc': 'the electrodes that generated this electrical series', 'child': True}, | ||
{'name': 'electrode_group', | ||
'doc': 'the electrode group that generated this electrical series', 'child': False}) | ||
|
||
__help = "Stores acquired voltage data from extracellular recordings." | ||
|
||
@docval({'name': 'name', 'type': str, 'doc': 'The name of this TimeSeries dataset'}, | ||
{'name': 'data', 'type': ('array_data', 'data', TimeSeries), 'shape': ((None, ), (None, None)), | ||
{'name': 'data', 'type': ('array_data', 'data', TimeSeries), | ||
'shape': ((None,), (None, None), (None, None, None)), | ||
'doc': 'The data this TimeSeries dataset stores. Can also store binary data e.g. image frames'}, | ||
|
||
{'name': 'electrodes', 'type': DynamicTableRegion, | ||
'doc': 'the table region corresponding to the electrodes from which this series was recorded'}, | ||
{'name': 'resolution', 'type': float, | ||
|
@@ -107,7 +113,7 @@ class SpikeEventSeries(ElectricalSeries): | |
electrode). | ||
""" | ||
|
||
__nwbfields__ = () | ||
__nwbfields__ = ({'name': 'unit_series', 'child': False, 'doc': 'doc'}, ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
__help = "Snapshots of spike events from data." | ||
|
||
|
@@ -116,13 +122,15 @@ class SpikeEventSeries(ElectricalSeries): | |
'doc': 'The data this TimeSeries dataset stores. Can also store binary data e.g. image frames'}, | ||
{'name': 'timestamps', 'type': ('array_data', 'data', TimeSeries), | ||
'doc': 'Timestamps for samples stored in data'}, | ||
{'name': 'unit_series', 'type': 'UnitSeries', 'doc': 'unit times that link waveforms to units table', | ||
'default': None}, | ||
{'name': 'electrodes', 'type': DynamicTableRegion, | ||
'doc': 'the table region corresponding to the electrodes from which this series was recorded'}, | ||
{'name': 'resolution', 'type': float, | ||
'doc': 'The smallest meaningful difference (in specified unit) between values in data', | ||
'default': _default_resolution}, | ||
{'name': 'conversion', 'type': float, | ||
'doc': 'Scalar to multiply each element by to conver to volts', 'default': _default_conversion}, | ||
'doc': 'Scalar to multiply each element by to convert to volts', 'default': _default_conversion}, | ||
{'name': 'comments', 'type': str, | ||
'doc': 'Human-readable comments about this TimeSeries dataset', 'default': 'no comments'}, | ||
{'name': 'description', 'type': str, | ||
|
@@ -134,7 +142,7 @@ class SpikeEventSeries(ElectricalSeries): | |
{'name': 'parent', 'type': 'NWBContainer', | ||
'doc': 'The parent NWBContainer for this NWBContainer', 'default': None}) | ||
def __init__(self, **kwargs): | ||
name, data, electrodes = popargs('name', 'data', 'electrodes', kwargs) | ||
name, data, unit_series = popargs('name', 'data', 'unit_series', kwargs) | ||
timestamps = getargs('timestamps', kwargs) | ||
if not (isinstance(data, TimeSeries) and isinstance(timestamps, TimeSeries)): | ||
if not (isinstance(data, DataChunkIterator) and isinstance(timestamps, DataChunkIterator)): | ||
|
@@ -143,7 +151,8 @@ def __init__(self, **kwargs): | |
else: | ||
# TODO: add check when we have DataChunkIterators | ||
pass | ||
super(SpikeEventSeries, self).__init__(name, data, electrodes, **kwargs) | ||
super(SpikeEventSeries, self).__init__(name, data, **kwargs) | ||
self.unit_series = unit_series | ||
|
||
|
||
@register_class('EventDetection', CORE_NAMESPACE) | ||
|
@@ -295,13 +304,7 @@ class LFP(MultiContainerInterface): | |
'type': ElectricalSeries, | ||
'add': 'add_electrical_series', | ||
'get': 'get_electrical_series', | ||
'create': 'create_electrical_series'}, | ||
|
||
{'attr': 'decomposition_series', | ||
'type': DecompositionSeries, | ||
'add': 'add_decomposition_series', | ||
'get': 'get_decomposition_series', | ||
'create': 'create_decomposition_series'}] | ||
'create': 'create_electrical_series'}] | ||
|
||
__help = ("LFP data from one or more channels. Filter properties " | ||
"should be noted in the ElectricalSeries") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an ElectricalSeries, and doc should be something that makes sense. The docstring will get rendered on the API docs, so this is what users will see if they use the API docs for reference.