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
Change in GetStructrualPlasticityStatus format #775
Changes from 1 commit
410fc60
c0867cf
8c2ba66
eed059f
7498528
8b89de7
d559b1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,14 +234,20 @@ def SetStructuralPlasticityStatus(params): | |
|
||
|
||
@check_stack | ||
def GetStructuralPlasticityStatus(params): | ||
def GetStructuralPlasticityStatus(keys = None): | ||
"""Get the current structural plasticity parameters for the network | ||
simulation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please document the |
||
""" | ||
|
||
sps(params) | ||
sps({}) | ||
sr('GetStructuralPlasticityStatus') | ||
return spp() | ||
d = spp() | ||
if keys is None: | ||
return d | ||
elif is_literal(keys): | ||
return d[keys] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left it plural but allow now a list like in GetStatus :) |
||
else: | ||
raise TypeError("keys should be either empty or a string") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "should" is not a good term here, as it implies a recommendation, not a requirement, while we have strict requirements on the type of |
||
|
||
|
||
@check_stack | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ | |
from . import test_disconnect | ||
from . import test_disconnect_multiple | ||
from . import test_enable_multithread | ||
from . import test_get_sp_status | ||
|
||
HAVE_MPI = nest.sli_func("statusdict/have_mpi ::") | ||
if HAVE_MPI: | ||
print ("Testing with MPI") | ||
|
@@ -60,9 +62,10 @@ def suite(): | |
test_suite.addTest(test_growth_curves.suite()) | ||
test_suite.addTest(test_sp_manager.suite()) | ||
test_suite.addTest(test_synaptic_elements.suite()) | ||
test_suite.addTest(test_disconnect.suite()) | ||
#test_suite.addTest(test_disconnect.suite()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you commenting out the disconnection test? Either activate it again or delete the line entirely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a mistake, I will remove the comment it now. |
||
test_suite.addTest(test_disconnect_multiple.suite()) | ||
test_suite.addTest(test_enable_multithread.suite()) | ||
test_suite.addTest(test_get_sp_status.suite()) | ||
|
||
return test_suite | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# test_get_sp_status.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 | ||
# 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/>. | ||
|
||
''' | ||
Structural Plasticity GetStatus Test | ||
----------------------- | ||
This test shows how to use the GetStructuralPlasticityStatus function | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test should rather show that the function works correctly. That it also illustrates how to use the function is rather a (welcome) side-effect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, will correct the text |
||
''' | ||
|
||
|
||
import nest | ||
import unittest | ||
|
||
__author__ = 'sdiaz' | ||
|
||
|
||
class TestGetStructuralPlasticityStatus(unittest.TestCase): | ||
|
||
neuron_model = 'iaf_psc_alpha' | ||
nest.CopyModel('static_synapse', 'synapse_ex') | ||
nest.SetDefaults('synapse_ex', {'weight': 1.0, 'delay': 1.0}) | ||
nest.SetStructuralPlasticityStatus({ | ||
'structural_plasticity_synapses': { | ||
'synapse_ex': { | ||
'model': 'synapse_ex', | ||
'post_synaptic_element': 'Den_ex', | ||
'pre_synaptic_element': 'Axon_ex', | ||
}, | ||
} | ||
}) | ||
|
||
growth_curve = { | ||
'growth_curve': "gaussian", | ||
'growth_rate': 0.0001, # (elements/ms) | ||
'continuous': False, | ||
'eta': 0.0, # Ca2+ | ||
'eps': 0.05 | ||
} | ||
|
||
''' | ||
Now we assign the growth curves to the corresponding synaptic elements | ||
''' | ||
synaptic_elements = { | ||
'Den_ex': growth_curve, | ||
'Den_in': growth_curve, | ||
'Axon_ex': growth_curve, | ||
} | ||
nodes = nest.Create(neuron_model, | ||
2, | ||
{'synaptic_elements': synaptic_elements}) | ||
|
||
all = nest.GetStructuralPlasticityStatus() | ||
print (all) | ||
assert('structural_plasticity_synapses' in all) | ||
assert('structural_plasticity_update_interval' in all) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you not testing the values here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just want to know that the elements have been gathered by the call to get status but I can test the values too :) |
||
|
||
sp_synapses = nest.GetStructuralPlasticityStatus('structural_plasticity_synapses') | ||
print (sp_synapses) | ||
assert('pre_synaptic_element' in sp_synapses['syn1']) | ||
assert('post_synaptic_element' in sp_synapses['syn1']) | ||
|
||
sp_interval = nest.GetStructuralPlasticityStatus('structural_plasticity_update_interval') | ||
print (sp_interval) | ||
assert(sp_interval == 1000) | ||
|
||
def suite(): | ||
test_suite = unittest.makeSuite(TestGetStructuralPlasticityStatus, 'test') | ||
return test_suite | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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.
No spaces around
=
in parameter lists.