From f8a7a8ae25e03534e35c9a0f379c158e0dea6830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Legou=C3=A9e?= Date: Mon, 25 Sep 2017 10:02:13 +0200 Subject: [PATCH 1/5] Informative error for the parrot neurons --- pyNN/common/control.py | 6 +++++- pyNN/nest/__init__.py | 3 +++ pyNN/nest/standardmodels/cells.py | 3 ++- pyNN/parameters.py | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pyNN/common/control.py b/pyNN/common/control.py index cafe6f525..05bb7608e 100644 --- a/pyNN/common/control.py +++ b/pyNN/common/control.py @@ -51,7 +51,11 @@ def setup(timestep=DEFAULT_TIMESTEP, min_delay=DEFAULT_MIN_DELAY, raise Exception("min_delay has to be less than or equal to max_delay.") if min_delay < timestep: raise Exception("min_delay (%g) must be greater than timestep (%g)" % (min_delay, timestep)) - + if timestep<0. or min_delay<0.: + raise Warning("Times are negative") + if min_delay == 'auto': + if timestep<0. or min_delay<0.: + raise Warning("Warning : Times are negative") def end(compatible_output=True): """Do any necessary cleaning up before exiting.""" diff --git a/pyNN/nest/__init__.py b/pyNN/nest/__init__.py index fa8f37ffb..01bbcb006 100644 --- a/pyNN/nest/__init__.py +++ b/pyNN/nest/__init__.py @@ -133,6 +133,9 @@ def setup(timestep=DEFAULT_TIMESTEP, min_delay=DEFAULT_MIN_DELAY, rng = NumpyRNG(extra_params.get('rng_seeds_seed', 42)) n = simulator.state.num_processes * simulator.state.threads simulator.state.rng_seeds = rng.next(n, 'uniform_int', {'low': 0, 'high': 100000}).tolist() + if min_delay == 'auto': + print("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") + return Warning("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") # set resolution simulator.state.dt = timestep # Set min_delay and max_delay diff --git a/pyNN/nest/standardmodels/cells.py b/pyNN/nest/standardmodels/cells.py index f57db9bf6..f67bcb4a5 100644 --- a/pyNN/nest/standardmodels/cells.py +++ b/pyNN/nest/standardmodels/cells.py @@ -289,7 +289,8 @@ def adjust_spike_times_forward(spike_times): parrot neuron. """ # todo: emit warning if any times become negative - return spike_times - simulator.state.min_delay +# return spike_times - simulator.state.min_delay + return spike_times + simulator.state.min_delay def adjust_spike_times_backward(spike_times): diff --git a/pyNN/parameters.py b/pyNN/parameters.py index b5dd0e35d..ac4b54b33 100644 --- a/pyNN/parameters.py +++ b/pyNN/parameters.py @@ -123,6 +123,8 @@ def __init__(self, value): self.value = value else: self.value = numpy.array(value, float) + if value<0.: + print("Warning : Times are negative") # def __len__(self): # This must not be defined, otherwise Sequence is insufficiently different from NumPy array From 3beb128983eb96ab10daaa4377d205f9d041d6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Legou=C3=A9e?= Date: Mon, 25 Sep 2017 10:29:50 +0200 Subject: [PATCH 2/5] Informative error due to the parrot neurons --- pyNN/parameters.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyNN/parameters.py b/pyNN/parameters.py index ac4b54b33..ff124b423 100644 --- a/pyNN/parameters.py +++ b/pyNN/parameters.py @@ -123,7 +123,8 @@ def __init__(self, value): self.value = value else: self.value = numpy.array(value, float) - if value<0.: +# if value<0.: + if (self.value<0.).any(): print("Warning : Times are negative") # def __len__(self): From a86aa5a1d5e22fdb333f59edaaee50f256ea2994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Legou=C3=A9e?= Date: Mon, 25 Sep 2017 10:31:42 +0200 Subject: [PATCH 3/5] Informative error for the parrot neurons --- pyNN/parameters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyNN/parameters.py b/pyNN/parameters.py index ff124b423..5b49cb499 100644 --- a/pyNN/parameters.py +++ b/pyNN/parameters.py @@ -123,7 +123,6 @@ def __init__(self, value): self.value = value else: self.value = numpy.array(value, float) -# if value<0.: if (self.value<0.).any(): print("Warning : Times are negative") From dd0342b6c03bbb63460c5430319ac79ce00769dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Legou=C3=A9e?= Date: Mon, 25 Sep 2017 16:24:45 +0200 Subject: [PATCH 4/5] Informative error for the parrot neurons --- pyNN/common/control.py | 2 +- pyNN/parameters.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyNN/common/control.py b/pyNN/common/control.py index 05bb7608e..af809f014 100644 --- a/pyNN/common/control.py +++ b/pyNN/common/control.py @@ -54,7 +54,7 @@ def setup(timestep=DEFAULT_TIMESTEP, min_delay=DEFAULT_MIN_DELAY, if timestep<0. or min_delay<0.: raise Warning("Times are negative") if min_delay == 'auto': - if timestep<0. or min_delay<0.: + if timestep<0.: raise Warning("Warning : Times are negative") def end(compatible_output=True): diff --git a/pyNN/parameters.py b/pyNN/parameters.py index 5b49cb499..6ff49f898 100644 --- a/pyNN/parameters.py +++ b/pyNN/parameters.py @@ -123,7 +123,7 @@ def __init__(self, value): self.value = value else: self.value = numpy.array(value, float) - if (self.value<0.).any(): + if (self.value<0.).any(): print("Warning : Times are negative") # def __len__(self): From 08dc086270de1f61e5f484d8295099f69ba7f186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Legou=C3=A9e?= Date: Tue, 26 Sep 2017 13:32:26 +0200 Subject: [PATCH 5/5] Informative error for the parrot neurons --- pyNN/nest/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyNN/nest/__init__.py b/pyNN/nest/__init__.py index 01bbcb006..9d377b5b8 100644 --- a/pyNN/nest/__init__.py +++ b/pyNN/nest/__init__.py @@ -133,14 +133,14 @@ def setup(timestep=DEFAULT_TIMESTEP, min_delay=DEFAULT_MIN_DELAY, rng = NumpyRNG(extra_params.get('rng_seeds_seed', 42)) n = simulator.state.num_processes * simulator.state.threads simulator.state.rng_seeds = rng.next(n, 'uniform_int', {'low': 0, 'high': 100000}).tolist() - if min_delay == 'auto': - print("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") - return Warning("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") # set resolution simulator.state.dt = timestep # Set min_delay and max_delay simulator.state.set_delays(min_delay, max_delay) nest.SetDefaults('spike_generator', {'precise_times': True}) + if min_delay == 'auto': + print("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") + return Warning("Warning due to the parrot neuron which introduces an exra delay. 'min_delay' must be reduced") return rank()