SpiNNakerManchester/sPyNNaker8

setting V on a population or a view

Christian-B opened this issue · 3 comments

To set v the correct call is

population.set_initial_value("v", new_value)

We allow:
population.set(v=new_value)
Used in va_benchmark and random_balanced_network for example

BUT with
a_view = population[0:1]

a_view.set_initial_value("v", new_value)
gives
AttributeError: 'PopulationView' object has no attribute 'set_initial_value'

while
a_view..set(v=new_value)
gives
pynnaker.pyNN.exceptions.InvalidParameterType: Population IF_curr_exp does not have parameter v

Options:

  1. Allow populations to keep both but only implement set_initial_value for views

  2. Allow both on both

  3. Allow only set_initial_value for both

idmixin = population[0]
is an even bigger mess both give
spynnaker.pyNN.exceptions.InvalidParameterType: Population IF_curr_exp does not have parameter set

the fix to IDMixin.as_view method is
return self.__population[self.__id:self._id]

At a minimum, methods like this that work on a population should work on a view (or view-like thing such as the idmixin) too. The alternatives are far too difficult to explain to users.

Note: The offical PyNN is
x.initialize(v=uniformDistr) and that does work on a view