23#ifndef BINARY_NEURON_H
24#define BINARY_NEURON_H
74template <
class TGainfunction >
123 friend class UniversalDataLogger<
binary_neuron< TGainfunction > >;
225template <
class TGainfunction >
230 e.set_sender( *
this );
232 return target.handles_test_event( e, receptor_type );
235template <
class TGainfunction >
239 if ( receptor_type != 0 )
246template <
class TGainfunction >
250 if ( receptor_type != 0 )
257template <
class TGainfunction >
261 if ( receptor_type != 0 )
265 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
269template <
class TGainfunction >
276template <
class TGainfunction >
284template <
class TGainfunction >
296template <
class TGainfunction >
303 stmp.
set( d, ptmp,
this );
315 gain_.
set( d,
this );
318template <
typename TGainfunction >
325template <
class TGainfunction >
332template <
class TGainfunction >
336 , last_in_node_id_( 0 )
337 , t_next_(
Time::neg_inf() )
338 , t_last_in_spike_(
Time::neg_inf() )
346template <
class TGainfunction >
353template <
class TGainfunction >
360 throw BadProperty(
"All time constants must be strictly positive." );
364template <
class TGainfunction >
372template <
class TGainfunction >
378template <
class TGainfunction >
384template <
class TGainfunction >
395template <
class TGainfunction >
404template <
class TGainfunction >
418template <
class TGainfunction >
423 B_.currents_.clear();
428template <
class TGainfunction >
438 if ( S_.t_next_.is_neg_inf() )
440 S_.t_next_ =
Time::ms( V_.exp_dist_( V_.rng_ ) * P_.tau_m_ );
449template <
class TGainfunction >
453 for (
long lag = from; lag < to; ++lag )
459 S_.h_ += B_.spikes_.get_value( lag );
461 double c = B_.currents_.get_value( lag );
464 if (
Time::step( origin.get_steps() + lag ) > S_.t_next_ )
471 bool new_y = gain_( V_.rng_, S_.h_ + c );
473 if ( new_y != S_.y_ )
484 set_spiketime(
Time::step( origin.get_steps() + lag + 1 ) );
489 S_.t_next_ +=
Time::ms( V_.exp_dist_( V_.rng_ ) * P_.tau_m_ );
494 B_.logger_.record_data( origin.get_steps() + lag );
499template <
class TGainfunction >
503 assert( e.get_delay_steps() > 0 );
523 const long m = e.get_multiplicity();
524 const long node_id = e.retrieve_sender_node_id_from_source_table();
525 const Time& t_spike = e.get_stamp();
530 if ( node_id == S_.last_in_node_id_ and t_spike == S_.t_last_in_spike_ )
534 B_.spikes_.add_value(
535 e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ), 2.0 * e.get_weight() );
541 B_.spikes_.add_value(
542 e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ), -e.get_weight() );
548 B_.spikes_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ), e.get_weight() );
551 S_.last_in_node_id_ = node_id;
552 S_.t_last_in_spike_ = t_spike;
555template <
class TGainfunction >
559 assert( e.get_delay_steps() > 0 );
561 const double c = e.get_current();
562 const double w = e.get_weight();
567 B_.currents_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ), w * c );
571template <
class TGainfunction >
575 B_.logger_.handle( e );
578template <
class TGainfunction >
583 S_.t_last_in_spike_ = tc.
from_old_tics( S_.t_last_in_spike_.get_tics() );
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
A node which archives spike history for the purposes of spike-timing dependent plasticity (STDP)
Definition archiving_node.h:49
void clear_history()
Clear spike history.
Definition archiving_node.cpp:269
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:236
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Base class for RNG engine wrappers.
Definition random_generators.h:67
Event for electrical currents.
Definition event.h:569
Request data to be logged/logged data to be sent.
Definition event.h:636
void send(Node &source, EventT &e, const long lag=0)
Standard routine for sending events.
Definition event_delivery_manager_impl.h:60
Base class for all NEST network objects.
Definition node.h:99
virtual SignalType receives_signal() const
Definition node.h:974
virtual SignalType sends_signal() const
Definition node.h:963
Map names of recordables to data access functions.
Definition recordables_map.h:61
Buffer Layout.
Definition ring_buffer.h:83
Event for spike information.
Definition event.h:418
void set_multiplicity(size_t)
Definition event.h:443
Class to convert times from one representation to another.
Definition nest_timeconverter.h:42
Time from_old_tics(tic_t t_old) const
Converts a given number of tics with respect to old representation into a time object in current repr...
Definition nest_timeconverter.cpp:49
Definition nest_time.h:135
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
Binary stochastic neuron with linear or sigmoidal gain function.
Definition binary_neuron.h:76
void calibrate_time(const TimeConverter &tc) override
Re-calculate time-based properties of the node.
Definition binary_neuron.h:580
TGainfunction gain_
Definition binary_neuron.h:117
SignalType sends_signal() const override
Definition binary_neuron.h:271
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition binary_neuron.h:286
binary_neuron()
Definition binary_neuron.h:396
void init_buffers_() override
Configure persistent internal data structures.
Definition binary_neuron.h:420
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition binary_neuron.h:298
Variables_ V_
Definition binary_neuron.h:216
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition binary_neuron.h:227
double get_output_state__() const
Read out the binary_neuron state of the neuron.
Definition binary_neuron.h:194
Buffers_ B_
Definition binary_neuron.h:217
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition binary_neuron.h:430
SignalType receives_signal() const override
Definition binary_neuron.h:278
static RecordablesMap< binary_neuron< TGainfunction > > recordablesMap_
Mapping of recordables names to access functions.
Definition binary_neuron.h:221
State_ S_
Definition binary_neuron.h:215
double get_input__() const
Read out the summed input of the neuron (= membrane potential)
Definition binary_neuron.h:201
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition binary_neuron.h:451
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition binary_neuron.h:237
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition binary_neuron.h:214
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition binary_neuron.h:501
EventDeliveryManager event_delivery_manager
Definition kernel_manager.h:241
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:271
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:265
const std::string tau_m("tau_m")
const std::string recordables("recordables")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
RngPtr get_vp_specific_rng(size_t tid)
Definition kernel_manager.h:298
KernelManager & kernel()
Definition kernel_manager.h:311
bool update_value_param(Dictionary const &d, const std::string &key, T &value, nest::Node *node)
Obtain value from parameter dictionary including evaluation of random or spatial parameters.
Definition dict_util.h:42
SignalType
enum type of signal conveyed by spike events of a node.
Definition nest_types.h:165
@ BINARY
Definition nest_types.h:168
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Definition nest_time.h:255
Definition nest_time.h:246
Buffers of the model.
Definition binary_neuron.h:166
UniversalDataLogger< binary_neuron > logger_
Logger for all analog data.
Definition binary_neuron.h:176
Buffers_(binary_neuron &)
Definition binary_neuron.h:379
RingBuffer spikes_
buffers and sums up incoming spikes/currents
Definition binary_neuron.h:171
RingBuffer currents_
Definition binary_neuron.h:172
Independent parameters of the model.
Definition binary_neuron.h:131
void get(Dictionary &) const
Store current values in dictionary.
Definition binary_neuron.h:348
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition binary_neuron.h:355
Parameters_()
Sets default parameter values.
Definition binary_neuron.h:326
double tau_m_
mean inter-update interval in ms (acts like a membrane time constant).
Definition binary_neuron.h:133
State variables of the model.
Definition binary_neuron.h:147
double last_in_node_id_
node ID of the last spike being received
Definition binary_neuron.h:150
void set(const Dictionary &, const Parameters_ &, Node *)
Definition binary_neuron.h:374
bool y_
output of neuron in [0,1]
Definition binary_neuron.h:148
void get(Dictionary &, const Parameters_ &) const
Definition binary_neuron.h:366
Time t_next_
time point of next update
Definition binary_neuron.h:151
Time t_last_in_spike_
time point of last input spike seen
Definition binary_neuron.h:152
State_()
Default initialization.
Definition binary_neuron.h:333
double h_
total input current to neuron
Definition binary_neuron.h:149
Internal variables of the model.
Definition binary_neuron.h:185
exponential_distribution exp_dist_
random deviate generator
Definition binary_neuron.h:187
RngPtr rng_
random number generator of my own thread
Definition binary_neuron.h:186