Skip to content

Commit 46cd887

Browse files
committed
Merge branch 'master' of https://github.com/NeuralEnsemble/python-neo into spikegadgets_implementation
2 parents b02a1b8 + ca35743 commit 46cd887

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2935
-5540
lines changed

.github/workflows/full-test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ name: neo.io and neo.rawio tests
22

33
on:
44
pull_request:
5-
branches: [master, gh_actions_and_datalad]
5+
branches: [master]
66
types: [synchronize, opened, reopened, ready_for_review]
77

8+
# run checks on any change of master, including merge of PRs
9+
push:
10+
branches: [master]
11+
812
jobs:
913
build-and-test:
1014
name: Test on (${{ matrix.os }})

README.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@ Code status
3333

3434
.. image:: https://travis-ci.org/NeuralEnsemble/python-neo.png?branch=master
3535
:target: https://travis-ci.org/NeuralEnsemble/python-neo
36-
:alt: Unit Test Status (TravisCI)
37-
.. image:: https://circleci.com/gh/NeuralEnsemble/python-neo.svg?style=svg
38-
:target: https://circleci.com/gh/NeuralEnsemble/python-neo
39-
:alt: Unit Test Status (CircleCI)
36+
:alt: Core Unit Test Status (TravisCI)
37+
.. image:: https://github.com/NeuralEnsemble/python-neo/actions/workflows/full-test.yml/badge.svg?event=push&branch=master
38+
:target: https://github.com/NeuralEnsemble/python-neo/actions?query=event%3Apush+branch%3Amaster
39+
:alt: IO Unit Test Status (Github Actions)
4040
.. image:: https://coveralls.io/repos/NeuralEnsemble/python-neo/badge.png
4141
:target: https://coveralls.io/r/NeuralEnsemble/python-neo
4242
:alt: Unit Test Coverage
43-
.. image:: https://requires.io/github/NeuralEnsemble/python-neo/requirements.png?branch=master
44-
:target: https://requires.io/github/NeuralEnsemble/python-neo/requirements/?branch=master
45-
:alt: Requirements Status
4643

4744
More information
4845
----------------

neo/converter.py

Lines changed: 0 additions & 90 deletions
This file was deleted.

neo/core/__init__.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,10 @@
2828
.. autoclass:: CircularRegionOfInterest
2929
.. autoclass:: PolygonRegionOfInterest
3030
31-
Deprecated classes:
32-
33-
.. autoclass:: ChannelIndex
34-
.. autoclass:: Unit
35-
3631
"""
3732

3833
from neo.core.block import Block
3934
from neo.core.segment import Segment
40-
from neo.core.channelindex import ChannelIndex
41-
from neo.core.unit import Unit
42-
4335
from neo.core.analogsignal import AnalogSignal
4436
from neo.core.irregularlysampledsignal import IrregularlySampledSignal
4537

@@ -55,9 +47,9 @@
5547
from neo.core.group import Group
5648

5749
# Block should always be first in this list
58-
objectlist = [Block, Segment, ChannelIndex,
50+
objectlist = [Block, Segment,
5951
AnalogSignal, IrregularlySampledSignal,
60-
Event, Epoch, Unit, SpikeTrain, ImageSequence,
52+
Event, Epoch, SpikeTrain, ImageSequence,
6153
RectangularRegionOfInterest, CircularRegionOfInterest,
6254
PolygonRegionOfInterest, ChannelView, Group]
6355

neo/core/analogsignal.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _get_sampling_rate(sampling_rate, sampling_period):
5858
def _new_AnalogSignalArray(cls, signal, units=None, dtype=None, copy=True, t_start=0 * pq.s,
5959
sampling_rate=None, sampling_period=None, name=None, file_origin=None,
6060
description=None, array_annotations=None, annotations=None,
61-
channel_index=None, segment=None):
61+
segment=None):
6262
'''
6363
A function to map AnalogSignal.__new__ to function that
6464
does not do the unit checking. This is needed for pickle to work.
@@ -68,7 +68,6 @@ def _new_AnalogSignalArray(cls, signal, units=None, dtype=None, copy=True, t_sta
6868
sampling_period=sampling_period, name=name,
6969
file_origin=file_origin, description=description,
7070
array_annotations=array_annotations, **annotations)
71-
obj.channel_index = channel_index
7271
obj.segment = segment
7372
return obj
7473

@@ -140,9 +139,6 @@ class AnalogSignal(BaseSignal):
140139
:times: (quantity 1D) The time points of each sample of the signal,
141140
read-only.
142141
(:attr:`t_start` + arange(:attr:`shape`[0])/:attr:`sampling_rate`)
143-
:channel_index:
144-
(deprecated) access to the channel_index attribute of the principal ChannelIndex
145-
associated with this signal.
146142
147143
*Slicing*:
148144
:class:`AnalogSignal` objects can be sliced. When taking a single
@@ -160,8 +156,8 @@ class AnalogSignal(BaseSignal):
160156
161157
'''
162158

163-
_parent_objects = ('Segment', 'ChannelIndex')
164-
_parent_attrs = ('segment', 'channel_index')
159+
_parent_objects = ('Segment',)
160+
_parent_attrs = ('segment',)
165161
_quantity_attr = 'signal'
166162
_necessary_attrs = (('signal', pq.Quantity, 2),
167163
('sampling_rate', pq.Quantity, 0),
@@ -192,7 +188,6 @@ def __new__(cls, signal, units=None, dtype=None, copy=True, t_start=0 * pq.s,
192188
obj._sampling_rate = _get_sampling_rate(sampling_rate, sampling_period)
193189

194190
obj.segment = None
195-
obj.channel_index = None
196191
return obj
197192

198193
def __init__(self, signal, units=None, dtype=None, copy=True, t_start=0 * pq.s,
@@ -220,7 +215,7 @@ def __reduce__(self):
220215
True, self.t_start, self.sampling_rate,
221216
self.sampling_period, self.name, self.file_origin,
222217
self.description, self.array_annotations,
223-
self.annotations, self.channel_index, self.segment)
218+
self.annotations, self.segment)
224219

225220
def _array_finalize_spec(self, obj):
226221
'''
@@ -244,14 +239,6 @@ def __repr__(self):
244239
self.t_start, self.t_stop,
245240
self.sampling_rate))
246241

247-
def get_channel_index(self):
248-
"""
249-
"""
250-
if self.channel_index:
251-
return self.channel_index.index
252-
else:
253-
return None
254-
255242
def __getitem__(self, i):
256243
'''
257244
Get the item or slice :attr:`i`.
@@ -278,8 +265,6 @@ def __getitem__(self, i):
278265
raise TypeError("%s not supported" % type(j))
279266
if isinstance(k, (int, np.integer)):
280267
obj = obj.reshape(-1, 1)
281-
if self.channel_index:
282-
obj.channel_index = self.channel_index.__getitem__(k)
283268
obj.array_annotate(**deepcopy(self.array_annotations_at_index(k)))
284269
elif isinstance(i, slice):
285270
obj = super().__getitem__(i)
@@ -448,7 +433,7 @@ def _pp(line):
448433
def time_index(self, t):
449434
"""Return the array index (or indices) corresponding to the time (or times) `t`"""
450435
i = (t - self.t_start) * self.sampling_rate
451-
i = np.rint(i.simplified.magnitude).astype(np.int)
436+
i = np.rint(i.simplified.magnitude).astype(np.int64)
452437
return i
453438

454439
def time_slice(self, t_start, t_stop):
@@ -534,7 +519,6 @@ def splice(self, signal, copy=False):
534519
if copy:
535520
new_signal = deepcopy(self)
536521
new_signal.segment = None
537-
new_signal.channel_index = None
538522
new_signal[i:j, :] = signal
539523
return new_signal
540524
else:

neo/core/baseneo.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ def _reference_name(class_name):
144144
`segment.block`. The attribute name `block` is obtained by calling
145145
`_container_name("Block")`.
146146
"""
147-
name_map = {
148-
"ChannelIndex": "channel_index"
149-
}
150-
return name_map.get(class_name, class_name.lower())
147+
return class_name.lower()
151148

152149

153150
def _container_name(class_name):
@@ -159,10 +156,7 @@ def _container_name(class_name):
159156
referenced by `block.segments`. The attribute name `segments` is
160157
obtained by calling `_container_name_plural("Segment")`.
161158
"""
162-
name_map = {
163-
"ChannelIndex": "channel_indexes"
164-
}
165-
return name_map.get(class_name, _reference_name(class_name) + 's')
159+
return _reference_name(class_name) + 's'
166160

167161

168162
class BaseNeo:

neo/core/basesignal.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
from neo.core.baseneo import MergeError, merge_annotations
2525
from neo.core.dataobject import DataObject, ArrayDict
26-
from neo.core.channelindex import ChannelIndex
2726

2827
logger = logging.getLogger("Neo")
2928

@@ -80,7 +79,6 @@ def __array_finalize__(self, obj):
8079

8180
# Parent objects
8281
self.segment = getattr(obj, 'segment', None)
83-
self.channel_index = getattr(obj, 'channel_index', None)
8482

8583
@classmethod
8684
def _rescale(self, signal, units=None):
@@ -100,11 +98,6 @@ def _rescale(self, signal, units=None):
10098
signal = signal.rescale(units)
10199
return signal
102100

103-
def rescale(self, units):
104-
obj = super().rescale(units)
105-
obj.channel_index = self.channel_index
106-
return obj
107-
108101
def __getslice__(self, i, j):
109102
'''
110103
Get a slice from :attr:`i` to :attr:`j`.attr[0]
@@ -279,18 +272,6 @@ def merge(self, other):
279272
if hasattr(self, "lazy_shape"):
280273
signal.lazy_shape = merged_lazy_shape
281274

282-
# merge channel_index (move to ChannelIndex.merge()?)
283-
if self.channel_index and other.channel_index:
284-
signal.channel_index = ChannelIndex(index=np.arange(signal.shape[1]),
285-
channel_ids=np.hstack(
286-
[self.channel_index.channel_ids,
287-
other.channel_index.channel_ids]),
288-
channel_names=np.hstack(
289-
[self.channel_index.channel_names,
290-
other.channel_index.channel_names]))
291-
else:
292-
signal.channel_index = ChannelIndex(index=np.arange(signal.shape[1]))
293-
294275
return signal
295276

296277
def time_slice(self, t_start, t_stop):

neo/core/block.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,17 @@ class Block(Container):
5454
data file.
5555
:rec_datetime: (datetime) The date and time of the original recording.
5656
57-
*Properties available on this object*:
58-
:list_units: (deprecated) descends through hierarchy and returns a list of
59-
:class:`Unit` objects existing in the block. This shortcut exists
60-
because a common analysis case is analyzing all neurons that
61-
you recorded in a session.
62-
6357
Note: Any other additional arguments are assumed to be user-specific
6458
metadata and stored in :attr:`annotations`.
6559
6660
*Container of*:
6761
:class:`Segment`
6862
:class:`Group`
69-
:class:`ChannelIndex` (deprecated)
7063
7164
'''
7265

73-
_container_child_objects = ('Segment', 'ChannelIndex', 'Group')
74-
_child_properties = ('Unit',)
66+
_container_child_objects = ('Segment', 'Group')
67+
_child_properties = ()
7568
_recommended_attrs = ((('file_datetime', datetime),
7669
('rec_datetime', datetime),
7770
('index', int)) +
@@ -104,7 +97,7 @@ def data_children_recur(self):
10497
obtained recursively.
10598
'''
10699
# subclassing this to remove duplicate objects such as SpikeTrain
107-
# objects in both Segment and Unit
100+
# objects in both Segment and Group
108101
# Only Block can have duplicate items right now, so implement
109102
# this here for performance reasons.
110103
return tuple(unique_objs(super().data_children_recur))
@@ -117,14 +110,7 @@ def list_children_by_class(self, cls):
117110
or the name of the container storing the class.
118111
'''
119112
# subclassing this to remove duplicate objects such as SpikeTrain
120-
# objects in both Segment and Unit
113+
# objects in both Segment and Group
121114
# Only Block can have duplicate items right now, so implement
122115
# this here for performance reasons.
123116
return unique_objs(super().list_children_by_class(cls))
124-
125-
@property
126-
def list_units(self):
127-
'''
128-
Return a list of all :class:`Unit` objects in the :class:`Block`.
129-
'''
130-
return self.list_children_by_class('unit')

0 commit comments

Comments
 (0)