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
Fixes for the gif multisynapse and quantal_stp model #846
Changes from 4 commits
38234ae
4db51ff
8a8339a
37eac3d
8b0e9e9
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 |
---|---|---|
|
@@ -98,7 +98,7 @@ nest::gif_cond_exp_multisynapse_dynamics( double, | |
double I_syn = 0.0; | ||
for ( size_t i = 0; i < node.P_.n_receptors(); ++i ) | ||
{ | ||
const size_t j = i * S::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR; | ||
const size_t j = i * S::NUM_STATE_ELEMENTS_PER_RECEPTOR; | ||
I_syn += -y[ S::G + j ] * ( V - node.P_.E_rev_[ i ] ); | ||
} | ||
|
||
|
@@ -109,7 +109,7 @@ nest::gif_cond_exp_multisynapse_dynamics( double, | |
// outputs: dg/dt | ||
for ( size_t i = 0; i < node.P_.n_receptors(); i++ ) | ||
{ | ||
const size_t j = i * S::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR; | ||
const size_t j = i * S::NUM_STATE_ELEMENTS_PER_RECEPTOR; | ||
f[ S::G + j ] = -y[ S::G + j ] / node.P_.tau_syn_[ i ]; | ||
} | ||
|
||
|
@@ -127,11 +127,11 @@ nest::gif_cond_exp_multisynapse::Parameters_::Parameters_() | |
, V_reset_( -55.0 ) // mV | ||
, Delta_V_( 0.5 ) // mV | ||
, V_T_star_( -35 ) // mV | ||
, lambda_0_( 0.001 ) // 1/ms | ||
, lambda_0_( 1. ) // 1/s | ||
, t_ref_( 4.0 ) // ms | ||
, c_m_( 80.0 ) // pF | ||
, tau_stc_() // ms | ||
, q_stc_() // nA | ||
, q_stc_() // pA | ||
, tau_sfa_() // ms | ||
, q_sfa_() // mV | ||
, tau_syn_( 1, 2.0 ) // ms | ||
|
@@ -143,8 +143,7 @@ nest::gif_cond_exp_multisynapse::Parameters_::Parameters_() | |
} | ||
|
||
nest::gif_cond_exp_multisynapse::State_::State_( const Parameters_& p ) | ||
: y_( STATE_VEC_SIZE, 0.0 ) | ||
, size_neuron_state_( 0 ) | ||
: y_( STATE_VEC_SIZE + NUM_STATE_ELEMENTS_PER_RECEPTOR, 0.0 ) | ||
, I_stim_( 0.0 ) | ||
, sfa_( 0.0 ) | ||
, stc_( 0.0 ) | ||
|
@@ -174,7 +173,6 @@ nest::gif_cond_exp_multisynapse::State_::State_( const State_& s ) | |
} | ||
|
||
y_ = s.y_; | ||
size_neuron_state_ = s.size_neuron_state_; | ||
} | ||
|
||
nest::gif_cond_exp_multisynapse::State_& | ||
|
@@ -196,7 +194,6 @@ nest::gif_cond_exp_multisynapse::State_& | |
} | ||
|
||
y_ = s.y_; | ||
size_neuron_state_ = s.size_neuron_state_; | ||
|
||
I_stim_ = s.I_stim_; | ||
sfa_ = s.sfa_; | ||
|
@@ -377,12 +374,11 @@ nest::gif_cond_exp_multisynapse::State_::get( DictionaryDatum& d, | |
std::vector< double >* g = new std::vector< double >(); | ||
|
||
for ( size_t i = 0; | ||
i < ( ( y_.size() - State_::NUMBER_OF_FIXED_STATES_ELEMENTS ) | ||
/ ( State_::STATE_VEC_SIZE - 1 ) ); | ||
i < ( y_.size() - State_::NUMBER_OF_FIXED_STATES_ELEMENTS ); | ||
++i ) | ||
{ | ||
g->push_back( | ||
y_[ State_::G + State_::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR * i ] ); | ||
y_[ State_::G + State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * i ] ); | ||
} | ||
|
||
( *d )[ names::g ] = DoubleVectorDatum( g ); | ||
|
@@ -393,6 +389,12 @@ nest::gif_cond_exp_multisynapse::State_::set( const DictionaryDatum& d, | |
const Parameters_& p ) | ||
{ | ||
updateValue< double >( d, names::V_m, y_[ V_M ] ); | ||
y_.resize( State_::NUMBER_OF_FIXED_STATES_ELEMENTS | ||
+ State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * p.n_receptors(), | ||
0.0 ); | ||
|
||
sfa_elems_.resize( p.tau_sfa_.size(), 0.0 ); | ||
stc_elems_.resize( p.tau_stc_.size(), 0.0 ); | ||
} | ||
|
||
nest::gif_cond_exp_multisynapse::Buffers_::Buffers_( | ||
|
@@ -475,7 +477,10 @@ nest::gif_cond_exp_multisynapse::init_state_( const Node& proto ) | |
void | ||
nest::gif_cond_exp_multisynapse::init_buffers_() | ||
{ | ||
B_.spikes_.clear(); // includes resize | ||
B_.spikes_.resize( P_.n_receptors() ); | ||
for (size_t i =0; i < P_.n_receptors(); ++i) | ||
B_.spikes_[i].clear(); // includes resize | ||
|
||
B_.currents_.clear(); //!< includes resize | ||
B_.logger_.reset(); //!< includes resize | ||
Archiving_Node::clear_history(); | ||
|
@@ -521,15 +526,6 @@ nest::gif_cond_exp_multisynapse::init_buffers_() | |
void | ||
nest::gif_cond_exp_multisynapse::calibrate() | ||
{ | ||
|
||
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. Could you explain your changes at this point in more detail? Do I understand correctly that you can remove this here because the state vectors and buffers are now correctly resized in 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 don't understand what you want me to remove. Is it in the calibrate 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. No need to remove anything, I just wanted some more explanation. It is fine for me now. |
||
B_.spikes_.resize( P_.n_receptors() ); | ||
|
||
S_.y_.resize( State_::NUMBER_OF_FIXED_STATES_ELEMENTS | ||
+ ( State_::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR * P_.n_receptors() ), | ||
0.0 ); | ||
|
||
S_.size_neuron_state_ = S_.y_.size(); | ||
|
||
B_.sys_.dimension = S_.y_.size(); | ||
|
||
B_.logger_.init(); | ||
|
@@ -549,13 +545,11 @@ nest::gif_cond_exp_multisynapse::calibrate() | |
{ | ||
V_.P_sfa_[ i ] = std::exp( -h / P_.tau_sfa_[ i ] ); | ||
} | ||
S_.sfa_elems_.resize( P_.tau_sfa_.size(), 0.0 ); | ||
|
||
for ( size_t i = 0; i < P_.tau_stc_.size(); i++ ) | ||
{ | ||
V_.P_stc_[ i ] = std::exp( -h / P_.tau_stc_[ i ] ); | ||
} | ||
S_.stc_elems_.resize( P_.tau_stc_.size(), 0.0 ); | ||
} | ||
|
||
/* ---------------------------------------------------------------- | ||
|
@@ -624,7 +618,7 @@ nest::gif_cond_exp_multisynapse::update( Time const& origin, | |
|
||
for ( size_t i = 0; i < P_.n_receptors(); i++ ) | ||
{ | ||
S_.y_[ State_::G + ( State_::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR | ||
S_.y_[ State_::G + ( State_::NUM_STATE_ELEMENTS_PER_RECEPTOR | ||
* i ) ] += B_.spikes_[ i ].get_value( lag ); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,14 +118,14 @@ | |
|
||
Spike adaptation and firing intensity parameters: | ||
q_stc vector of double - Values added to spike-triggered currents (stc) | ||
after each spike emission in nA. | ||
after each spike emission in pA. | ||
tau_stc vector of double - Time constants of stc variables in ms. | ||
q_sfa vector of double - Values added to spike-frequency adaptation | ||
(sfa) after each spike emission in mV. | ||
tau_sfa vector of double - Time constants of sfa variables in ms. | ||
Delta_V double - Stochasticity level in mV. | ||
lambda_0 double - Stochastic intensity at firing threshold V_T in 1/s. | ||
V_T_star double - Base threshold in mV | ||
V_T_star double - Base threshold in mV. | ||
|
||
Synaptic parameters | ||
tau_syn double vector - Time constants of the synaptic conductance | ||
|
@@ -240,7 +240,7 @@ class gif_cond_exp_multisynapse : public Archiving_Node | |
double V_reset_; | ||
double Delta_V_; | ||
double V_T_star_; | ||
double lambda_0_; /** 1/ms */ | ||
double lambda_0_; /** 1/s */ | ||
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. Must remain 1/ms, see above. |
||
|
||
/** Refractory period in ms. */ | ||
double t_ref_; | ||
|
@@ -306,10 +306,9 @@ class gif_cond_exp_multisynapse : public Archiving_Node | |
}; | ||
|
||
static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS = 1; //!< V_M | ||
static const size_t NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR = 1; //!< G | ||
static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR = 1; //!< G | ||
|
||
std::vector< double > y_; //!< neuron state | ||
unsigned int size_neuron_state_; // size of neuron state array | ||
|
||
double I_stim_; //!< This is piecewise constant external current | ||
double sfa_; //!< This is the change of the 'threshold' due to adaptation. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,8 +197,6 @@ Quantal_StpConnection< targetidentifierT >::send( Event& e, | |
double t_lastspike, | ||
const CommonSynapseProperties& ) | ||
{ | ||
const int vp = get_target( t )->get_vp(); | ||
|
||
const double h = e.get_stamp().get_ms() - t_lastspike; | ||
|
||
// Compute the decay factors, based on the time since the last spike. | ||
|
@@ -212,7 +210,7 @@ Quantal_StpConnection< targetidentifierT >::send( Event& e, | |
// Compute number of sites that recovered during the interval. | ||
for ( int depleted = n_ - a_; depleted > 0; --depleted ) | ||
{ | ||
if ( kernel().rng_manager.get_rng( vp )->drand() < ( 1.0 - p_decay ) ) | ||
if ( kernel().rng_manager.get_rng( t )->drand() < ( 1.0 - p_decay ) ) | ||
{ | ||
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. You can now remove line 200 of this file where the virtual process id is retrieved since it is now longer needed. |
||
++a_; | ||
} | ||
|
@@ -222,7 +220,7 @@ Quantal_StpConnection< targetidentifierT >::send( Event& e, | |
int n_release = 0; | ||
for ( int i = a_; i > 0; --i ) | ||
{ | ||
if ( kernel().rng_manager.get_rng( vp )->drand() < u_ ) | ||
if ( kernel().rng_manager.get_rng( t )->drand() < u_ ) | ||
{ | ||
++n_release; | ||
} | ||
|
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 must remain in milliseconds, since the value is used as
i.e., it is multiplied by a value in milliseconds.
The user provides/retrieves
lambda_0
in 1/s; the value is converted to the internal units of 1/ms inParameters_::get()/set()
. This is the standard approach in NEST.