NeuralEnsemble/PyNN — pull request #283 by obreitwi (2014-02-12 18:01:42+00:00)
Title: pyNN.nest: Fixed being unable to use native synapse types that used either array-like parameters or common properties.

I had to make some adjustments in pyNN.nest to get some native synapse types (e.g. `stdp_facetshw_synapse_hom`) to work if those employed either array-shaped parameters or made use of common properties that are stored only once per particular synapse model.

Currently 0.8beta1 gives the following output (taken from a test case I added to `test_nest.py`):
```
======================================================================
FAIL: test_create_with_native_synapse (__main__.TestProjection)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/unittests/test_nest.py", line 97, in test_create_with_native_synapse
synapse_type=synapse_type())
File "/afsuser/obreitwi/usr/opt/software/pynn/0.8beta1/lib/python2.7/site-packages/pyNN/models.py", line 106, in __init__
shape=None)
File "/afsuser/obreitwi/usr/opt/software/pynn/0.8beta1/lib/python2.7/site-packages/pyNN/parameters.py", line 201, in __init
self.update(**parameters)
File "/afsuser/obreitwi/usr/opt/software/pynn/0.8beta1/lib/python2.7/site-packages/pyNN/parameters.py", line 258, in update
dtype=expected_dtype)
File "/afsuser/obreitwi/usr/opt/software/pynn/0.8beta1/lib/python2.7/site-packages/pyNN/parameters.py", line 56, in __init_
super(LazyArray, self).__init__(value, shape, dtype)
File "/afsuser/obreitwi/usr/opt/software/lazyarray/0.2.2/lib/python2.7/site-packages/lazyarray.py", line 174, in __init__
assert value.dtype == dtype # or could convert value to the provided dtype
AssertionError
```

There were two problems to fix:
1. Conversion from numpy arrays returned from nest to pyNN sequences and vice versa.
2. pyNN.nest not distinguishing between common parameters that are set for the whole synapse model (that is already copied for each projection) and local parameters that are local to the actual connections.

If the user specifies heterogeneous values for a common synapse property, the behavior is undefined (the value of the last connection will be used for the whole projection). However, I think it is reasonable to assume that the user knows what he is doing when using a native NEST synapse type.