-
Notifications
You must be signed in to change notification settings - Fork 358
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
Converting some manualtests to tests used by installcheck #774
Conversation
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.
@hakonsbm Thanks for moving the tests! I have some minor comments, see inline. The two sinusoidal poisson tests contain a note in their documentation saying that they don't work with the testsuite. Those comments can now be deleted :).
stim = nest.Create('spike_generator') | ||
neuronA = nest.Create('parrot_neuron') | ||
neuronB = nest.Create('parrot_neuron') | ||
# recorder = nest.Create('spike_detector') |
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.
Remove unused code.
'weight': float(startWeight) / 15.0 * Wmax, | ||
'delay': delay, 'model': modelName}) | ||
# nest.Connect(neuronA, recorder) | ||
# nest.Connect(neuronB, recorder) |
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.
Remove unused code.
|
||
# just before theoretical updates | ||
weightTraceMod36pre = weightTrace[35::36] | ||
weightTraceMod36 = weightTrace[::36] # just after theoretical updates |
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.
The comment for line 123 is on line 122, the one for 124 on the same line.
self.assertLess(ratio, 1.5) | ||
|
||
isi = [] | ||
for i in xrange(1, len(spikes)): |
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.
xrange
disappears in Python 3. A much more efficient way to do this would be using numpy arrays.
self.assertLess(ratio, 1.5) | ||
|
||
isi = [] | ||
for i in xrange(1, len(spikes)): |
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.
See above.
# reproducible in NEST. Adaptive threshold changes rate, thus | ||
# the ratio is not asserted here. | ||
isi = [] | ||
for i in xrange(1, len(spikes)): |
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.
See above.
isi_m1 = isi[-1] | ||
isi_m2 = isi[-1] ** 2 | ||
isi_12 = 0. | ||
for t, t1 in zip(isi[:-1], isi[1:]): |
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.
See above.
|
||
(unittest) run | ||
/unittest using | ||
|
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.
This test requires GSL.
@@ -104,15 +104,10 @@ See also: test_sinusoidal_poisson_generator_{1,2,3,4,6}, test_sinusoidal_poisson | |||
% get events, replace vectors with SLI arrays | |||
% keep only non-empty arrays; empty ones are from off-process parrots | |||
(ALL LINES SHOULD BE EQUAL) == | |||
sdets { [/events /times] get cva } Map { empty not exch ; } Select | |||
sdets { [/events /times] get cva } Map { empty not exch ; } Select dup /spike_times Set | |||
{ == } forall |
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.
This line just prints all the spike times, filling the log with potentially garbled data from the two processes. I would remove it; then, you don't need the dup /spike_times Set
.
@@ -117,15 +117,10 @@ See also: test_sinusoidal_poisson_generator_{1,2,3,4,6}, test_sinusoidal_poisson | |||
% get events, replace vectors with SLI arrays | |||
% keep only non-empty arrays; empty ones are from off-process parrots | |||
(ALL LINES SHOULD BE DIFFERENT) == | |||
sdets { [/events /times] get cva } Map { empty not exch ; } Select | |||
sdets { [/events /times] get cva } Map { empty not exch ; } Select dup /sts Set | |||
{ == } forall |
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.
See above.
Removed unnecessary comments, printing; using numpy functions for efficiency; skipping if without GSL where needed.
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.
@hakonsbm Thanks for the fixes, just a few details left.
isi_var = (isi_m2 - isi_m1) ** 2 / len(isi) | ||
isi_mean = np.mean(isi) | ||
isi_var = np.var(isi) | ||
isi_12 = np.sum(np.multiply(isi[:-1], isi[1:])) |
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.
isi_12 = np.sum(isi[:-1] * isi[1:])
@@ -104,10 +98,9 @@ See also: test_sinusoidal_poisson_generator_{1,2,3,4,6}, test_sinusoidal_poisson | |||
% get events, replace vectors with SLI arrays | |||
% keep only non-empty arrays; empty ones are from off-process parrots | |||
(ALL LINES SHOULD BE EQUAL) == |
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.
This output should also be removed.
@@ -117,10 +112,8 @@ See also: test_sinusoidal_poisson_generator_{1,2,3,4,6}, test_sinusoidal_poisson | |||
% get events, replace vectors with SLI arrays | |||
% keep only non-empty arrays; empty ones are from off-process parrots | |||
(ALL LINES SHOULD BE DIFFERENT) == |
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.
This output should also be removed.
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.
Many thanks for the effort. I sent you a pull requests with minor changes to formatting of the comments. If those are merged, I have no objections to merging this one.
@heplesser, @hakonsbm: does this PR also mean that all other tests in |
Minor changes to comments and formatting
Sorry, my commit introduced a pep8 error (see Travis log). I've sent another PR fixing this. The current failure above, however, is not in the code touched by this PR or my changes but in the compilation of MUSIC. It happens when the Maybe a simple re-run helps... |
@jougs: @heplesser and I just went though the rest of the tests to see which can be fixed/converted to examples and which should be deleted. @stinebuu and I will work on it. |
My last commit message was a bit unclear. The tests deleted are tests that are now irrelevant. |
Probably we could switch back to the old images by adding the group: deprecated-2017Q2 instead of "edge" |
@heplesser Some of the tests were missing reference values, or had other problems. @stinebuu and I are still waiting for replies from the authors of these tests, requesting guidance as to how they can be converted, or if they can be deleted. |
The remaining problematic tests in the manualtests directory are now
|
The SLI modifications are now discussed in issue nest#811.
@suku248, @abigailm: can you please have a look at the @mhelias: can you please do the same for Thanks! |
|
@suku248 Could you create an issue to remind us to create proper tests for dopa? |
As far as I see the |
converted cross_check_mip_corrdet to PyNEST example
Pep8ify, removed manualtest from testsuite cmakelist.
@jougs The |
@jougs I added this to 2.14, since it appears done and ready to merge. |
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.
Many thanks for this important clean-up :-)
This PR updates and converts some of the tests in the manualtests folder to proper unittests. This includes the
test_sinusoidal_poisson_generator_{5,6}
tests, and therefore resolves issue #348.I was unable to convert all the tests because of problems such as missing input files, dependence on external programs, and erroneous output.