-
Notifications
You must be signed in to change notification settings - Fork 370
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
Add new neuron model hh_cond_beta_gap_traub #1098
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.
@dnao Before I take a closer look please run extras/format_all_c_c++_files.sh
to fix the formatting issues and add the new model to the ignore list in testsuite/regressiontests/ticket-421.sli
and pynest/nest/tests/test_refractory.py
to prevent those unit tests from failing.
models/iaf_cond_beta.cpp
Outdated
@@ -373,7 +373,7 @@ nest::iaf_cond_beta::get_normalisation_factor( double tau_rise, | |||
double tau_decay ) | |||
{ | |||
// Factor used to normalise the synaptic conductance such that | |||
// | |||
// incoming spike causes a conductance of amplitude 1 nS. |
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 seems unrelated to this PR, but its probably fine to fix it here
Done, though I haven't had much luck using clang-format with the config file in the nest directory. I find that the CI requires some additional formatting different to what the script produces. I'm using clang 7.0 so perhaps I should switch to 3.6? Would it be a bad idea to squash and rebase all these commits to make this PR less cluttered? |
@dnao Thank you! With clang 3.6 the automatic formatting works (at least for me) without any need for further adjustments, so it is probably a good idea to use version 3.6. Regarding your second question: It is not at all a bad idea, it is very welcome (however not mandatory). |
9acf5cb
to
4a392ac
Compare
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.
@dnao Thank you for your contribution. Please download the NEST Contributor Agreement which you can find at the bottom of http://nest.github.io/nest-simulator/, fill it in, scan it and send it to [email protected].
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.
@dnao The code (especially the implementation of the gap junctions) looks good to me. I only have two small inline comments and suggest to add a unit test similiar to testsuite/unittests/test_hh_psc_alpha_gap.sli
. This would ensure the functionality of the gap-junction implementation in the model in the future (given that it is correct at the moment). You can basicly copy the existing test and just replace the model in lines 73-74 with the new model and adjust the reference solution in lines 111ff with the reference solution of this new model (as stated below)
[[1 -5.999900e+01] [2 -5.998700e+01] [3 -5.996700e+01] [4 -5.994400e+01] [5 -5.991900e+01] [6 -5.989200e+01] [7 -5.986400e+01] [8 -5.983500e+01] [9 -5.980400e+01] [10 -5.977300e+01] [11 -5.974000e+01] [12 -5.970700e+01] [13 -5.967200e+01] [14 -5.963500e+01] [15 -5.959800e+01] [117 -7.791800e+01] [118 -7.778200e+01] [119 -7.764800e+01] [120 -7.751400e+01] [121 -7.738100e+01] [122 -7.724900e+01] [123 -7.711700e+01] [124 -7.698700e+01] [125 -7.685700e+01] [126 -7.672800e+01] [127 -7.660000e+01] [128 -7.647200e+01] [129 -7.634600e+01] [130 -7.622000e+01] [131 -7.609400e+01] [190 -6.982400e+01] [191 -6.973400e+01] [192 -6.964500e+01] [193 -6.955600e+01] [194 -6.946700e+01] [195 -6.937900e+01] [196 -6.929100e+01] [197 -6.920400e+01] [198 -6.911700e+01] [199 -6.903100e+01]]
@janhahne I have added the unit tests you suggested and also fixed the normalisation so incoming spikes cause a peak conductance of 1nS as with other models using beta-function synapses. I will need to fix the same normalisation issue in the iaf_cond_beta model but perhaps it is better if I make a new PR for that? |
@dnao Thanks, the test looks fine! I agree that it would be better to create a new PR for the fix of The indent in @heplesser Did you meant to approve this PR when asking for the NEST Contributor Agreement or do you want to have another look? |
Thanks @janhahne . I've removed the functions |
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.
Everything looks fine now, thanks 👍
40d6b2c
to
a1d2087
Compare
@janhahne, @heplesser: can this be merged now? Thanks! |
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.
I'm approving this PR based on going through the code, but did not do any functional testing.
models/hh_cond_beta_gap_traub.cpp
Outdated
double denom1 = tau_decay - tau_rise; | ||
double denom2 = 0; | ||
double normalisation_factor = 0; | ||
if ( denom1 != 0 ) |
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.
I suggest replacing the condition with |denom1| < std::numeric_limits< double >::epsilon()
Also: why is denom2 calculated inside the first if block? Can we use the return-early pattern here?
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.
I agree with the suggestion to check std::abs(denom1) < std::numeric_limits< double >
makes sense, also applies to the check for denom2
.
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.
Hi, this section of the code is the same as aeif_cond_beta_multisynapse, so I suggest these changes should also apply there.
} | ||
else | ||
// ( threshold && maximum ) | ||
if ( S_.y_[ State_::V_M ] >= P_.V_T + 30. |
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.
Where does the value 30 come from? Can we give this a name and move it to a private const member variable?
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.
It is exactly the same code as in hh_cond_exp_traub
, so I suggest to leave this as it its.
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.
@dnao Using Github's web-based tools, I just resolved a merge conflict that had occurred due to merging #1095 into master, see commit bacfb05. Could you take a look at my comments above? If you could respond to them within a few days, we should be able to merge this PR in time for the next NEST release. |
@dnao All looks good now, except that one regression test fails. It is expected that this test fails for
|
clang-format for previous changes Added exception to SLI tests for hh_cond_beta_gap_traub
32baa8c
to
7ae6998
Compare
I have created a new neuron model by modifying the hh_psc_alpha_gap and hh_cond_exp_traub models. It uses beta-function synapses and gap junction coupling. Though I have attempted to follow the existing models closely, feedback would be appreciated as there may be some interactions between the dynamics and synaptic/gap junction conductance which I have not considered.