Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into weight_scale
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgait committed Sep 29, 2023
2 parents 6d8cd64 + 7f5f333 commit d009719
Show file tree
Hide file tree
Showing 56 changed files with 11 additions and 3,381 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ jobs:
coveralls-token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint with flake8
run: flake8 ${{ env.BASE_PKG }} spynnaker8 unittests spynnaker_integration_tests
run: flake8 ${{ env.BASE_PKG }} unittests spynnaker_integration_tests

- name: Lint with pylint
uses: ./support/actions/pylint
with:
package: ${{ env.BASE_PKG }} spynnaker8
package: ${{ env.BASE_PKG }}
language: en_GB

validate:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ install_requires =
matplotlib
pyparsing>=2.2.1,<3.0.0
quantities
pynn >= 0.11; python_version >= '3.8'
pynn >= 0.11, != 0.12.0; python_version >= '3.8'
neo; python_version >= '3.8'
lazyarray; python_version >= '3.8'
# python 3.7 is no longer officially supported
Expand Down
46 changes: 0 additions & 46 deletions spynnaker/pyNN/abstract_spinnaker_common.py

This file was deleted.

144 changes: 0 additions & 144 deletions spynnaker/pyNN/models/populations/population_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ def _we_dont_do_this_now(*args): # pylint: disable=unused-argument
raise NotImplementedError("sPyNNaker does not currently do this")


def _this_is_wholly_deprecated(msg, *args): # pylint: disable=unused-argument
# pragma: no cover
raise NotImplementedError(msg)


class PopulationBase(object, metaclass=AbstractBase):
r"""
Shared methods between :py:class:`Population`\ s and
Expand Down Expand Up @@ -75,16 +70,6 @@ def __add__(self, other):
# TODO: support assemblies
_we_dont_do_this_now(other) # pragma: no cover

def getSpikes(self, *args, **kwargs): # pylint: disable=unused-argument
"""
.. deprecated:: 5.0
Use ``get_data('spikes')`` instead.
"""
logger.warning(
'getSpikes is deprecated. Call transfered to get_data("spikes") '
'without additional arguments')
return self.get_data("spikes")

@abstractmethod
def get_data(self, variables='all', gather=True, clear=False,
annotations=None):
Expand Down Expand Up @@ -112,17 +97,6 @@ def get_data(self, variables='all', gather=True, clear=False,
:rtype: ~neo.core.Block
"""

def get_gsyn(self, *args, **kwargs): # pylint: disable=unused-argument
"""
.. deprecated:: 5.0
Use ``get_data(['gsyn_exc', 'gsyn_inh'])`` instead.
"""
logger.warning(
'get_gsyn is deprecated. '
'Call transfered to get_data(["gsyn_exc", "gsyn_inh"]) '
'without additional arguments')
return self.get_data(['gsyn_exc', 'gsyn_inh'])

@abstractmethod
def get_spike_counts(self, gather=True):
"""
Expand All @@ -142,16 +116,6 @@ def get_spike_counts(self, gather=True):
:rtype: dict(int, int)
"""

def get_v(self, *args, **kwargs): # pylint: disable=unused-argument
"""
.. deprecated:: 5.0
Use ``get_data('v')`` instead.
"""
logger.warning(
'getSpikes is deprecated. '
'Call transfered to get_data("v") without additional arguments')
return self.get_data("v")

@abstractmethod
def inject(self, current_source):
"""
Expand Down Expand Up @@ -185,16 +149,6 @@ def local_size(self):
"is_local always returns size")
return len(self)

def meanSpikeCount(self, *args, **kwargs):
"""
.. deprecated:: 5.0
Use ``mean_spike_count()`` instead.
"""
logger.warning(
'meanSpikeCount is deprecated. '
'Call transfered to mean_spike_count with additional arguements')
return self.mean_spike_count(*args, **kwargs)

def mean_spike_count(self, gather=True):
"""
Returns the mean number of spikes per neuron.
Expand Down Expand Up @@ -284,57 +238,6 @@ def write_data(self, io, variables='all', gather=True, clear=False,
"""
# pylint: disable=too-many-arguments

def printSpikes(self, filename, gather=True):
"""
.. deprecated:: 5.0
Use ``write_data(file, 'spikes')`` instead.
.. note::
Method signature is the PyNN0.7 one
"""
if not gather:
warn_once(
logger, "sPyNNaker only supports gather=True. We will run "
"as if gather was set to True.")
logger.warning(
'printSpikes is deprecated. '
'Call transfered to write_data(file, "spikes", gatherer) instead.')
self.write_data(filename, 'spikes', gather=True)

def print_gsyn(self, filename, gather=True):
"""
.. deprecated:: 5.0
Use ``write_data(file, ['gsyn_exc', 'gsyn_inh'])`` instead.
.. note::
Method signature is the PyNN0.7 one
"""
if not gather:
warn_once(
logger, "sPyNNaker only supports gather=True. We will run "
"as if gather was set to True.")
logger.warning(
'print_gsyn is deprecated. Call transfered to '
'write_data(file, ["gsyn_exc", "gsyn_inh"], gatherer) instead.')
self.write_data(filename, ['gsyn_exc', 'gsyn_inh'], gather=True)

def print_v(self, filename, gather=True):
"""
.. deprecated:: 5.0
Use ``write_data(file, 'v')`` instead.
.. note::
Method signature is the PyNN0.7 one
"""
if not gather:
warn_once(
logger, "sPyNNaker only supports gather=True. We will run "
"as if gather was set to True.")
logger.warning(
'print_v is deprecated. '
'Call transfered to write_data(file, "v", gatherer) instead.')
self.write_data(filename, 'v', gather=True)

def receptor_types(self):
"""
.. note::
Expand Down Expand Up @@ -362,45 +265,6 @@ def record(self, variables, to_file=None, sampling_interval=None):
multiple of the simulation timestep.
"""

def record_gsyn(self, sampling_interval=1, to_file=None):
"""
.. deprecated:: 5.0
Use ``record(['gsyn_exc', 'gsyn_inh'])`` instead.
.. note::
Method signature is the PyNN 0.7 one
with the extra non-PyNN `sampling_interval` and `indexes`
"""
logger.warning(
'record_gsyn is deprecated. Call transfered to '
'record(["gsyn_exc", "gsyn_inh"], tofile) instead.')
return self.record(
['gsyn_exc', 'gsyn_inh'], to_file=to_file,
sampling_interval=sampling_interval)

def record_v(self, sampling_interval=1, to_file=None):
"""
.. deprecated:: 5.0
Use ``record('v')`` instead.
.. note::
Method signature is the PyNN 0.7 one
with the extra non-PyNN `sampling_interval` and `indexes`
"""
logger.warning('record_v is deprecated. '
'Call transfered to record(["v"], .....) instead.')
return self.record(
'v', to_file=to_file,
sampling_interval=sampling_interval)

def rset(self, *args, **kwargs):
"""
.. deprecated:: 5.0
Use ``set(parametername=rand_distr)`` instead.
"""
_this_is_wholly_deprecated(
" Use set(parametername=rand_distr) instead.", args, kwargs)

def save_positions(self, file): # pylint: disable=redefined-builtin
"""
Save positions to file. The output format is index x y z
Expand All @@ -424,14 +288,6 @@ def structure(self):
# TODO: support neuron positions and spaces
_we_dont_do_this_now() # pragma: no cover

def tset(self, **kwargs):
"""
.. deprecated:: 5.0
Use ``set(parametername=value_array)`` instead.
"""
_this_is_wholly_deprecated(
"Use set(parametername=value_array) instead.", kwargs)

@abstractproperty
def _vertex(self):
"""
Expand Down
2 changes: 0 additions & 2 deletions spynnaker/pyNN/setup_pynn.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ def install_sPyNNaker_into(module):
spinnaker_init = os.path.join(spinnaker_dir, "__init__.py")
with open(spinnaker_init, "w", encoding="utf-8") as spinn_file:
spinn_file.write("from spynnaker.pyNN import *\n")
# To revert back to spynnaker8 use this line instead of the above
# spinn_file.write("from spynnaker8 import *\n")

print(f"Created {spinnaker_init} to point to spynnaker.pyNN")

Expand Down
6 changes: 2 additions & 4 deletions spynnaker/pyNN/spinnaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
spynnaker_splitter_selector)
from spynnaker.pyNN.utilities import constants
from spynnaker.pyNN.utilities.neo_buffer_database import NeoBufferDatabase
from spynnaker.pyNN.utilities.utility_calls import (
moved_in_v7_warning)


logger = FormatAdapter(logging.getLogger(__name__))

Expand Down Expand Up @@ -194,7 +193,7 @@ def state(self):
Used to bypass the dual level object.
:return: the SpiNNaker object
:rtype: ~spynnaker8.spinnaker.SpiNNaker
:rtype: ~spynnaker.pyNN.SpiNNaker
"""
return self

Expand Down Expand Up @@ -385,7 +384,6 @@ def register_binary_search_path(search_path):
:param str search_path: absolute search path for binaries
"""
# pylint: disable=protected-access
moved_in_v7_warning("register_binary_search_path is now a View method")
SpynnakerDataView.register_binary_search_path(search_path)

def _execute_spynnaker_ordered_covering_compressor(self):
Expand Down
41 changes: 0 additions & 41 deletions spynnaker/pyNN/utilities/utility_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,47 +431,6 @@ def float_gcd_of_array(input_array):
return gcd


def moved_in_v6(old_location, _):
"""
Tells the users that old code is no longer implemented.
:param str old_location: old import
:raise: NotImplementedError
"""
raise NotImplementedError(f"Old import: {old_location}")


def moved_in_v7(old_location, new_location):
"""
Warns the users that they are using an old import.
In version 8 this will be upgraded to a exception and then later removed
:param str old_location: old import
:param str new_location: new import
:raise NotImplementedError: if in CONTINUOUS_INTEGRATION
"""
if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true':
raise NotImplementedError(f"Old import: {old_location}")
logger.warning("File {} moved to {}. Please fix your imports. "
"In version 8 this will fail completely.",
old_location, new_location)


def moved_in_v7_warning(message):
"""
Warns the user that they are using old code.
In version 8 this will be upgraded to a exception and then later removed
:param str message:
:raise NotImplementedError: if in CONTINUOUS_INTEGRATION
"""
if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true':
raise NotImplementedError(message)
logger.warning("{} In version 8 old call will fail completely.", message)


def get_time_to_write_us(n_bytes, n_cores):
"""
Determine how long a write of a given number of bytes will take in us.
Expand Down

0 comments on commit d009719

Please sign in to comment.