Skip to content
Merged
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
4 changes: 0 additions & 4 deletions doc/old_stuffs/grouping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Using :class:`ChannelIndex`::

block = Block()
segment = Segment()
segment.block = block
block.segments.append(segment)

for i in (0, 1):
Expand All @@ -55,7 +54,6 @@ Using array annotations, we annotate the channels of the :class:`AnalogSignal` d

block = Block()
segment = Segment()
segment.block = block
block.segments.append(segment)

for i in (0, 1):
Expand All @@ -77,7 +75,6 @@ Each :class:`ChannelIndex` also contains the list of channels on which that neur

block = Block(name="probe data")
segment = Segment()
segment.block = block
block.segments.append(segment)

# create 4-channel AnalogSignal with dummy data
Expand Down Expand Up @@ -119,7 +116,6 @@ Using :class:`ChannelView` and :class:`Group`::

block = Block(name="probe data")
segment = Segment()
segment.block = block
block.segments.append(segment)

# create 4-channel AnalogSignal with dummy data
Expand Down
1 change: 0 additions & 1 deletion doc/old_stuffs/io_developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Miscellaneous
=============

* If your IO supports several versions of a format (like ABF1, ABF2), upload to the gin.g-node.org test file repository all file versions possible. (for test coverage).
* :py:func:`neo.core.Block.create_many_to_one_relationship` offers a utility to complete the hierarchy when all one-to-many relationships have been created.
* In the docstring, explain where you obtained the file format specification if it is a closed one.
* If your IO is based on a database mapper, keep in mind that the returned object MUST be detached,
because this object can be written to another url for copying.
Expand Down
15 changes: 1 addition & 14 deletions doc/source/images/generate_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def get_rect_height(name, obj):
nlines = 1.5
nlines += len(getattr(obj, '_all_attrs', []))
nlines += len(getattr(obj, '_single_child_objects', []))
nlines += len(getattr(obj, '_multi_child_objects', []))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is currently not running due to some imports not being present. I think it would help to also include the generated diagram to understand the structural changes here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apdavison : do you plan to tedisouly also fix the diagram generator or will we fix this later ?

return nlines * line_heigth


Expand Down Expand Up @@ -74,9 +73,7 @@ def generate_diagram(rect_pos, rect_width, figsize):
alpha = [1., 1., 0.3]
for name, pos in rect_pos.items():
obj = objs[name]
relationships = [getattr(obj, '_single_child_objects', []),
getattr(obj, '_multi_child_objects', []),
getattr(obj, '_child_properties', [])]
relationships = [getattr(obj, '_single_child_objects', [])]

for r in range(3):
for ch_name in relationships[r]:
Expand Down Expand Up @@ -122,16 +119,6 @@ def generate_diagram(rect_pos, rect_width, figsize):
facecolor='c', edgecolor='k', alpha=.5)
ax.add_patch(rect)

# multi relationship
relationship = list(getattr(obj, '_multi_child_objects', []))
pos2 = (pos[1] + htotal - line_heigth * (1.5 + len(relationship))
- rect_height)
rect_height = len(relationship) * line_heigth

rect = Rectangle((pos[0], pos2), rect_width, rect_height,
facecolor='m', edgecolor='k', alpha=.5)
ax.add_patch(rect)

# necessary attr
pos2 = (pos[1] + htotal
- line_heigth * (1.5 + len(allrelationship) + len(obj._necessary_attrs)))
Expand Down
4 changes: 0 additions & 4 deletions doc/source/scripts/multi_tetrode_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

# Create dummy data, one segment at a time
for segment in block.segments:
segment.block = block

# create two 4-channel AnalogSignals with dummy data
signals = {
Expand All @@ -46,8 +45,6 @@
}
if store_signals:
segment.analogsignals.extend(signals.values())
for signal in signals:
signal.segment = segment

# create spike trains with dummy data
# we will pretend the spikes have been extracted from the dummy signal
Expand All @@ -56,7 +53,6 @@
spiketrain = SpikeTrain(np.random.uniform(0, 100, size=30) * ms, t_stop=100 * ms)
# assign each spiketrain to the appropriate segment
segment.spiketrains.append(spiketrain)
spiketrain.segment = segment
# assign each spiketrain to a given neuron
current_group = next(iter_group)
current_group.add(spiketrain)
Expand Down
1 change: 0 additions & 1 deletion examples/generated_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def generate_block(n_segments=3, n_channels=4, n_units=3,
seg.spiketrains.append(train)
u.spiketrains.append(train)

block.create_many_to_one_relationship()
return block


Expand Down
29 changes: 25 additions & 4 deletions neo/core/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from datetime import datetime

from neo.core.container import Container, unique_objs
from neo.core.group import Group
from neo.core.objectlist import ObjectList
from neo.core.regionofinterest import RegionOfInterest
from neo.core.segment import Segment


class Block(Container):
Expand Down Expand Up @@ -64,7 +68,6 @@ class Block(Container):
'''

_container_child_objects = ('Segment', 'Group')
_child_properties = ()
_recommended_attrs = ((('file_datetime', datetime),
('rec_datetime', datetime),
('index', int)) +
Expand All @@ -86,9 +89,27 @@ def __init__(self, name=None, description=None, file_origin=None,
self.file_datetime = file_datetime
self.rec_datetime = rec_datetime
self.index = index
self.regionsofinterest = [] # temporary workaround.
# the goal is to store all sub-classes of RegionOfInterest in a single list
# but this will need substantial changes to container handling
self._segments = ObjectList(Segment, parent=self)
self._groups = ObjectList(Group, parent=self)
self._regionsofinterest = ObjectList(RegionOfInterest, parent=self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should regions of interest really be linked to a block and not a handled on the same level as a view?


segments = property(
fget=lambda self: self._get_object_list("_segments"),
fset=lambda self, value: self._set_object_list("_segments", value),
doc="list of Segments contained in this block"
)

groups = property(
fget=lambda self: self._get_object_list("_groups"),
fset=lambda self, value: self._set_object_list("_groups", value),
doc="list of Groups contained in this block"
)

regionsofinterest = property(
fget=lambda self: self._get_object_list("_regionsofinterest"),
fset=lambda self, value: self._set_object_list("_regionsofinterest", value),
doc="list of RegionOfInterest objects contained in this block"
)

@property
def data_children_recur(self):
Expand Down
Loading