SpiNNakerManchester / sPyNNaker

The SpiNNaker implementation of the PyNN neural networking language
Apache License 2.0
100 stars 42 forks source link

Depreciated syntax in HBCP neuromorphic guidebook example #414

Closed russelljjarvis closed 6 years ago

russelljjarvis commented 6 years ago

On page 2 of the HBP Neuromorphic Computing Platform Guidebook Release 2017-08-03 09:39:24 (2da6726)

There is this example code:

import numpy as np
import matplotlib.pyplot as plt
import pyNN.spiNNaker as sim
sim.setup(timestep=1.0, min_delay=1.0)
# create cells
cell_params = {
    'cm': 0.25, 'tau_m': 10.0, 'tau_refrac': 2.0,
    'tau_syn_E': 2.5, 'tau_syn_I': 2.5,
    'v_reset': -70.0, 'v_rest': -65.0, 'v_thresh': -55.0 }
neurons = sim.Population(100, sim.IF_cond_exp, cell_params)
inputs = sim.Population(100, sim.SpikeSourcePoisson, {"rate": 0.0})
# set input firing rates as a linear function of cell index
input_firing_rates = np.linspace(0.0, 1000.0, num=inputs.size)
inputs.tset("rate", input_firing_rates)

The code fails, because tset is no longer a method of the inputs object.

Executing:

print(dir(inputs))

Shows inputs has a set method, but no tset, set cannot be substituted in the place of tset however, as it does something else. There is also a small issue with unbalanced string comments in that example:

"""A population of integrate-and-firing neurons with different input firing rates"" ,!"
"""

I found that the code from this article runs okay however:

An implementation of benchmarks 1 and 2 from Brette et al. (2007) Journal of Computational Neuroscience 23: 349-398 Andrew Davison, UNIC, CNRS

Also please don't hesitate to direct me to a more documentation focused place to raise this GH issue.

andrewgait commented 6 years ago

The most recent version of this guidebook (which I didn't know existed until now) is at: https://flagship.kip.uni-heidelberg.de/jss/FileExchange/HBPNeuromorphicComputingPlatformGuidebook.pdf?fID=1504&s=qqdXDg6HuX3&uID=65 and it still contains the same script.

The reason this is not working on SpiNNaker is because pyNN.spiNNaker now uses PyNN version 0.8 and this script was written for PyNN version 0.7. I will look into getting this updated in the documentation (I believe Heidelberg maintain the guidebook, so I'll have to communicate with them); in the meantime, if you'd like a working version of this script with the latest SpiNNaker software then reply to this thread and let us know.

alan-stokes commented 6 years ago

oops. we kinda support our side of that workbook. Id completely forgotten it exists. I did at one point have its repos on my machine, but that's the desktop, not the laptop. I have no idea how to get access to it anymore. Will explore when bandwidth is less stressed.

andrewgait commented 6 years ago

I've got access to the repository now, so I've made a start to the required changes. https://github.com/electronicvisions/hbp-sp9-guidebook/pull/14

alan-stokes commented 6 years ago

yey. thanks old boy

alan-stokes commented 6 years ago

can be closed as functionality now fixed in master. still note that using the collab will need to be updated to either use master or wait til the next release cycle, where the portal will be updated