-
Notifications
You must be signed in to change notification settings - Fork 371
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
aEIF psc models #513
aEIF psc models #513
Conversation
@Silmathoron @heplesser if you agree I can review this PR |
Of course you can ;) |
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.
@Silmathoron Except for a few small things, this looks fine to me.
@@ -94,19 +94,20 @@ nest::aeif_psc_alpha_dynamics( double, | |||
// good compiler will optimize the verbosity away ... | |||
|
|||
// shorthand for state variables | |||
const double& V = std::min( y[ S::V_M ], node.P_.V_peak_ ); // bound V | |||
const double& V = std::min( y[ S::V_M ], node.P_.V_peak_ ); // bind V to the |
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 would suggest bound V by V_peak
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 think this comment relates to an outdated version, current comment is
// bind V to the USER DEFINED V_peak_ value in Parameters.
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.
@Silmathoron The English language is a challenging one: "bound" is both past tense of "bind" and a verb in its own right meaning "to confine" or "to limit". The original comment uses "bound" in the second meaning. "Bind" would be incorrect here, since it implied tying the membrane potential to V_peak, instead of just having V_peak as an upper limit. But this discussions shows the need for clearer language, so I would suggest: // enforce upper limit on V_m
.
I would not mention "USER DEFINED V_peak_ value in Parameters", since that is clear from the code.
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.
done!
const double I_spike = | ||
node.P_.Delta_T * std::exp( ( V - node.P_.V_th ) / node.P_.Delta_T ); | ||
const double I_spike = node.P_.Delta_T == 0. ? 0. : node.P_.g_L | ||
* node.P_.Delta_T * std::exp( ( V - node.P_.V_th ) / node.P_.Delta_T ); |
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.
For clarity, I would put the entire expression after :
in parentheses, even though they are not strictly needed in C++.
@@ -94,17 +94,18 @@ nest::aeif_psc_exp_dynamics( double, const double y[], double f[], void* pnode ) | |||
// good compiler will optimize the verbosity away ... | |||
|
|||
// shorthand for state variables | |||
const double& V = std::min( y[ S::V_M ], node.P_.V_peak_ ); | |||
const double& V = std::min( y[ S::V_M ], node.P_.V_peak_ ); // bind V to the | |||
// USER DEFINED V_peak_ value in Parameters. |
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.
See suggestion or alpha
above.
const double I_spike = | ||
node.P_.Delta_T * std::exp( ( V - node.P_.V_th ) / node.P_.Delta_T ); | ||
const double I_spike = node.P_.Delta_T == 0. ? 0. : node.P_.g_L | ||
* node.P_.Delta_T * std::exp( ( V - node.P_.V_th ) / node.P_.Delta_T ); |
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.
Also here parentheses around all afer :
would be helpful.
@golosio I am happy with the code, how about you? |
I have just very little suggestions/doubts |
|
||
updateValue< double >( d, names::gsl_error_tol, gsl_error_tol ); | ||
|
||
if ( V_reset_ >= V_peak_ ) |
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 seems that also here the check that V_peak_ > V_th is missing
* ---------------------------------------------------------------- */ | ||
|
||
nest::aeif_psc_alpha::Parameters_::Parameters_() | ||
: V_peak_( 0.0 ) // mV, should not be larger that V_th+10 |
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've seen this comment in all aeif models, but I do not understand it. Why shouldn't V_peak be larger that V_th+10? Even looking at the default values, the default value of V_th is -50.4, while V_peak is zero, so the difference is larger than 10. Am I missing something?
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 never noticed that! It looks completely irrelevant to me...
@heplesser any thought on that?
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 think the idea here is that the larger the V_th to V_peak is, the worse does the exploding-exponential problem become. But I think we handle this well elsewhere now, so the comment can be removed.
|
||
updateValue< double >( d, names::gsl_error_tol, gsl_error_tol ); | ||
|
||
if ( V_reset_ >= V_peak_ ) |
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.
See above about the check that V_peak > V_th
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.
Right, I forgot about that, thanks for reminding me! ;)
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.
Besides the very little issues above, everything looks fine to me.
Ok, I readded the missing test to all |
…hould not be larger that V_th+10" comment on V_peak_
@Silmathoron @heplesser everythng is ok for me, I think this PR can be merged |
@Silmathoron Thanks for putting the test back in! But I think we should allow V_peak == V_th. Also, I would write the error message as |
…all aeif models except beta_multisynapse
Ok, done! @golosio I'll let you do the changes on the |
@Silmathoron Thanks for your efforts, all is well now! Together with @golosio's 👍, I will merge. |
This PR adds implementations of the aEIF model with post-synaptic currents:
aeif_psc_alpha
aeif_psc_exp
Test is provided via an update of
test_aeif_lsodar.py
and by some of the usual suites such asissue-77.sli
, which was modified.