Skip to content

Commit f5e33fb

Browse files
authored
Merge pull request #3717 from thomaskroi1996/replace-numpy.in1d
Replace numpy.in1d() with numpy.isin() in testsuite
2 parents 5d15d57 + 1648c57 commit f5e33fb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

testsuite/pytests/sli2py_recording/test_compare_delta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ def test_simulation_completes():
6363

6464
spike_recs = spike_recorder.get("events", ["senders", "times"])
6565

66-
assert np.all(np.in1d(np.array([1, 2]), spike_recs["senders"].T[:2]))
66+
assert np.all(np.isin(np.array([1, 2]), spike_recs["senders"].T[:2]))
6767
assert np.all(spike_recs["times"].T[:2] == pytest.approx(4.1))

testsuite/pytests/sli2py_regressions/test_ticket_941.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ def test_different_connections():
9595

9696
synapses = nest.GetConnections(source=pn1, target=pn2).get("synapse_model")
9797
expected_synapses = ["static_synapse", "static_synapse", "static_synapse_hom_w"]
98-
assert np.all(np.in1d(expected_synapses, synapses))
98+
assert np.all(np.isin(expected_synapses, synapses))

testsuite/pytests/test_urbanczik_synapse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_SynapseDepressionFacilitation(self):
229229
if len(spike_times_soma) > 0:
230230
t = np.around(t, 4)
231231
spike_times_soma = np.around(spike_times_soma + 0.2, 4)
232-
idx = np.nonzero(np.in1d(t, spike_times_soma))[0]
232+
idx = np.nonzero(np.isin(t, spike_times_soma))[0]
233233
rate[idx] -= 1.0 / resolution
234234

235235
w_change_raw = -15.0 * C_m_prox * rate * h * alpha_response
@@ -247,7 +247,7 @@ def test_SynapseDepressionFacilitation(self):
247247
comparison between Nest and python implementation
248248
"""
249249
# extract the weight computed in python at the times of the presynaptic spikes
250-
idx = np.nonzero(np.in1d(np.around(t, 4), np.around(pre_syn_spike_times + resolution, 4)))[0]
250+
idx = np.nonzero(np.isin(np.around(t, 4), np.around(pre_syn_spike_times + resolution, 4)))[0]
251251
syn_w_comp_at_spike_times = syn_weight_comp[idx]
252252
realtive_error = (weights[-1] - syn_w_comp_at_spike_times[-1]) / (weights[-1] - init_w)
253253

0 commit comments

Comments
 (0)