Check spike times for spike source array#61
Conversation
PyNN requires a test for spike times which are to be emitted by a SpikeSourceArray, they need to be provided 'in order' from lower to higher times.
…or_SpikeSourceArray
|
Why not just sort each array of spike times in |
The problem is that the test pynn_genn/test/system/scenarios/test_cell_types.py Lines 331 to 336 in 4415114 expects the population to throw an exception if the order is wrong |
neworderofjamie
left a comment
There was a problem hiding this comment.
In that case, this makes sense and is a step towards implementing #19 more generally. Just a few suggestions
| raise errors.InvalidParameterValueError( | ||
| "Spike times given to SpikeSourceArray must be in increasing order") | ||
| seq = seq.value | ||
| if len(seq): |
There was a problem hiding this comment.
If you use np.all(np.diff(x) >= 0) then it handles the case of empty arrays
| return self.build_genn_model(self.neuron_defs, native_params, | ||
| init_vals, creator) | ||
|
|
||
| def _test_parameters(self): |
There was a problem hiding this comment.
I think _validate_parameters might be a better name - test implies something about testing (to me at least)
| sanitize_label(label)) | ||
|
|
||
| def _create_cells(self): | ||
| self.celltype._test_parameters() |
There was a problem hiding this comment.
I think maybe this should be called after you've made the deep copy of the parameters and set it's shape (so you'd need something more like self.celltype._test_parameters(self._parameters)). Otherwise, I suspect spike_times.shape may often be None (I can't honestly remember when that happened but it definitely does)
used numpy.diff to test the order of spike times
|
I was just checking on the build machine and, this change has now caused https://github.com/genn-team/pynn_genn/blob/master/test/system/scenarios/test_procedural_api.py#L9 to fail. I can't quite see why tbh... |
|
I think test_procedural_api.py: ticket195() was failing due to this. I had forgotten to remove an incorrect version of this test from the 'use_pynn_array_test_utils' branch. |
No description provided.