本文整理汇总了C++中SpikeEvent类的典型用法代码示例。如果您正苦于以下问题:C++ SpikeEvent类的具体用法?C++ SpikeEvent怎么用?C++ SpikeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpikeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
nest::spike_detector::handle( SpikeEvent& e )
{
// accept spikes only if detector was active when spike was
// emitted
if ( device_.is_active( e.get_stamp() ) )
{
assert( e.get_multiplicity() > 0 );
long dest_buffer;
if ( kernel()
.modelrange_manager.get_model_of_gid( e.get_sender_gid() )
->has_proxies() )
{
// events from central queue
dest_buffer = kernel().event_delivery_manager.read_toggle();
}
else
{
// locally delivered events
dest_buffer = kernel().event_delivery_manager.write_toggle();
}
for ( int i = 0; i < e.get_multiplicity(); ++i )
{
// We store the complete events
Event* event = e.clone();
B_.spikes_[ dest_buffer ].push_back( event );
}
}
}
示例2: assert
void
nest::izhikevich::handle( SpikeEvent& e )
{
assert( e.get_delay() > 0 );
B_.spikes_.add_value(
e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
示例3: assert
void
nest::iaf_neuron::handle( SpikeEvent& e )
{
assert( e.get_delay() > 0 );
B_.spikes_.add_value( e.get_rel_delivery_steps( network()->get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
示例4: assert
void nest::iaf_neuron_dif_alpha::handle(SpikeEvent & e)
{
assert(e.get_delay() > 0);
B_.spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight() * e.get_multiplicity() );
//std::cout<<"spike handle "<<e.get_stamp().get_ms()<<"\n";
}
示例5: assert
void
nest::sinusoidal_poisson_generator::update( Time const& origin,
const long from,
const long to )
{
assert(
to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() );
assert( from < to );
const long start = origin.get_steps();
// random number generator
librandom::RngPtr rng = kernel().rng_manager.get_rng( get_thread() );
// We iterate the dynamics even when the device is turned off,
// but do not issue spikes while it is off. In this way, the
// oscillators always have the right phase. This is quite
// time-consuming, so it should be done only if the device is
// on most of the time.
for ( long lag = from; lag < to; ++lag )
{
// update oscillator blocks, accumulate rate as sum of DC and N_osc_ AC
// elements rate is instantaneous sum of state
S_.rate_ = P_.rate_;
const double new_y_0 = V_.cos_ * S_.y_0_ - V_.sin_ * S_.y_1_;
S_.y_1_ = V_.sin_ * S_.y_0_ + V_.cos_ * S_.y_1_;
S_.y_0_ = new_y_0;
S_.rate_ += S_.y_1_;
if ( S_.rate_ < 0 )
{
S_.rate_ = 0;
}
// create spikes
if ( S_.rate_ > 0 && device_.is_active( Time::step( start + lag ) ) )
{
if ( P_.individual_spike_trains_ )
{
DSSpikeEvent se;
kernel().event_delivery_manager.send( *this, se, lag );
}
else
{
V_.poisson_dev_.set_lambda( S_.rate_ * V_.h_ );
long n_spikes = V_.poisson_dev_.ldev( rng );
SpikeEvent se;
se.set_multiplicity( n_spikes );
kernel().event_delivery_manager.send( *this, se, lag );
}
}
// store rate in Hz
B_.logger_.record_data( origin.get_steps() + lag );
}
}
示例6: assert
void
iaf_psc_alpha_multisynapse::handle( SpikeEvent& e )
{
assert( e.get_delay_steps() > 0 );
B_.spikes_[ e.get_rport() - 1 ].add_value(
e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
示例7: assert
void nest::spike_generator::update(Time const & sliceT0, const long_t from, const long_t to)
{
if ( P_.spike_stamps_.empty() )
return;
assert( !P_.precise_times_
|| P_.spike_stamps_.size() == P_.spike_offsets_.size() );
assert( P_.spike_weights_.empty()
|| P_.spike_stamps_.size() == P_.spike_weights_.size() );
const Time tstart = sliceT0 + Time::step(from);
const Time tstop = sliceT0 + Time::step(to);
const Time& origin = device_.get_origin();
// We fire all spikes with time stamps up to including sliceT0 + to
while ( S_.position_ < P_.spike_stamps_.size() )
{
const Time tnext_stamp = origin + P_.spike_stamps_[S_.position_];
// this might happen due to wrong usage of the generator
if ( tnext_stamp <= tstart )
{
++S_.position_;
continue;
}
if ( tnext_stamp > tstop )
break;
if ( device_.is_active(tnext_stamp) )
{
SpikeEvent* se;
// if we have to deliver weighted spikes, we need to get the
// event back to set its weight according to the entry in
// spike_weights_, so we use a DSSpike event and event_hook()
if ( !P_.spike_weights_.empty() )
se = new DSSpikeEvent;
else
se = new SpikeEvent;
if ( P_.precise_times_ )
se->set_offset(P_.spike_offsets_[S_.position_]);
// we need to subtract one from stamp which is added again in send()
long_t lag = Time(tnext_stamp - sliceT0).get_steps() - 1;
// all spikes are sent locally, so offset information is always preserved
network()->send(*this, *se, lag);
delete se;
}
++S_.position_;
}
}
示例8: assert
void
nest::iaf_psc_delta::handle( SpikeEvent& e )
{
assert( e.get_delay() > 0 );
// EX: We must compute the arrival time of the incoming spike
// explicity, since it depends on delay and offset within
// the update cycle. The way it is done here works, but
// is clumsy and should be improved.
B_.spikes_.add_value( e.get_rel_delivery_steps( network()->get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
示例9: assert
void
iaf_psc_alpha_multisynapse::handle( SpikeEvent& e )
{
assert( e.get_delay() > 0 );
for ( size_t i = 0; i < P_.num_of_receptors_; ++i )
{
if ( P_.receptor_types_[ i ] == e.get_rport() )
{
B_.spikes_[ i ].add_value( e.get_rel_delivery_steps( network()->get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
}
}
示例10: assert
void nest::iaf_cond_delta::handle(SpikeEvent & e)
{
assert(e.get_delay() > 0);
if(e.get_weight() > 0.0)
B_.spikes_ex_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight() * e.get_multiplicity() );
else
B_.spikes_in_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
-e.get_weight() * e.get_multiplicity() ); // note: conductance is positive for both exc and inh synapses but we use the sign of spike event weight to distinguish which kind of synapse it is
}
示例11: assert
void nest::aeif_cond_exp::handle(SpikeEvent &e)
{
assert ( e.get_delay() > 0 );
if(e.get_weight() > 0.0)
B_.spike_exc_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight() * e.get_multiplicity());
else
B_.spike_inh_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
-e.get_weight() * e.get_multiplicity()); // keep conductances positive
}
示例12: assert
void nest::hh_psc_alpha::handle(SpikeEvent & e)
{
assert(e.get_delay() > 0);
if(e.get_weight() > 0.0)
B_.spike_exc_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight() * e.get_multiplicity() );
else
B_.spike_inh_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight() * e.get_multiplicity() ); // current input, keep negative weight
}
示例13: handle
void ginzburg::handle(SpikeEvent & e)
{
assert(e.get_delay() > 0);
// The following logic implements the encoding:
// A single spike signals a transition to 0 state, two spikes in same time step
// signal the transition to 1 state.
//
// Remember the global id of the sender of the last spike being received
// this assumes that several spikes being sent by the same neuron in the same time step
// are received consecutively or are conveyed by setting the multiplicity accordingly.
long_t m = e.get_multiplicity();
long_t gid = e.get_sender_gid();
const Time &t_spike = e.get_stamp();
if (m == 1)
{ //multiplicity == 1, either a single 1->0 event or the first or second of a pair of 0->1 events
if (gid == S_.last_in_gid_ && t_spike == S_.t_last_in_spike_)
{
// received twice the same gid, so transition 0->1
// take double weight to compensate for subtracting first event
B_.spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
2.0*e.get_weight());
}
else
{
// count this event negatively, assuming it comes as single event
// transition 1->0
B_.spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
-e.get_weight());
}
}
else // multiplicity != 1
if (m == 2)
{
// count this event positively, transition 0->1
B_.spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
e.get_weight());
}
S_.last_in_gid_ = gid;
S_.t_last_in_spike_ = t_spike;
}
示例14: assert
void nest::iaf_psc_exp_ps::emit_instant_spike_(const Time & origin, const long_t lag,
const double_t spike_offs)
{
assert( S_.y2_ >= P_.U_th_ ); // ensure we are superthreshold
// set stamp and offset for spike
set_spiketime(Time::step(origin.get_steps() + lag + 1));
S_.last_spike_offset_ = spike_offs;
// reset neuron and make it refractory
S_.y2_ = P_.U_reset_;
S_.is_refractory_ = true;
// send spike
SpikeEvent se;
se.set_offset(S_.last_spike_offset_);
network()->send(*this, se, lag);
}
示例15: assert
void
nest::iaf_tum_2000::handle( SpikeEvent& e )
{
assert( e.get_delay() > 0 );
if ( e.get_weight() >= 0.0 )
B_.spikes_ex_.add_value( e.get_rel_delivery_steps( network()->get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
else
B_.spikes_in_.add_value( e.get_rel_delivery_steps( network()->get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}