-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check spike times for spike source array #61
base: master
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, this makes sense and is a step towards implementing #19 more generally. Just a few suggestions
pynn_genn/standardmodels/cells.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use np.all(np.diff(x) >= 0)
then it handles the case of empty arrays
pynn_genn/model.py
Outdated
@@ -241,6 +241,8 @@ def build_genn_neuron(self, native_params, init_vals): | |||
return self.build_genn_model(self.neuron_defs, native_params, | |||
init_vals, creator) | |||
|
|||
def _test_parameters(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think _validate_parameters
might be a better name - test implies something about testing (to me at least)
pynn_genn/populations.py
Outdated
@@ -109,6 +109,8 @@ def __init__(self, size, cellclass, cellparams=None, structure=None, | |||
sanitize_label(label)) | |||
|
|||
def _create_cells(self): | |||
self.celltype._test_parameters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.