Skip to content

Commit

Permalink
Minor tweaks to reduce/improve test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Feb 21, 2024
1 parent 75809a5 commit c680a2b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pyNN/nest/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_defaults(model_name):
if isinstance(value, valid_types):
default_params[name] = conversion.make_pynn_compatible(value)
else:
warnings.warn("Ignoring parameter '%s' since PyNN does not support %s" %
warnings.warn("Ignoring default NEST parameter '%s' since PyNN parameteres cannot be of type %s" %
(name, type(value)))
return default_params, default_initial_values

Expand Down
18 changes: 11 additions & 7 deletions test/system/scenarios/test_cell_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import sys
import numpy as np
try:
import scipy
Expand Down Expand Up @@ -34,7 +34,8 @@ def test_EIF_cond_alpha_isfa_ista(sim, plot_figure=False):
expected_spike_times) / expected_spike_times
assert abs(diff).max() < 0.01, abs(diff).max()
sim.end()
return data
if "pytest" not in sys.modules:
return data


@run_with_simulators("nest", "neuron", "brian2")
Expand Down Expand Up @@ -98,7 +99,8 @@ def issue367(sim, plot_figure=False):
vm_before_spike.mean())
assert abs((vm_before_spike.mean() - v_thresh) / v_thresh) < 0.01, err_msg
sim.end()
return data
if "pytest" not in sys.modules:
return data


@run_with_simulators("nest", "neuron", "brian2")
Expand Down Expand Up @@ -146,8 +148,8 @@ def test_SpikeSourcePoisson(sim, plot_figure=False):
alternative='two-sided')
print(expected_rate, expected_mean_isi, isi.mean(), p, D)
assert D < 0.1

return data
if "pytest" not in sys.modules:
return data


@run_with_simulators("nest", "neuron")
Expand Down Expand Up @@ -203,7 +205,8 @@ def test_SpikeSourceGamma(sim, plot_figure=False):
print(alpha, beta, expected_mean_isi, isi.mean(), p, D)
assert D < 0.1

return data
if "pytest" not in sys.modules:
return data


@run_with_simulators("nest", "neuron")
Expand Down Expand Up @@ -261,7 +264,8 @@ def test_SpikeSourcePoissonRefractory(sim, plot_figure=False):
print(expected_rate, poisson_mean_isi, corrected_isi.mean(), p, D)
assert D < 0.1

return data
if "pytest" not in sys.modules:
return data


@run_with_simulators("nest", "neuron", "brian2")
Expand Down
5 changes: 3 additions & 2 deletions test/system/scenarios/test_scenario2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import sys
import numpy as np
from .fixtures import run_with_simulators

Expand Down Expand Up @@ -54,7 +54,8 @@ def test_scenario2(sim):
print("max error =", max_error)
assert max_error < 0.005, max_error
sim.end()
return a, b, spike_times
if "pytest" not in sys.modules:
return a, b, spike_times


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion test/system/scenarios/test_scenario3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# encoding: utf-8

import sys
from pyNN.utility import init_logging
from pyNN.random import RandomDistribution
from .fixtures import run_with_simulators
Expand Down Expand Up @@ -92,7 +93,8 @@ def test_scenario3(sim):
assert p < 0.01, p
assert final_weights[:50, :].mean() < final_weights[50:, :].mean()
sim.end()
return initial_weights, final_weights, pre, post, connections
if "pytest" not in sys.modules:
return initial_weights, final_weights, pre, post, connections


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion test/system/scenarios/test_scenario4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


import logging
import sys
from pyNN.random import NumpyRNG, RandomDistribution
from pyNN.space import Space, Grid3D, RandomStructure, Cuboid
from pyNN.utility import init_logging
Expand Down Expand Up @@ -58,7 +59,8 @@ def test_scenario4(sim):
sim.run(1000.0)
data = outputs.get_data()
sim.end()
return data
if "pytest" not in sys.modules:
return data


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion test/system/scenarios/test_synapse_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import sys
import numpy as np
from .fixtures import run_with_simulators

Expand Down Expand Up @@ -38,7 +39,8 @@ def test_simple_stochastic_synapse(sim, plot_figure=False):
assert crossings[3].size == spike_times.size
assert not np.array_equal(crossings[1], crossings[2])
print(crossings[1].size / spike_times.size)
return data
if "pytest" not in sys.modules:
return data


if __name__ == '__main__':
Expand Down

0 comments on commit c680a2b

Please sign in to comment.