Exemplo n.º 1
0
void nest::iaf_chs_2007::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() );
}
Exemplo n.º 2
0
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 
}
Exemplo n.º 3
0
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
}
Exemplo n.º 4
0
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
}
void
nest::iaf_cond_exp_sfa_rr::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );

  if ( e.get_weight() > 0.0 )
    B_.spike_exc_.add_value(
      e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  else
    B_.spike_inh_.add_value(
      e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
      -e.get_weight() * e.get_multiplicity() ); // ensure conductance is positive
}
Exemplo n.º 6
0
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( kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  else
    B_.spikes_in_.add_value(
      e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
}
void
nest::sli_neuron::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );

  if ( e.get_weight() > 0.0 )
    B_.ex_spikes_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  else
    B_.in_spikes_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
}
// function handles exact spike times
void
nest::iaf_psc_alpha_presc::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );

  const long_t Tdeliver = e.get_rel_delivery_steps(
    nest::kernel().simulation_manager.get_slice_origin() );

  const double_t spike_weight =
    V_.PSCInitialValue_ * e.get_weight() * e.get_multiplicity();
  const double_t dt = e.get_offset();

  // Building the new matrix for the offset of the spike
  // NOTE: We do not use get matrix, but compute only those
  //       components we actually need for spike registration
  // needed in any case
  const double_t ps_e_TauSyn = numerics::expm1( -dt / P_.tau_syn_ );
  const double_t ps_e_Tau = numerics::expm1( -dt / P_.tau_m_ );
  const double_t ps_P31 = V_.gamma_sq_ * ps_e_Tau - V_.gamma_sq_ * ps_e_TauSyn
    - dt * V_.gamma_ * ps_e_TauSyn - dt * V_.gamma_;

  B_.spike_y1_.add_value( Tdeliver, spike_weight * ps_e_TauSyn + spike_weight );
  B_.spike_y2_.add_value(
    Tdeliver, spike_weight * dt * ps_e_TauSyn + spike_weight * dt );
  B_.spike_y3_.add_value( Tdeliver, spike_weight * ps_P31 );
}
void
iaf_psc_alpha::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );

  const double s = e.get_weight() * e.get_multiplicity();

  if ( e.get_weight() > 0.0 )
    B_.ex_spikes_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      s );
  else
    B_.in_spikes_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      s );
}
Exemplo n.º 10
0
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() );
}
Exemplo n.º 11
0
void
nest::izhikevich::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() );
}
Exemplo n.º 12
0
  void nest::hh_cond_exp_traub::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
      {
	// add with negative weight, ie positive value, since we are changing a
	// conductance
	B_.spike_inh_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
				-e.get_weight() * e.get_multiplicity());
      }
  }
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";
}
Exemplo n.º 14
0
void nest::iaf_psc_alpha_mod::handle(SpikeEvent & e)
{
  assert(e.get_delay() > 0);

  // port 0: spikes are normally handled.
  if(e.get_rport() == 0 ){
    if(e.get_weight() > 0.0)
      B_.ex_spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
			      e.get_weight() * e.get_multiplicity() );
    else
      B_.in_spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
			      e.get_weight() * e.get_multiplicity() );
  }
  // port 1: spikes act as modulators for all spikes that arrive at....
  if(e.get_rport() == 1 ){
    B_.modspikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
			    e.get_weight() * e.get_multiplicity() );
  }

  // ....port 2. These weights get modulated.
  if(e.get_rport() == 2 ){
    if(e.get_weight() > 0.0){
      double tmpweight =  e.get_weight() * (1.0 + S_.ymod_) ;
      tmpweight        = (tmpweight > P_.max_weight_ ? P_.max_weight_ : tmpweight);
      B_.ex_spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
			      tmpweight * e.get_multiplicity() );
    }

    else
      B_.in_spikes_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
			      e.get_weight() * e.get_multiplicity() );
  }
}
void mynest::coronet_neuron::handle(SpikeEvent & e)
{
    assert(e.get_delay() > 0);
    assert(e.get_rport() < static_cast<int_t>(B_.spike_inputs_.size()));

    B_.spike_inputs_[e.get_rport()].
      add_value(e.get_rel_delivery_steps(network()->get_slice_origin()),
		e.get_weight() * e.get_multiplicity() );
}
Exemplo n.º 16
0
void
nest::amat2_psc_exp::handle( SpikeEvent& e )
{
  assert( e.get_delay_steps() > 0 );

  if ( e.get_weight() >= 0.0 )
  {
    B_.spikes_ex_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  }
  else
  {
    B_.spikes_in_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  }
}
Exemplo n.º 17
0
void
nest::aeif_cond_alpha_RK5::handle( SpikeEvent& e )
{
  assert( e.get_delay_steps() > 0 );

  if ( e.get_weight() > 0.0 )
  {
    B_.spike_exc_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  }
  else
  {
    B_.spike_inh_.add_value( e.get_rel_delivery_steps(
                               kernel().simulation_manager.get_slice_origin() ),
      -e.get_weight() * e.get_multiplicity() );
  } // keep conductances positive
}
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() );
}
Exemplo n.º 19
0
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;
}
void
aeif_cond_alpha_multisynapse::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );
  assert( ( e.get_rport() > 0 ) && ( ( size_t ) e.get_rport() <= P_.num_of_receptors_ ) );

  if ( e.get_weight() > 0.0 )
  {
    B_.spike_exc_[ e.get_rport() - 1 ].add_value(
      e.get_rel_delivery_steps( network()->get_slice_origin() ),
      e.get_weight() * e.get_multiplicity() );
  }
  else
  {
    B_.spike_inh_[ e.get_rport() - 1 ].add_value(
      e.get_rel_delivery_steps( network()->get_slice_origin() ),
      -e.get_weight() * e.get_multiplicity() ); // keep conductances positive
  }
}
Exemplo n.º 21
0
void
nest::iaf_cond_alpha_mc::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );
  assert( 0 <= e.get_rport() && e.get_rport() < 2 * NCOMP );

  B_.spikes_[ e.get_rport() ].add_value(
    e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
    e.get_weight() * e.get_multiplicity() );
}
Exemplo n.º 22
0
void
nest::ht_neuron::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );
  assert( e.get_rport() < static_cast< int_t >( B_.spike_inputs_.size() ) );

  B_.spike_inputs_[ e.get_rport() ].add_value(
    e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ),
    e.get_weight() * e.get_multiplicity() );
}
void
gif_psc_exp_multisynapse::handle( SpikeEvent& e )
{
  assert( e.get_delay() > 0 );
  assert( ( e.get_rport() > 0 )
    && ( ( size_t ) e.get_rport() <= P_.n_receptors_() ) );

  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() );
}
Exemplo n.º 24
0
void pif_psc_delta_canon_cvv::handle(SpikeEvent & e)
{
  assert(e.get_delay() > 0);

  /* We need to compute the absolute time stamp of the delivery time
     of the spike, since spikes might spend longer than min_delay_
     in the queue.  The time is computed according to Time Memo, Rule 3.
  */
  const long_t Tdeliver = e.get_stamp().get_steps() + e.get_delay() - 1;
  B_.events_.add_spike(e.get_rel_delivery_steps(network()->get_slice_origin()), 
		    Tdeliver, e.get_offset(), e.get_weight() * e.get_multiplicity());
}
Exemplo n.º 25
0
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() );
}
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() );
    }
  }
}
void
nest::correlomatrix_detector::handle( SpikeEvent& e )
{
  // The receiver port identifies the sending node in our
  // sender list.
  const rport sender = e.get_rport();

  // If this assertion breaks, the sender does not honor the
  // receiver port during connection or sending.
  assert( 0 <= sender && sender <= P_.N_channels_ - 1 );

  // accept spikes only if detector was active when spike was emitted
  Time const stamp = e.get_stamp();

  if ( device_.is_active( stamp ) )
  {
    const long_t spike_i = stamp.get_steps();

    // find first appearence of element which is greater than spike_i
    const Spike_ sp_i( spike_i, e.get_multiplicity() * e.get_weight(), sender );
    SpikelistType::iterator insert_pos = std::find_if(
      S_.incoming_.begin(), S_.incoming_.end(), std::bind2nd( std::greater< Spike_ >(), sp_i ) );

    // insert before the position we have found
    // if no element greater found, insert_pos == end(), so append at the end of the deque
    S_.incoming_.insert( insert_pos, sp_i );

    SpikelistType& otherSpikes = S_.incoming_;
    const double_t tau_edge = P_.tau_max_.get_steps() + 0.5 * P_.delta_tau_.get_steps();

    // throw away all spikes which are too old to
    // enter the correlation window
    const delay min_delay = Scheduler::get_min_delay();
    while (
      !otherSpikes.empty() && ( spike_i - otherSpikes.front().timestep_ ) >= tau_edge + min_delay )
      otherSpikes.pop_front();
    // all remaining spike times in the queue are >= spike_i - tau_edge - min_delay

    // only count events in histogram, if the current event is within the time window [Tstart,
    // Tstop]
    // this is needed in order to prevent boundary effects
    if ( P_.Tstart_ <= stamp && stamp <= P_.Tstop_ )
    {
      // calculate the effect of this spike immediately with respect to all
      // spikes in the past of the respectively other sources

      S_.n_events_[ sender ]++; // count this spike

      for ( SpikelistType::const_iterator spike_j = otherSpikes.begin();
            spike_j != otherSpikes.end();
            ++spike_j )
      {
        size_t bin;
        long_t other = spike_j->receptor_channel_;
        long_t sender_ind, other_ind;

        if ( spike_i < spike_j->timestep_ )
        {
          sender_ind = other;
          other_ind = sender;
        }
        else
        {
          sender_ind = sender;
          other_ind = other;
        }

        if ( sender_ind <= other_ind )
        {
          bin = -1. * std::floor( ( 0.5 * P_.delta_tau_.get_steps()
                                    - std::abs( spike_i - spike_j->timestep_ ) )
                        / P_.delta_tau_.get_steps() );
        }
        else
        {
          bin = std::floor(
            ( 0.5 * P_.delta_tau_.get_steps() + std::abs( spike_i - spike_j->timestep_ ) )
            / P_.delta_tau_.get_steps() );
        }

        if ( bin < S_.covariance_[ sender_ind ][ other_ind ].size() )
        {
          // weighted histogram
          S_.covariance_[ sender_ind ][ other_ind ][ bin ] +=
            e.get_multiplicity() * e.get_weight() * spike_j->weight_;
          if ( bin == 0 && ( spike_i - spike_j->timestep_ != 0 || other != sender ) )
            S_.covariance_[ other_ind ][ sender_ind ][ bin ] +=
              e.get_multiplicity() * e.get_weight() * spike_j->weight_;
          // pure (unweighted) count histogram
          S_.count_covariance_[ sender_ind ][ other_ind ][ bin ] += e.get_multiplicity();
          if ( bin == 0 && ( spike_i - spike_j->timestep_ != 0 || other != sender ) )
            S_.count_covariance_[ other_ind ][ sender_ind ][ bin ] += e.get_multiplicity();
        }
      }

    } // t in [TStart, Tstop]

  } // device active
}