-
Notifications
You must be signed in to change notification settings - Fork 384
Port regression test 310 to Pytests #3474
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7de0d78
sli2py -mistral
jessica-mitchell b54e0f0
Merge branch 'master' of github.com:nest/nest-simulator into jm_310
heplesser 7a86e0b
Nicely parameterize test
heplesser ae7deb6
Merge pull request #27 from heplesser/jm_310
jessica-mitchell 00e6947
Fix typo.
heplesser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# test_ticket_310.py | ||
# | ||
# This file is part of NEST. | ||
# | ||
# Copyright (C) 2004 The NEST Initiative | ||
# | ||
# NEST is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# NEST is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
0 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with NEST. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import nest | ||
import pytest | ||
|
||
# Models to skip to do given reasons | ||
skip_list = [ | ||
"correlospinmatrix_detector", # not a neuron | ||
"eprop_iaf_bsshslm_2020", # no ArchivingNode, thus no t_spike | ||
"eprop_iaf_adapt_bsshslm_2020", # no ArchivingNode, thus no t_spike | ||
"eprop_readout_bsshslm_2020", # no ArchivingNode, thus no t_spike | ||
"eprop_iaf", # no ArchivingNode, thus no t_spike | ||
"eprop_iaf_adapt", # no ArchivingNode, thus no t_spike | ||
"eprop_iaf_psc_delta", # no ArchivingNode, thus no t_spike | ||
"eprop_iaf_psc_delta_adapt", # no ArchivingNode, thus no t_spike | ||
"eprop_readout", # no ArchivingNode, thus no t_spike | ||
"iaf_chxk_2008", # non-standard spiking conditions | ||
"izhikevich", # generating output spike not reliably suppressed even for subthreshold V_m | ||
] | ||
|
||
|
||
def has_Vm_and_Vth(model): | ||
params = nest.GetDefaults(model) | ||
return "V_m" in params and "V_th" in params | ||
|
||
|
||
relevant_models = [model for model in nest.node_models if model not in skip_list and has_Vm_and_Vth(model)] | ||
|
||
|
||
@pytest.mark.parametrize("model", relevant_models) | ||
def test_ticket_310(model): | ||
""" | ||
Regression test for Ticket #310. | ||
|
||
Ensure that all neuron models that have V_m and V_th permit | ||
V_m to be set to >= V_th, and that they emit a spike with | ||
time stamp == resolution in that case. | ||
|
||
Author: Hans Ekkehard Plesser, 2009-02-11 | ||
""" | ||
|
||
time_resolution = 2**-3 # Use power-of-two resolution to avoid round-off problems | ||
|
||
nest.ResetKernel() | ||
nest.resolution = time_resolution | ||
|
||
nrn = nest.Create(model) | ||
nrn.V_m = nrn.V_th + 15 | ||
|
||
nest.Simulate(time_resolution) | ||
|
||
assert 0 < nrn.t_spike <= time_resolution # for precise neurons, < is possible; -1 if never spiked |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.