From: Zbigniew Jędrzejewski-S. <zb...@in...> - 2014-04-01 21:09:55
|
--- python/moose/neuroml2/reader.py | 8 ++++---- python/moose/recording.py | 1 + python/moose/xmls_to_network/core/neuroml_to_moose.py | 10 ++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/python/moose/neuroml2/reader.py b/python/moose/neuroml2/reader.py index ee20af4..7d51790 100644 --- a/python/moose/neuroml2/reader.py +++ b/python/moose/neuroml2/reader.py @@ -53,8 +53,8 @@ prototype includes. """ from __future__ import print_function +from future_builtins import zip, map import sys, os -from itertools import izip from urllib2 import urlopen import numpy as np import moose @@ -213,9 +213,9 @@ class NML2Reader(object): p0 = parent.distal else: raise Exception('No proximal point and no parent segment for segment: name=%s, id=%s' % (segment.name, segment.id)) - comp.x0, comp.y0, comp.z0 = map(lambda x: x * self.lunit, map(float, (p0.x, p0.y, p0.z))) + comp.x0, comp.y0, comp.z0 = (x * self.lunit for x in map(float, (p0.x, p0.y, p0.z))) p1 = segment.distal - comp.x, comp.y, comp.z = map(lambda x: x * self.lunit, map(float, (p1.x, p1.y, p1.z))) + comp.x, comp.y, comp.z = (x * self.lunit for x in map(float, (p1.x, p1.y, p1.z))) comp.length = np.linalg.norm((comp.x - comp.x0, comp.y - comp.y0, comp.z - comp.z0)) @@ -363,7 +363,7 @@ class NML2Reader(object): mchan = moose.HHChannel('%s/%s' % (self.lib.path, chan.id)) mgates = map(moose.element, (mchan.gateX, mchan.gateY, mchan.gateZ)) assert(len(chan.gate) <= 3) # We handle only up to 3 gates in HHCHannel - for ngate, mgate in izip(chan.gate, mgates): + for ngate, mgate in zip(chan.gate, mgates): if mgate.name.endswith('X'): mchan.Xpower = ngate.instances elif mgate.name.endswith('Y'): diff --git a/python/moose/recording.py b/python/moose/recording.py index 312d1d9..066d2e5 100644 --- a/python/moose/recording.py +++ b/python/moose/recording.py @@ -1,4 +1,5 @@ from __future__ import print_function +from future_builtins import zip import moose as _moose _tick = 8 diff --git a/python/moose/xmls_to_network/core/neuroml_to_moose.py b/python/moose/xmls_to_network/core/neuroml_to_moose.py index 663b255..1ee74ad 100644 --- a/python/moose/xmls_to_network/core/neuroml_to_moose.py +++ b/python/moose/xmls_to_network/core/neuroml_to_moose.py @@ -53,8 +53,8 @@ prototype includes. """ from __future__ import print_function +from future_builtins import zip, map import sys, os -from itertools import izip from urllib2 import urlopen import numpy as np import neuroml2_parser as nml @@ -206,11 +206,9 @@ class NML2Reader(object): else: raise Exception('No proximal point and no parent segment \ for segment: name=%s, id=%s' % (segment.name, segment.id)) - comp.x0, comp.y0, comp.z0 = map(lambda x: x * self.lunit - , map(float, (p0.x, p0.y, p0.z))) + comp.x0, comp.y0, comp.z0 = [x * self.lunit for x in map(float, (p0.x, p0.y, p0.z))] p1 = segment.distal - comp.x, comp.y, comp.z = map(lambda x: x * self.lunit - , map(float, (p1.x, p1.y, p1.z))) + comp.x, comp.y, comp.z = [x * self.lunit for x in map(float, (p1.x, p1.y, p1.z))] comp.length = np.sqrt((comp.x - comp.x0)**2 + (comp.y - comp.y0)**2 + (comp.z - comp.z0)**2) @@ -370,7 +368,7 @@ class NML2Reader(object): mchan = moose.HHChannel('%s/%s' % (self.lib.path, chan.id)) mgates = map(moose.element, (mchan.gateX, mchan.gateY, mchan.gateZ)) assert(len(chan.gate) <= 3) # We handle only up to 3 gates in HHCHannel - for ngate, mgate in izip(chan.gate, mgates): + for ngate, mgate in zip(chan.gate, mgates): if mgate.name.endswith('X'): mchan.Xpower = ngate.instances elif mgate.name.endswith('Y'): -- 1.8.5.3 |