Skip to content
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

Merged
merged 3 commits into from
Mar 21, 2019

Conversation

dnao
Copy link
Contributor

@dnao dnao commented Jan 5, 2019

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.

@terhorstd terhorstd added T: Enhancement New functionality, model or documentation ZC: Model DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Jan 7, 2019
Copy link
Contributor

@janhahne janhahne left a 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.

@@ -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.
Copy link
Contributor

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

@dnao
Copy link
Contributor Author

dnao commented Jan 8, 2019

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?

@janhahne
Copy link
Contributor

janhahne commented Jan 8, 2019

@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).

Copy link
Contributor

@heplesser heplesser left a 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].

Copy link
Contributor

@janhahne janhahne left a 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]]

models/hh_cond_beta_gap_traub.h Outdated Show resolved Hide resolved
models/CMakeLists.txt Outdated Show resolved Hide resolved
@dnao
Copy link
Contributor Author

dnao commented Feb 10, 2019

@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?

@janhahne
Copy link
Contributor

@dnao Thanks, the test looks fine! I agree that it would be better to create a new PR for the fix of models/iaf_cond_beta. Maybe just undo the (outdated) changes to models/iaf_cond_beta.cpp here and apply the correct normalisation in a new PR.

The indent in models/CMakeLists.txt is still wrong, please have another look there. Also see my inline comment about set_potential and get_potential. Otherwise I am happy with this PR!

@heplesser Did you meant to approve this PR when asking for the NEST Contributor Agreement or do you want to have another look?

@dnao
Copy link
Contributor Author

dnao commented Feb 12, 2019

Thanks @janhahne . I've removed the functions set_potential and get_potential. If these changes are OK now then I will squash them into a single commit.

Copy link
Contributor

@janhahne janhahne left a 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 👍

@jougs
Copy link
Contributor

jougs commented Feb 21, 2019

@janhahne, @heplesser: can this be merged now? Thanks!

Copy link
Contributor

@clinssen clinssen left a 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.

double denom1 = tau_decay - tau_rise;
double denom2 = 0;
double normalisation_factor = 0;
if ( denom1 != 0 )
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

@heplesser heplesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnao I added suggestions to comments by @clinssen. Once those are fixed, the PR should be ready to merge.

@heplesser
Copy link
Contributor

#329 discusses a problem with spike generation in the hh_cond_exp_traub model, which most likely also applies here. So we need to update this model once we have a solution for #329.

@heplesser
Copy link
Contributor

@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.

@heplesser
Copy link
Contributor

@dnao All looks good now, except that one regression test fails. It is expected that this test fails for hh_cond_beta_gap_traub. In order to exclude your model from being tested, please go to file testsuite/regressiontests/ticket-421.sli and add hh_cond_beta_gap_traub to the list of excluded models in the proper alphabetical position:

/exclude_models [/aeif_cond_exp /aeif_cond_alpha /aeif_cond_alpha_RK5 /a2eif_cond_exp /a2eif_cond_exp_HW 
                 /aeif_cond_alpha_multisynapse /aeif_psc_delta_clopath
                 /aeif_psc_exp /aeif_psc_alpha /aeif_psc_delta /aeif_cond_beta_multisynapse /hh_cond_exp_traub
                 /hh_psc_alpha /hh_psc_alpha_clopath /hh_psc_alpha_gap /ht_neuron /ht_neuron_fs
                 /iaf_cond_exp_sfa_rr /izhikevich] def

clang-format for previous changes

Added exception to SLI tests for hh_cond_beta_gap_traub
@heplesser heplesser changed the title Create hh_cond_beta_gap_traub Add new neuron model hh_cond_beta_gap_traub Mar 21, 2019
@heplesser heplesser merged commit aab86c5 into nest:master Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation ZC: Model DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants