Fixing and optimizing network methods
@@ -51,8 +51,11 @@ class Network(DataObject):
set(['VB4', 'PDEL', 'HSNL', 'SIBDR', ... 'RIAL', 'MCR', 'LUAL'])
"""
- for x in self.neurons():
- yield x.name()
+ n = P.Neuron()
+ self.neuron.set(n)
+ res = n.name.get()
+ self.neuron.unset(n)
+ return res
def aneuron(self, name):
"""
@@ -104,12 +107,13 @@ class Network(DataObject):
:rtype: iter(Neuron)
"""
- # TODO: make sure these belong to *this* Network
n = P.Neuron()
n.type('sensory')
- for x in n.load():
- yield x
+ self.neuron.set(n)
+ res = list(n.load())
+ self.neuron.unset(n)
+ return res
def interneurons(self):
"""
@@ -119,12 +123,13 @@ class Network(DataObject):
:rtype: iter(Neuron)
"""
- # TODO: make sure these belong to *this* Network
n = P.Neuron()
n.type('interneuron')
- for x in n.load():
- yield x
+ self.neuron.set(n)
+ res = list(n.load())
+ self.neuron.unset(n)
+ return res
def motor(self):
"""
@@ -134,12 +139,13 @@ class Network(DataObject):
:rtype: iter(Neuron)
"""
- # TODO: make sure these belong to *this* Network
n = P.Neuron()
n.type('motor')
- for x in n.load():
- yield x
+ self.neuron.set(n)
+ res = list(n.load())
+ self.neuron.unset(n)
+ return res
def identifier(self, *args, **kwargs):
if super(Network, self).defined:
