From 4bb089a469f2e128148168e533034cd1b2c1a0a2 Mon Sep 17 00:00:00 2001 From: christian-B Date: Thu, 6 Aug 2026 08:17:43 +0100 Subject: [PATCH 1/2] ruff.bash --- ruff.bash | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 ruff.bash diff --git a/ruff.bash b/ruff.bash new file mode 100755 index 0000000..072abcc --- /dev/null +++ b/ruff.bash @@ -0,0 +1,57 @@ +#!/bin/bash + +# Copyright (c) 2026 The University of Manchester +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This bash assumes that other repositories are installed in parallel +# ruffs SpiNNUtils, spinn_machine and unittests + +if [ "$#" -eq "0" ] + then + echo "Using previous setup. Provide an argument to run setup" + source ../SupportScripts/venv/ruff_runner/bin/activate +else + python3 -m venv ../SupportScripts/venv/ruff_runner + source ../SupportScripts/venv/ruff_runner/bin/activate + python3 -m pip install --upgrade ruff +fi + +echo using ruff.toml +ruff check ../SpiNNUtils/spinn_utilities ../SpiNNUtils/unittests \ + ../SpiNNMachine/spinn_machine ../SpiNNMachine/unittests \ + ../SpiNNMan/spinnman ../SpiNNMan/unittests \ + ../SpiNNMan/spinnman_integration_tests ../SpiNNMan/manual_scripts \ + ../PACMAN/pacman ../PACMAN/pacman_test_objects ../PACMAN/unittests \ + ../spalloc/spalloc_client ../spalloc/tests \ + ../SpiNNFrontEndCommon/spinn_front_end_common ../SpiNNFrontEndCommon/unittests \ + ../SpiNNFrontEndCommon/fec_integration_tests \ + ../TestBase/spinnaker_testbase ../TestBase/unittests \ + ../sPyNNaker/spynnaker ../sPyNNaker/unittests \ + ../sPyNNaker/spynnaker_integration_tests ../sPyNNaker/proxy_integration_tests \ + examples balanced_random learning sudoku synfire \ + --target-version py310 --config ../SupportScripts/actions/ruff/ruff.toml +echo using ruff_up.toml +ruff check ../SpiNNUtils/spinn_utilities ../SpiNNUtils/unittests \ + ../SpiNNMachine/spinn_machine ../SpiNNMachine/unittests \ + ../SpiNNMan/spinnman ../SpiNNMan/unittests \ + ../SpiNNMan/spinnman_integration_tests ../SpiNNMan/manual_scripts \ + ../PACMAN/pacman ../PACMAN/pacman_test_objects ../PACMAN/unittests \ + ../spalloc/spalloc_client ../spalloc/tests \ + ../SpiNNFrontEndCommon/spinn_front_end_common ../SpiNNFrontEndCommon/unittests \ + ../SpiNNFrontEndCommon/fec_integration_tests \ + ../TestBase/spinnaker_testbase ../TestBase/unittests \ + ../sPyNNaker/spynnaker ../sPyNNaker/unittests \ + ../sPyNNaker/spynnaker_integration_tests ../sPyNNaker/proxy_integration_tests \ + examples balanced_random learning sudoku synfire \ + --target-version py310 --config ../SupportScripts/actions/ruff/ruff_up.toml \ No newline at end of file From ac9520625158541612a3ddf9f016c78ef6365914 Mon Sep 17 00:00:00 2001 From: christian-B Date: Thu, 6 Aug 2026 08:24:37 +0100 Subject: [PATCH 2/2] automatic ruff/ isort import fixes --- balanced_random/balanced_random.py | 2 +- balanced_random/split/balanced_random_split.py | 4 ++-- examples/current_injection_example.py | 2 +- .../live_examples/balanced_random_live_rate.py | 1 + .../live_examples/spike_io.py | 3 ++- .../spike_io_interactive_demo_with_c_vis.py | 3 ++- .../live_examples/synfire_if_curr_exp_live.py | 2 +- .../pushbot_light_follower.py | 1 - examples/extra_models_examples/IF_cond_exp_stoc.py | 2 +- examples/extra_models_examples/IF_curr_delta.py | 2 +- .../extra_models_examples/IF_curr_exp_ca2_adaptive.py | 3 ++- examples/extra_models_examples/IF_curr_exp_sEMD.py | 2 +- examples/extra_models_examples/LGN_Izhikevich.py | 7 ++++--- .../extra_models_examples/stdp_associative_memory.py | 3 ++- .../extra_models_examples/stdp_example_izk_cond.py | 2 +- ...tdp_mad_recurrent_pre_stochastic_multiplicative.py | 1 + examples/extra_models_examples/stdp_triplet.py | 1 - .../extra_models_examples/synfire_if_curr_dual_exp.py | 2 +- examples/extra_models_examples/vogels_2011.py | 6 ++++-- examples/hbp_neuroguidebook_example.py | 2 +- examples/if_curr_alpha.py | 2 +- examples/if_curr_delta.py | 2 +- examples/partitioner_examples/splitter_usage.py | 10 +++++++--- examples/pynnBrunnel.py | 3 +-- examples/simple_STDP.py | 5 +++-- examples/spike_time_compare.py | 2 +- examples/split_examples/pynnBrunnelSplit.py | 3 +-- .../stdp_neuromodulated_example_split.py | 2 +- .../structural_plasticity_with_stdp_neuromodulated.py | 4 ++-- examples/split_examples/va_benchmark_split.py | 4 ++-- examples/stdp_example.py | 2 +- examples/stdp_example_cond.py | 2 +- examples/stdp_example_izk.py | 2 +- examples/stdp_neuromodulated_example.py | 2 +- ...asticity_with_stdp_neuromodulated_separate_pops.py | 4 ++-- examples/synfire_if_cond_exp.py | 2 +- examples/synfire_if_curr_exp.py | 2 +- examples/synfire_if_curr_exp_large_array.py | 2 +- examples/synfire_if_curr_exp_random.py | 3 +-- examples/synfire_izk_curr_exp.py | 2 +- examples/va_benchmark.py | 3 ++- examples/wta_example.py | 2 +- learning/random_dist.py | 4 ++-- learning/split/stdp_split.py | 2 +- learning/split/struct_pl_split.py | 2 +- sudoku/set_numbers.py | 8 +++++--- sudoku/sudoku_main.py | 11 +++++++---- synfire/synfire.py | 1 + synfire/synfire_collab.py | 1 + 49 files changed, 81 insertions(+), 64 deletions(-) diff --git a/balanced_random/balanced_random.py b/balanced_random/balanced_random.py index 48bd4db..b61183f 100644 --- a/balanced_random/balanced_random.py +++ b/balanced_random/balanced_random.py @@ -14,9 +14,9 @@ import matplotlib.pyplot as pylab import numpy +import pyNN.spiNNaker as p from pyNN.random import RandomDistribution from pyNN.utility.plotting import Figure, Panel -import pyNN.spiNNaker as p p.setup(timestep=0.1) p.set_number_of_neurons_per_core(p.IF_curr_exp, 64) diff --git a/balanced_random/split/balanced_random_split.py b/balanced_random/split/balanced_random_split.py index 830c735..6bf9a73 100755 --- a/balanced_random/split/balanced_random_split.py +++ b/balanced_random/split/balanced_random_split.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pylab import numpy +import pylab +import pyNN.spiNNaker as p from pyNN.random import RandomDistribution from pyNN.utility.plotting import Figure, Panel -import pyNN.spiNNaker as p p.setup(timestep=0.1) p.set_number_of_neurons_per_core(p.IF_curr_exp, 64) diff --git a/examples/current_injection_example.py b/examples/current_injection_example.py index c2a470f..b62ab51 100644 --- a/examples/current_injection_example.py +++ b/examples/current_injection_example.py @@ -29,9 +29,9 @@ """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt from quantities import mV sim.setup(timestep=1.0) diff --git a/examples/external_devices_examples/live_examples/balanced_random_live_rate.py b/examples/external_devices_examples/live_examples/balanced_random_live_rate.py index c13b06c..1e0b27c 100644 --- a/examples/external_devices_examples/live_examples/balanced_random_live_rate.py +++ b/examples/external_devices_examples/live_examples/balanced_random_live_rate.py @@ -13,6 +13,7 @@ # limitations under the License. import time + import numpy import pylab import pyNN.spiNNaker as p diff --git a/examples/external_devices_examples/live_examples/spike_io.py b/examples/external_devices_examples/live_examples/spike_io.py index 6395e9f..bb4546c 100644 --- a/examples/external_devices_examples/live_examples/spike_io.py +++ b/examples/external_devices_examples/live_examples/spike_io.py @@ -15,9 +15,10 @@ import random import time from threading import Condition + +import matplotlib.pyplot as plt import pyNN.spiNNaker as Frontend from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt ################################### # Setup for Live Input and Output # diff --git a/examples/external_devices_examples/live_examples/spike_io_interactive_demo_with_c_vis.py b/examples/external_devices_examples/live_examples/spike_io_interactive_demo_with_c_vis.py index 470c8f1..222abe0 100644 --- a/examples/external_devices_examples/live_examples/spike_io_interactive_demo_with_c_vis.py +++ b/examples/external_devices_examples/live_examples/spike_io_interactive_demo_with_c_vis.py @@ -14,9 +14,10 @@ import multiprocessing import tkinter as tk + +import matplotlib.pyplot as plt import pyNN.spiNNaker as Frontend from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt class PyNNScript(object): diff --git a/examples/external_devices_examples/live_examples/synfire_if_curr_exp_live.py b/examples/external_devices_examples/live_examples/synfire_if_curr_exp_live.py index 185c192..ed734a9 100644 --- a/examples/external_devices_examples/live_examples/synfire_if_curr_exp_live.py +++ b/examples/external_devices_examples/live_examples/synfire_if_curr_exp_live.py @@ -13,11 +13,11 @@ # limitations under the License. # Standard PyNN imports +import matplotlib.pyplot as plt import pyNN.spiNNaker as p # pynn plotting stuff from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # Define a synfire chain as usual p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/external_devices_examples/pushbot_light_follower.py b/examples/external_devices_examples/pushbot_light_follower.py index a932edd..be3941a 100644 --- a/examples/external_devices_examples/pushbot_light_follower.py +++ b/examples/external_devices_examples/pushbot_light_follower.py @@ -18,7 +18,6 @@ import numpy import pyNN.spiNNaker as p - ########################################### # Connection and simulation specifications ########################################### diff --git a/examples/extra_models_examples/IF_cond_exp_stoc.py b/examples/extra_models_examples/IF_cond_exp_stoc.py index 4bee132..121da65 100644 --- a/examples/extra_models_examples/IF_cond_exp_stoc.py +++ b/examples/extra_models_examples/IF_cond_exp_stoc.py @@ -28,10 +28,10 @@ $Id$ """ +import matplotlib.pyplot as plt import pylab import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt def run_script(*, split: bool = False) -> None: diff --git a/examples/extra_models_examples/IF_curr_delta.py b/examples/extra_models_examples/IF_curr_delta.py index 8d2c9c4..e567630 100644 --- a/examples/extra_models_examples/IF_curr_delta.py +++ b/examples/extra_models_examples/IF_curr_delta.py @@ -17,9 +17,9 @@ and two delta, current-based synapses, fed by two spike sources. """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt sim.setup(timestep=0.1, min_delay=0.1) diff --git a/examples/extra_models_examples/IF_curr_exp_ca2_adaptive.py b/examples/extra_models_examples/IF_curr_exp_ca2_adaptive.py index 4352871..29a3d0d 100644 --- a/examples/extra_models_examples/IF_curr_exp_ca2_adaptive.py +++ b/examples/extra_models_examples/IF_curr_exp_ca2_adaptive.py @@ -21,8 +21,9 @@ # doi:10.1023/A:1008916026143 # ----------------------------------------------------------------------------- import math -import numpy + import matplotlib.pyplot as pylab +import numpy import pyNN.spiNNaker as sim diff --git a/examples/extra_models_examples/IF_curr_exp_sEMD.py b/examples/extra_models_examples/IF_curr_exp_sEMD.py index 136b91b..c441a15 100644 --- a/examples/extra_models_examples/IF_curr_exp_sEMD.py +++ b/examples/extra_models_examples/IF_curr_exp_sEMD.py @@ -19,8 +19,8 @@ """ # imports -import pyNN.spiNNaker as p import matplotlib.pyplot as plt +import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel diff --git a/examples/extra_models_examples/LGN_Izhikevich.py b/examples/extra_models_examples/LGN_Izhikevich.py index d362ed4..696962f 100644 --- a/examples/extra_models_examples/LGN_Izhikevich.py +++ b/examples/extra_models_examples/LGN_Izhikevich.py @@ -41,13 +41,14 @@ """ import math -import pyNN.spiNNaker as p + +import matplotlib.pyplot as plt import numpy as np -from pyNN.random import RandomDistribution, NumpyRNG +import pyNN.spiNNaker as p +from pyNN.random import NumpyRNG, RandomDistribution # for plotting from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # pylint: disable=pointless-string-statement,disable=wrong-spelling-in-comment diff --git a/examples/extra_models_examples/stdp_associative_memory.py b/examples/extra_models_examples/stdp_associative_memory.py index 69bafc1..e1bb2dd 100644 --- a/examples/extra_models_examples/stdp_associative_memory.py +++ b/examples/extra_models_examples/stdp_associative_memory.py @@ -16,9 +16,10 @@ Simple Associative Memory """ import matplotlib.pyplot as plt -from pyNN.random import NumpyRNG, RandomDistribution import pyNN.spiNNaker as p +from pyNN.random import NumpyRNG, RandomDistribution from pyNN.utility.plotting import Figure, Panel + # pylint: disable=wrong-spelling-in-comment p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/extra_models_examples/stdp_example_izk_cond.py b/examples/extra_models_examples/stdp_example_izk_cond.py index c913297..9e52f4c 100644 --- a/examples/extra_models_examples/stdp_example_izk_cond.py +++ b/examples/extra_models_examples/stdp_example_izk_cond.py @@ -49,9 +49,9 @@ April 2013 """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # SpiNNaker setup sim.setup(timestep=0.1, min_delay=1.0) diff --git a/examples/extra_models_examples/stdp_mad_recurrent_pre_stochastic_multiplicative.py b/examples/extra_models_examples/stdp_mad_recurrent_pre_stochastic_multiplicative.py index a200766..b9d7f6c 100644 --- a/examples/extra_models_examples/stdp_mad_recurrent_pre_stochastic_multiplicative.py +++ b/examples/extra_models_examples/stdp_mad_recurrent_pre_stochastic_multiplicative.py @@ -18,6 +18,7 @@ import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel + # pylint: disable=wrong-spelling-in-comment p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/extra_models_examples/stdp_triplet.py b/examples/extra_models_examples/stdp_triplet.py index 4505dbd..64d47ac 100644 --- a/examples/extra_models_examples/stdp_triplet.py +++ b/examples/extra_models_examples/stdp_triplet.py @@ -13,7 +13,6 @@ # limitations under the License. import matplotlib.pyplot as pylab - import pyNN.spiNNaker as sim # pylint: disable=wrong-spelling-in-comment diff --git a/examples/extra_models_examples/synfire_if_curr_dual_exp.py b/examples/extra_models_examples/synfire_if_curr_dual_exp.py index 927f341..bcc84c4 100644 --- a/examples/extra_models_examples/synfire_if_curr_dual_exp.py +++ b/examples/extra_models_examples/synfire_if_curr_dual_exp.py @@ -15,9 +15,9 @@ """ Synfirechain-like example """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt def run_script(*, split: bool = False) -> None: diff --git a/examples/extra_models_examples/vogels_2011.py b/examples/extra_models_examples/vogels_2011.py index 3a029f5..0783537 100644 --- a/examples/extra_models_examples/vogels_2011.py +++ b/examples/extra_models_examples/vogels_2011.py @@ -13,9 +13,11 @@ # limitations under the License. import os from typing import Optional -import pyNN.spiNNaker as sim -import numpy + import matplotlib.pyplot as pylab +import numpy +import pyNN.spiNNaker as sim + from spynnaker.pyNN.utilities import neo_convertor # how much slowdown to put into the network to allow it to run without any diff --git a/examples/hbp_neuroguidebook_example.py b/examples/hbp_neuroguidebook_example.py index 62b1507..5d4436e 100644 --- a/examples/hbp_neuroguidebook_example.py +++ b/examples/hbp_neuroguidebook_example.py @@ -17,8 +17,8 @@ (example used in the HBP Neuromorphic Computing Guidebook) """ -import numpy as np import matplotlib.pyplot as plt +import numpy as np import pyNN.spiNNaker as sim sim.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/if_curr_alpha.py b/examples/if_curr_alpha.py index 933ce7d..2894df2 100644 --- a/examples/if_curr_alpha.py +++ b/examples/if_curr_alpha.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import matplotlib.pyplot as plt import pyNN.spiNNaker as p import pyNN.utility.plotting as plot -import matplotlib.pyplot as plt def run_script(*, split: bool = True) -> None: diff --git a/examples/if_curr_delta.py b/examples/if_curr_delta.py index 68c88be..6d29456 100644 --- a/examples/if_curr_delta.py +++ b/examples/if_curr_delta.py @@ -17,9 +17,9 @@ and two delta, current-based synapses, fed by two spike sources. """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt sim.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/partitioner_examples/splitter_usage.py b/examples/partitioner_examples/splitter_usage.py index af9e4ee..2476e33 100644 --- a/examples/partitioner_examples/splitter_usage.py +++ b/examples/partitioner_examples/splitter_usage.py @@ -11,14 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt + +from pacman.model.partitioner_splitters import SplitterFixedLegacy from pacman.model.partitioner_splitters import ( SplitterOneToOneLegacy as OneToOneSplitter, - SplitterFixedLegacy) +) + from spynnaker.pyNN.extra_algorithms.splitter_components import ( - SplitterPopulationVertexFixed) + SplitterPopulationVertexFixed, +) runtime = 1000 n_neurons = 100 # number of neurons in each population diff --git a/examples/pynnBrunnel.py b/examples/pynnBrunnel.py index fec0fd5..4835c6a 100644 --- a/examples/pynnBrunnel.py +++ b/examples/pynnBrunnel.py @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pyNN.spiNNaker as pynn - import matplotlib.pyplot as plt +import pyNN.spiNNaker as pynn from pyNN.random import RandomDistribution from pyNN.utility.plotting import Figure, Panel diff --git a/examples/simple_STDP.py b/examples/simple_STDP.py index 2e55dc9..b5c7527 100644 --- a/examples/simple_STDP.py +++ b/examples/simple_STDP.py @@ -29,11 +29,12 @@ so some alteration of parameters is necessary to get a similar effect. """ +import matplotlib.pyplot as plt import numpy import pyNN.spiNNaker as sim + # from quantities import ms -from pyNN.utility.plotting import Figure, Panel, DataTable -import matplotlib.pyplot as plt +from pyNN.utility.plotting import DataTable, Figure, Panel # === Parameters ============================================================ diff --git a/examples/spike_time_compare.py b/examples/spike_time_compare.py index 685da63..419f8b5 100644 --- a/examples/spike_time_compare.py +++ b/examples/spike_time_compare.py @@ -15,9 +15,9 @@ # A simple script that compares the spikes from two inputs to determine if # one spiked just before or after the other. +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim import pyNN.utility.plotting as plot -import matplotlib.pyplot as plt sim.setup(timestep=1.0) diff --git a/examples/split_examples/pynnBrunnelSplit.py b/examples/split_examples/pynnBrunnelSplit.py index 213dad0..802f9df 100755 --- a/examples/split_examples/pynnBrunnelSplit.py +++ b/examples/split_examples/pynnBrunnelSplit.py @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pyNN.spiNNaker as pynn - import matplotlib.pyplot as plt +import pyNN.spiNNaker as pynn from pyNN.random import RandomDistribution from pyNN.utility.plotting import Figure, Panel diff --git a/examples/split_examples/stdp_neuromodulated_example_split.py b/examples/split_examples/stdp_neuromodulated_example_split.py index aaca979..2da26fb 100644 --- a/examples/split_examples/stdp_neuromodulated_example_split.py +++ b/examples/split_examples/stdp_neuromodulated_example_split.py @@ -26,8 +26,8 @@ post-synaptic neurons to the same stimuli. """ -import pyNN.spiNNaker as sim import pylab +import pyNN.spiNNaker as sim timestep = 1.0 stim_rate = 50 diff --git a/examples/split_examples/structural_plasticity_with_stdp_neuromodulated.py b/examples/split_examples/structural_plasticity_with_stdp_neuromodulated.py index 9a50458..e015e3d 100644 --- a/examples/split_examples/structural_plasticity_with_stdp_neuromodulated.py +++ b/examples/split_examples/structural_plasticity_with_stdp_neuromodulated.py @@ -31,9 +31,9 @@ STDP, structural plasticity and neuron instructions would not fit on one core """ -import pyNN.spiNNaker as sim -import pylab import numpy as np +import pylab +import pyNN.spiNNaker as sim timestep = 1.0 stim_rate = 50 diff --git a/examples/split_examples/va_benchmark_split.py b/examples/split_examples/va_benchmark_split.py index 1e2ab75..3b95856 100755 --- a/examples/split_examples/va_benchmark_split.py +++ b/examples/split_examples/va_benchmark_split.py @@ -27,12 +27,12 @@ August 2006 """ import socket + +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.random import RandomDistribution from pyNN.utility import Timer from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt - simulator_name = 'spiNNaker' benchmark = 'CUBA' diff --git a/examples/stdp_example.py b/examples/stdp_example.py index 3527b44..9d241f7 100644 --- a/examples/stdp_example.py +++ b/examples/stdp_example.py @@ -42,9 +42,9 @@ April 2013 """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # SpiNNaker setup sim.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/stdp_example_cond.py b/examples/stdp_example_cond.py index 224efb9..5401760 100644 --- a/examples/stdp_example_cond.py +++ b/examples/stdp_example_cond.py @@ -42,9 +42,9 @@ April 2013 """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # SpiNNaker setup sim.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/stdp_example_izk.py b/examples/stdp_example_izk.py index 3b52d2f..d95ae37 100644 --- a/examples/stdp_example_izk.py +++ b/examples/stdp_example_izk.py @@ -49,9 +49,9 @@ April 2013 """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as sim from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt # SpiNNaker setup sim.setup(timestep=0.1, min_delay=1.0) diff --git a/examples/stdp_neuromodulated_example.py b/examples/stdp_neuromodulated_example.py index 640c70b..f4e02a5 100644 --- a/examples/stdp_neuromodulated_example.py +++ b/examples/stdp_neuromodulated_example.py @@ -26,8 +26,8 @@ post-synaptic neurons to the same stimuli. """ -import pyNN.spiNNaker as sim import pylab +import pyNN.spiNNaker as sim timestep = 1.0 stim_rate = 50 diff --git a/examples/structural_plasticity_with_stdp_neuromodulated_separate_pops.py b/examples/structural_plasticity_with_stdp_neuromodulated_separate_pops.py index a98fbf1..1fe98ba 100644 --- a/examples/structural_plasticity_with_stdp_neuromodulated_separate_pops.py +++ b/examples/structural_plasticity_with_stdp_neuromodulated_separate_pops.py @@ -31,9 +31,9 @@ post-synaptic neurons to the same stimuli. """ -import pyNN.spiNNaker as sim -import pylab import numpy as np +import pylab +import pyNN.spiNNaker as sim timestep = 1.0 stim_rate = 100 diff --git a/examples/synfire_if_cond_exp.py b/examples/synfire_if_cond_exp.py index a039d67..1eb3b86 100644 --- a/examples/synfire_if_cond_exp.py +++ b/examples/synfire_if_cond_exp.py @@ -15,9 +15,9 @@ """ Synfirechain-like example """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt runtime = 5000 p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/synfire_if_curr_exp.py b/examples/synfire_if_curr_exp.py index 56791bc..d3b4db3 100644 --- a/examples/synfire_if_curr_exp.py +++ b/examples/synfire_if_curr_exp.py @@ -15,9 +15,9 @@ """ Synfirechain-like example """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt runtime = 5000 p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/synfire_if_curr_exp_large_array.py b/examples/synfire_if_curr_exp_large_array.py index b558736..e4662d4 100644 --- a/examples/synfire_if_curr_exp_large_array.py +++ b/examples/synfire_if_curr_exp_large_array.py @@ -15,9 +15,9 @@ """ Synfirechain-like example """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt run_time = 6000 p.setup(timestep=1.0, min_delay=1.00) diff --git a/examples/synfire_if_curr_exp_random.py b/examples/synfire_if_curr_exp_random.py index 60b7837..f13672f 100644 --- a/examples/synfire_if_curr_exp_random.py +++ b/examples/synfire_if_curr_exp_random.py @@ -16,11 +16,10 @@ Synfirechain-like example """ import matplotlib.pyplot as plt -from pyNN.random import RandomDistribution import pyNN.spiNNaker as p +from pyNN.random import RandomDistribution from pyNN.utility.plotting import Figure, Panel - p.setup(timestep=1.0, min_delay=1.0) nNeurons = 200 # number of neurons in each population max_delay = 50 diff --git a/examples/synfire_izk_curr_exp.py b/examples/synfire_izk_curr_exp.py index 93ac0be..28efdbc 100644 --- a/examples/synfire_izk_curr_exp.py +++ b/examples/synfire_izk_curr_exp.py @@ -15,9 +15,9 @@ """ Synfirechain-like example """ +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt runtime = 500 p.setup(timestep=1.0, min_delay=1.0) diff --git a/examples/va_benchmark.py b/examples/va_benchmark.py index d17e152..c50a075 100644 --- a/examples/va_benchmark.py +++ b/examples/va_benchmark.py @@ -30,11 +30,12 @@ August 2006 """ import socket + +import matplotlib.pyplot as plt import pyNN.spiNNaker as p from pyNN.random import RandomDistribution from pyNN.utility import Timer from pyNN.utility.plotting import Figure, Panel -import matplotlib.pyplot as plt simulator_name = 'spiNNaker' benchmark = 'CUBA' diff --git a/examples/wta_example.py b/examples/wta_example.py index e7e6eef..0dc247b 100644 --- a/examples/wta_example.py +++ b/examples/wta_example.py @@ -24,9 +24,9 @@ # The output graph shows the difference in the outputs of the two populations. -import pyNN.spiNNaker as sim import matplotlib.pyplot as plt import numpy +import pyNN.spiNNaker as sim sim.setup(1.0) diff --git a/learning/random_dist.py b/learning/random_dist.py index cd7ae38..c333cc5 100644 --- a/learning/random_dist.py +++ b/learning/random_dist.py @@ -13,9 +13,9 @@ # limitations under the License. import matplotlib.pyplot as plt -from pyNN.random import RandomDistribution -import pyNN.utility.plotting as plot import pyNN.spiNNaker as sim +import pyNN.utility.plotting as plot +from pyNN.random import RandomDistribution n_neurons = 1000 n_exc = int(round(n_neurons * 0.8)) diff --git a/learning/split/stdp_split.py b/learning/split/stdp_split.py index 163c81e..495e005 100755 --- a/learning/split/stdp_split.py +++ b/learning/split/stdp_split.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pyNN.utility.plotting as plot import matplotlib.pyplot as plt import pyNN.spiNNaker as sim +import pyNN.utility.plotting as plot n_neurons = 192 simtime = 5000 diff --git a/learning/split/struct_pl_split.py b/learning/split/struct_pl_split.py index fd26ef8..7930ddf 100755 --- a/learning/split/struct_pl_split.py +++ b/learning/split/struct_pl_split.py @@ -14,8 +14,8 @@ import matplotlib.pyplot as plt import numpy -import pyNN.utility.plotting as plot import pyNN.spiNNaker as sim +import pyNN.utility.plotting as plot n_neurons = 64 simtime = 5000 diff --git a/sudoku/set_numbers.py b/sudoku/set_numbers.py index dcb45ad..276308d 100644 --- a/sudoku/set_numbers.py +++ b/sudoku/set_numbers.py @@ -12,12 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import functools +import sys import tkinter as tk import tkinter.font as tkFont -import sys -import functools + import pyNN.spiNNaker as p -from sudoku.utils import puzzles, get_rates + +from sudoku.utils import get_rates, puzzles class GUI(object): diff --git a/sudoku/sudoku_main.py b/sudoku/sudoku_main.py index 66d0f71..a190a75 100644 --- a/sudoku/sudoku_main.py +++ b/sudoku/sudoku_main.py @@ -18,16 +18,19 @@ # Steve Furber, November 2015 # ############################################################# -import subprocess import os +import re +import subprocess import sys import traceback -import re from threading import Thread -from pyNN.random import RandomDistribution + import pyNN.spiNNaker as p +from pyNN.random import RandomDistribution + import spynnaker.pyNN.external_devices as ext -from sudoku.utils import puzzles, get_rates + +from sudoku.utils import get_rates, puzzles run_time = 20000 # run time in milliseconds neurons_per_digit = 5 # number of neurons per digit diff --git a/synfire/synfire.py b/synfire/synfire.py index b26874b..a4c1996 100644 --- a/synfire/synfire.py +++ b/synfire/synfire.py @@ -17,6 +17,7 @@ """ import matplotlib.pyplot as plt import pyNN.spiNNaker as sim + from spynnaker.pyNN.utilities import neo_convertor # number of neurons in each population diff --git a/synfire/synfire_collab.py b/synfire/synfire_collab.py index b34623d..0a162c6 100644 --- a/synfire/synfire_collab.py +++ b/synfire/synfire_collab.py @@ -17,6 +17,7 @@ """ import matplotlib.pyplot as plt import pyNN.spiNNaker as sim + from spynnaker.pyNN.utilities import neo_convertor # number of neurons in each population