void iaf_psc_alpha::calibrate() { // ensures initialization in case mm connected after Simulate B_.logger_.init(); const double h = Time::get_resolution().get_ms(); // these P are independent V_.P11_ex_ = V_.P22_ex_ = std::exp( -h / P_.tau_ex_ ); V_.P11_in_ = V_.P22_in_ = std::exp( -h / P_.tau_in_ ); V_.P33_ = std::exp( -h / P_.Tau_ ); V_.expm1_tau_m_ = numerics::expm1( -h / P_.Tau_ ); // these depend on the above. Please do not change the order. V_.P30_ = -P_.Tau_ / P_.C_ * numerics::expm1( -h / P_.Tau_ ); V_.P21_ex_ = h * V_.P11_ex_; V_.P21_in_ = h * V_.P11_in_; // these are determined according to a numeric stability criterion V_.P31_ex_ = propagator_31( P_.tau_ex_, P_.Tau_, P_.C_, h ); V_.P32_ex_ = propagator_32( P_.tau_ex_, P_.Tau_, P_.C_, h ); V_.P31_in_ = propagator_31( P_.tau_in_, P_.Tau_, P_.C_, h ); V_.P32_in_ = propagator_32( P_.tau_in_, P_.Tau_, P_.C_, h ); V_.EPSCInitialValue_ = 1.0 * numerics::e / P_.tau_ex_; V_.IPSCInitialValue_ = 1.0 * numerics::e / P_.tau_in_; // TauR specifies the length of the absolute refractory period as // a double in ms. The grid based iaf_psc_alpha can only handle refractory // periods that are integer multiples of the computation step size (h). // To ensure consistency with the overall simulation scheme such conversion // should be carried out via objects of class nest::Time. The conversion // requires 2 steps: // 1. A time object is constructed defining representation of // TauR in tics. This representation is then converted to computation // time steps again by a strategy defined by class nest::Time. // 2. The refractory time in units of steps is read out get_steps(), a // member function of class nest::Time. // // The definition of the refractory period of the iaf_psc_alpha is consistent // the one of iaf_psc_alpha_ps. // // Choosing a TauR that is not an integer multiple of the computation time // step h will lead to accurate (up to the resolution h) and self-consistent // results. However, a neuron model capable of operating with real valued // spike time may exhibit a different effective refractory time. V_.RefractoryCounts_ = Time( Time::ms( P_.TauR_ ) ).get_steps(); // since t_ref_ >= 0, this can only fail in error assert( V_.RefractoryCounts_ >= 0 ); }
void nest::iaf_psc_alpha_canon::calibrate() { B_.logger_.init(); V_.h_ms_ = Time::get_resolution().get_ms(); V_.PSCInitialValue_ = 1.0 * numerics::e / P_.tau_syn_; V_.gamma_ = 1 / P_.c_m_ / ( 1 / P_.tau_syn_ - 1 / P_.tau_m_ ); V_.gamma_sq_ = 1 / P_.c_m_ / ( ( 1 / P_.tau_syn_ - 1 / P_.tau_m_ ) * ( 1 / P_.tau_syn_ - 1 / P_.tau_m_ ) ); // pre-compute matrix for full time step V_.expm1_tau_m_ = numerics::expm1( -V_.h_ms_ / P_.tau_m_ ); V_.expm1_tau_syn_ = numerics::expm1( -V_.h_ms_ / P_.tau_syn_ ); V_.P30_ = -P_.tau_m_ / P_.c_m_ * V_.expm1_tau_m_; // these are determined according to a numeric stability criterion V_.P31_ = propagator_31( P_.tau_syn_, P_.tau_m_, P_.c_m_, V_.h_ms_ ); V_.P32_ = propagator_32( P_.tau_syn_, P_.tau_m_, P_.c_m_, V_.h_ms_ ); // t_ref_ is the refractory period in ms // refractory_steps_ is the duration of the refractory period in whole // steps, rounded down V_.refractory_steps_ = Time( Time::ms( P_.t_ref_ ) ).get_steps(); // since t_ref_ >= sim step size, this can only fail in error assert( V_.refractory_steps_ >= 1 ); }
void iaf_psc_alpha_multisynapse::calibrate() { B_.logger_.init(); // ensures initialization in case mm connected after Simulate const double h = Time::get_resolution().get_ms(); P_.receptor_types_.resize( P_.num_of_receptors_ ); for ( size_t i = 0; i < P_.num_of_receptors_; i++ ) { P_.receptor_types_[ i ] = i + 1; } V_.P11_syn_.resize( P_.num_of_receptors_ ); V_.P21_syn_.resize( P_.num_of_receptors_ ); V_.P22_syn_.resize( P_.num_of_receptors_ ); V_.P31_syn_.resize( P_.num_of_receptors_ ); V_.P32_syn_.resize( P_.num_of_receptors_ ); S_.y1_syn_.resize( P_.num_of_receptors_ ); S_.y2_syn_.resize( P_.num_of_receptors_ ); V_.PSCInitialValues_.resize( P_.num_of_receptors_ ); B_.spikes_.resize( P_.num_of_receptors_ ); V_.P33_ = std::exp( -h / P_.Tau_ ); V_.P30_ = 1 / P_.C_ * ( 1 - V_.P33_ ) * P_.Tau_; for ( size_t i = 0; i < P_.num_of_receptors_; i++ ) { V_.P11_syn_[ i ] = V_.P22_syn_[ i ] = std::exp( -h / P_.tau_syn_[ i ] ); V_.P21_syn_[ i ] = h * V_.P11_syn_[ i ]; // these are determined according to a numeric stability criterion V_.P31_syn_[ i ] = propagator_31( P_.tau_syn_[ i ], P_.Tau_, P_.C_, h ); V_.P32_syn_[ i ] = propagator_32( P_.tau_syn_[ i ], P_.Tau_, P_.C_, h ); V_.PSCInitialValues_[ i ] = 1.0 * numerics::e / P_.tau_syn_[ i ]; B_.spikes_[ i ].resize(); } Time r = Time::ms( P_.TauR_ ); V_.RefractoryCounts_ = r.get_steps(); if ( V_.RefractoryCounts_ < 1 ) throw BadProperty( "Absolute refractory time must be at least one time step." ); }
void iaf_psc_alpha_multisynapse::calibrate() { // ensures initialization in case mm connected after Simulate B_.logger_.init(); const double h = Time::get_resolution().get_ms(); V_.P11_syn_.resize( P_.n_receptors_() ); V_.P21_syn_.resize( P_.n_receptors_() ); V_.P22_syn_.resize( P_.n_receptors_() ); V_.P31_syn_.resize( P_.n_receptors_() ); V_.P32_syn_.resize( P_.n_receptors_() ); S_.y1_syn_.resize( P_.n_receptors_() ); S_.y2_syn_.resize( P_.n_receptors_() ); V_.PSCInitialValues_.resize( P_.n_receptors_() ); B_.spikes_.resize( P_.n_receptors_() ); V_.P33_ = std::exp( -h / P_.Tau_ ); V_.P30_ = 1 / P_.C_ * ( 1 - V_.P33_ ) * P_.Tau_; for ( size_t i = 0; i < P_.n_receptors_(); i++ ) { V_.P11_syn_[ i ] = V_.P22_syn_[ i ] = std::exp( -h / P_.tau_syn_[ i ] ); V_.P21_syn_[ i ] = h * V_.P11_syn_[ i ]; // these are determined according to a numeric stability criterion V_.P31_syn_[ i ] = propagator_31( P_.tau_syn_[ i ], P_.Tau_, P_.C_, h ); V_.P32_syn_[ i ] = propagator_32( P_.tau_syn_[ i ], P_.Tau_, P_.C_, h ); V_.PSCInitialValues_[ i ] = 1.0 * numerics::e / P_.tau_syn_[ i ]; B_.spikes_[ i ].resize(); } V_.RefractoryCounts_ = Time( Time::ms( P_.refractory_time_ ) ).get_steps(); }