From 5123d493a6fa280be362cfff1446a84cdd42658c Mon Sep 17 00:00:00 2001 From: Aaron Voelker Date: Wed, 11 Dec 2019 22:53:31 -0800 Subject: [PATCH 1/3] WIP: change setup to nengo>=3.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e8ab266..e0e6944 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def read(*filenames, **kwargs): 'version', os.path.join(root, name, 'version.py')) deps = [ # https://github.com/nengo/nengo/issues/508 - "nengo>=2.2.0,<3.0", + "nengo>=3.0", "numpy>=1.13", "scipy>=0.19.0", ] From da2d0ccb31fcba7c6455a5cd32b790fe1ffda2aa Mon Sep 17 00:00:00 2001 From: Aaron Voelker Date: Wed, 11 Dec 2019 23:10:24 -0800 Subject: [PATCH 2/3] [SYNC] init_lif's use of rates to new shaping Changes made in: https://github.com/nengo/nengo/pull/1437 --- nengolib/neurons.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nengolib/neurons.py b/nengolib/neurons.py index fa898d5..6b2c709 100644 --- a/nengolib/neurons.py +++ b/nengolib/neurons.py @@ -14,9 +14,10 @@ def _sample_lif_state(sim, ens, x0, rng): lif = ens.neuron_type params = sim.model.params - eval_points = x0[None, :] - x = np.dot(eval_points, params[ens].encoders.T / ens.radius)[0] - a = ens.neuron_type.rates(x, params[ens].gain, params[ens].bias) + eval_points = x0 + x = np.dot(eval_points, params[ens].encoders.T / ens.radius) + a = ens.neuron_type.rates( + x[None, :], params[ens].gain, params[ens].bias).squeeze(axis=0) J = params[ens].gain * x + params[ens].bias # fast-forward to a random time within the ISI for any active neurons From 95f5f4ce590b0eaa5ee27d6664e80521808c3025 Mon Sep 17 00:00:00 2001 From: Aaron Voelker Date: Wed, 11 Dec 2019 23:13:01 -0800 Subject: [PATCH 3/3] WIP: get it able to import everything --- nengolib/networks/reservoir.py | 2 +- nengolib/signal/system.py | 4 ++-- nengolib/stats/ntmdists.py | 2 +- nengolib/synapses/analog.py | 2 +- nengolib/synapses/digital.py | 2 +- nengolib/synapses/hetero_synapse.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nengolib/networks/reservoir.py b/nengolib/networks/reservoir.py index bf7c4db..862fb22 100644 --- a/nengolib/networks/reservoir.py +++ b/nengolib/networks/reservoir.py @@ -8,7 +8,7 @@ from nengo.exceptions import NetworkContextError from nengo.solvers import LstsqL2 from nengo.synapses import SynapseParam -from nengo.utils.compat import is_iterable +from nengo.utils.numpy import is_iterable __all__ = ['Reservoir'] diff --git a/nengolib/signal/system.py b/nengolib/signal/system.py index 85e9b88..ab91c13 100644 --- a/nengolib/signal/system.py +++ b/nengolib/signal/system.py @@ -7,7 +7,7 @@ cont2discrete, zpk2ss, ss2tf, ss2zpk, tf2ss, tf2zpk, zpk2tf, normalize) from nengo.synapses import LinearFilter -from nengo.utils.compat import is_integer, is_number, with_metaclass +from nengo.utils.numpy import is_integer, is_number __all__ = [ 'sys2ss', 'sys2tf', 'sys2zpk', 'canonical', 'sys_equal', 'ss_equal', @@ -240,7 +240,7 @@ def __call__(self, sys, analog=None): return super(LinearSystemType, self).__call__(sys, analog) -class LinearSystem(with_metaclass(LinearSystemType, NengoLinearFilterMixin)): +class LinearSystem(NengoLinearFilterMixin, metaclass=LinearSystemType): """Generic linear system representation. This extends :class:`nengo.LinearFilter` to unify a variety of diff --git a/nengolib/stats/ntmdists.py b/nengolib/stats/ntmdists.py index ff9e925..e294995 100644 --- a/nengolib/stats/ntmdists.py +++ b/nengolib/stats/ntmdists.py @@ -4,7 +4,7 @@ from scipy.special import beta, betainc, betaincinv from nengo.dists import Distribution, UniformHypersphere -from nengo.utils.compat import is_integer +from nengo.utils.numpy import is_integer from nengolib.stats.ortho import random_orthogonal from nengolib.stats._sobol_seq import i4_sobol_generate diff --git a/nengolib/synapses/analog.py b/nengolib/synapses/analog.py index 0e491f0..4c59039 100644 --- a/nengolib/synapses/analog.py +++ b/nengolib/synapses/analog.py @@ -4,7 +4,7 @@ from scipy.interpolate import pade from scipy.special import factorial -from nengo.utils.compat import is_integer +from nengo.utils.numpy import is_integer from nengolib.signal.system import LinearSystem, s diff --git a/nengolib/synapses/digital.py b/nengolib/synapses/digital.py index a67756a..221e401 100644 --- a/nengolib/synapses/digital.py +++ b/nengolib/synapses/digital.py @@ -1,4 +1,4 @@ -from nengo.utils.compat import is_integer +from nengo.utils.numpy import is_integer from nengolib.signal.system import z diff --git a/nengolib/synapses/hetero_synapse.py b/nengolib/synapses/hetero_synapse.py index 37c4edc..f43c13b 100644 --- a/nengolib/synapses/hetero_synapse.py +++ b/nengolib/synapses/hetero_synapse.py @@ -1,7 +1,7 @@ import numpy as np from scipy.linalg import block_diag -from nengo.utils.compat import is_iterable +from nengo.utils.numpy import is_iterable from nengolib.signal.discrete import cont2discrete from nengolib.signal.system import LinearSystem