NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_alpha_multisynapse.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_alpha_multisynapse.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef IAF_PSC_ALPHA_MULTISYNAPSE_H
24 #define IAF_PSC_ALPHA_MULTISYNAPSE_H
25 
26 #include "nest.h"
27 #include "event.h"
28 #include "archiving_node.h"
29 #include "ring_buffer.h"
30 #include "connection.h"
31 #include "universal_data_logger.h"
32 #include "recordables_map.h"
33 
34  /* BeginDocumentation
35 Name: iaf_psc_alpha_multisynapse - Leaky integrate-and-fire neuron model with multiple ports.
36 
37 Description:
38 
39  iaf_psc_alpha_multisynapse is a direct extension of iaf_psc_alpha.
40  On the postsynapic side, there can be arbitrarily many synaptic
41  time constants (iaf_psc_alpha has exactly two: tau_syn_ex and tau_syn_in).
42 
43  This can be reached by specifying separate receptor ports, each for
44  a different time constant. The port number has to match the respective
45  "receptor_type" in the connectors.
46 
47 Sends: SpikeEvent
48 
49 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
50 
51 Author: Schrader, adapted from iaf_psc_alpha
52 SeeAlso: iaf_psc_alpha, iaf_psc_delta, iaf_psc_exp, iaf_cond_exp, iaf_psc_exp_multisynapse
53 */
54 
55 namespace nest
56 {
57  class Network;
58 
63  {
64 
65  public:
66 
69 
74  using Node::handle;
76 
78 
79  void handle(SpikeEvent &);
80  void handle(CurrentEvent &);
81  void handle(DataLoggingRequest &);
82 
86 
87  void get_status(DictionaryDatum &) const;
88  void set_status(const DictionaryDatum &);
89 
90  private:
91 
92  void init_state_(const Node& proto);
93  void init_buffers_();
94  void calibrate();
95 
96  void update(Time const&, const long_t, const long_t);
97 
98  // The next two classes need to be friends to access the State_ class/member
100  friend class UniversalDataLogger<iaf_psc_alpha_multisynapse>;
101 
102  // ----------------------------------------------------------------
103 
107  struct Parameters_ {
108 
111 
114 
117 
120 
123 
126 
130 
134 
136  std::vector<double_t> tau_syn_;
137 
138  // type is long because other types are not put through in GetStatus
139  std::vector<long> receptor_types_;
141 
142  // boolean flag which indicates whether the neuron has connections
144 
145  Parameters_();
146 
147  void get(DictionaryDatum&) const;
148 
152  double set(const DictionaryDatum&);
153  }; // Parameters_
154 
155  // ----------------------------------------------------------------
156 
160  struct State_ {
162  std::vector<double_t> y1_syn_;
163  std::vector<double_t> y2_syn_;
166 
168 
169  State_();
170 
171  void get(DictionaryDatum&, const Parameters_&) const;
172 
178  void set(const DictionaryDatum&, const Parameters_&, const double);
179  }; // State_
180 
181  // ----------------------------------------------------------------
182 
186  struct Buffers_ {
189 
191  std::vector<RingBuffer> spikes_;
193 
196  };
197 
198  // ----------------------------------------------------------------
199 
203  struct Variables_ {
204  std::vector<double_t> PSCInitialValues_;
206 
207  std::vector<double_t> P11_syn_;
208  std::vector<double_t> P21_syn_;
209  std::vector<double_t> P22_syn_;
210  std::vector<double_t> P31_syn_;
211  std::vector<double_t> P32_syn_;
212 
215 
216  unsigned int receptor_types_size_;
217 
218  }; // Variables
219 
220  // Access functions for UniversalDataLogger -------------------------------
221 
223  double_t get_V_m_() const { return S_.y3_ + P_.U0_; }
224  double_t get_current_() const { return S_.current_; }
225 
226  // Data members -----------------------------------------------------------
227 
243  };
244 
245 inline
247 {
248  SpikeEvent e;
249  e.set_sender(*this);
250 
251  return target.handles_test_event(e, receptor_type);
252 }
253 
254 inline
256 {
257  if (receptor_type != 0)
258  throw UnknownReceptorType(receptor_type, get_name());
259  return 0;
260 }
261 
262 inline
264 {
265  if (receptor_type != 0)
266  throw UnknownReceptorType(receptor_type, get_name());
267  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
268 }
269 
270 inline
272 {
273  P_.get(d);
274  S_.get(d, P_);
276 
277  (*d)[names::recordables] = recordablesMap_.get_list();
278 }
279 
280 inline
282 {
283  Parameters_ ptmp = P_; // temporary copy in case of errors
284  const double delta_EL = ptmp.set(d); // throws if BadProperty
285  State_ stmp = S_; // temporary copy in case of errors
286  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
287 
288  // We now know that (ptmp, stmp) are consistent. We do not
289  // write them back to (P_, S_) before we are also sure that
290  // the properties to be set in the parent class are internally
291  // consistent.
293 
294  // if we get here, temporaries contain consistent set of properties
295  P_ = ptmp;
296  S_ = stmp;
297 }
298 
299 } // namespace
300 
301 #endif /* #ifndef IAF_PSC_ALPHA_MULTISYNAPSE_H */
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
Definition of Archiving_Node which is capable of recording and managing a spike history.
Parameters_()
Sets default parameter values.
Definition: iaf_psc_alpha_multisynapse.cpp:58
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
double_t C_
Membrane capacitance in pF.
Definition: iaf_psc_alpha_multisynapse.h:113
std::vector< double_t > y1_syn_
Definition: iaf_psc_alpha_multisynapse.h:162
int_t r_
This is the current in a time step. This is only here to allow logging.
Definition: iaf_psc_alpha_multisynapse.h:167
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
unsigned int receptor_types_size_
Definition: iaf_psc_alpha_multisynapse.h:216
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_psc_alpha_multisynapse.cpp:271
friend class UniversalDataLogger< iaf_psc_alpha_multisynapse >
Definition: iaf_psc_alpha_multisynapse.h:100
double_t current_
Definition: iaf_psc_alpha_multisynapse.h:165
std::vector< double_t > P31_syn_
Definition: iaf_psc_alpha_multisynapse.h:210
std::vector< double_t > P11_syn_
Definition: iaf_psc_alpha_multisynapse.h:207
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition: iaf_psc_alpha_multisynapse.h:129
std::vector< double_t > tau_syn_
Time constants of synaptic currents in ms.
Definition: iaf_psc_alpha_multisynapse.h:136
double_t U0_
Resting potential in mV.
Definition: iaf_psc_alpha_multisynapse.h:119
int_t RefractoryCounts_
Definition: iaf_psc_alpha_multisynapse.h:205
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
RingBuffer currents_
Definition: iaf_psc_alpha_multisynapse.h:192
State variables of the model.
Definition: iaf_psc_alpha_multisynapse.h:160
Buffers of the model.
Definition: iaf_psc_alpha_multisynapse.h:186
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_alpha_multisynapse.cpp:163
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_alpha_multisynapse.cpp:326
void get_status(DictionaryDatum &) const
Definition: iaf_psc_alpha_multisynapse.h:271
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_alpha_multisynapse.cpp:208
Buffers_(iaf_psc_alpha_multisynapse &)
Definition: iaf_psc_alpha_multisynapse.cpp:176
Map names of recordables to data access functions.
Definition: recordables_map.h:58
Variables_ V_
Definition: iaf_psc_alpha_multisynapse.h:237
Definition: nest_time.h:130
double_t I_e_
External current in pA.
Definition: iaf_psc_alpha_multisynapse.h:122
std::vector< double_t > PSCInitialValues_
Definition: iaf_psc_alpha_multisynapse.h:204
Parameters_ P_
Definition: iaf_psc_alpha_multisynapse.h:235
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_alpha_multisynapse.cpp:224
size_t num_of_receptors_
Definition: iaf_psc_alpha_multisynapse.h:140
std::string get_name() const
Return class name.
Definition: node.cpp:83
std::vector< double_t > P21_syn_
Definition: iaf_psc_alpha_multisynapse.h:208
std::vector< double_t > P32_syn_
Definition: iaf_psc_alpha_multisynapse.h:211
Leaky integrate-and-fire neuron with alpha-shaped PSCs.
Definition: iaf_psc_alpha_multisynapse.h:62
State_ S_
Definition: iaf_psc_alpha_multisynapse.h:236
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_alpha_multisynapse.h:246
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t P30_
Definition: iaf_psc_alpha_multisynapse.h:213
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_alpha_multisynapse.cpp:86
Internal variables of the model.
Definition: iaf_psc_alpha_multisynapse.h:203
std::vector< double_t > P22_syn_
Definition: iaf_psc_alpha_multisynapse.h:209
void set_status(const DictionaryDatum &)
Definition: iaf_psc_alpha_multisynapse.h:281
UniversalDataLogger< iaf_psc_alpha_multisynapse > logger_
Logger for all analog data.
Definition: iaf_psc_alpha_multisynapse.h:195
std::vector< double_t > y2_syn_
Definition: iaf_psc_alpha_multisynapse.h:163
double_t y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition: iaf_psc_alpha_multisynapse.h:164
double_t get_current_() const
Definition: iaf_psc_alpha_multisynapse.h:224
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_alpha_multisynapse.cpp:104
iaf_psc_alpha_multisynapse()
Definition: iaf_psc_alpha_multisynapse.cpp:188
double_t Tau_
Membrane time constant in ms.
Definition: iaf_psc_alpha_multisynapse.h:110
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
double_t P33_
Definition: iaf_psc_alpha_multisynapse.h:214
static RecordablesMap< iaf_psc_alpha_multisynapse > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_alpha_multisynapse.h:242
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double double_t
Double precision floating point numbers.
Definition: nest.h:93
std::vector< long > receptor_types_
Definition: iaf_psc_alpha_multisynapse.h:139
bool has_connections_
Definition: iaf_psc_alpha_multisynapse.h:143
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
Request data to be logged/logged data to be sent.
Definition: event.h:486
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
std::vector< RingBuffer > spikes_
buffers and sums up incoming spikes/currents
Definition: iaf_psc_alpha_multisynapse.h:191
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_alpha_multisynapse.cpp:335
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_alpha_multisynapse.h:223
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_alpha_multisynapse.cpp:214
Buffers_ B_
Definition: iaf_psc_alpha_multisynapse.h:238
State_()
Default initialization.
Definition: iaf_psc_alpha_multisynapse.cpp:72
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
void set(const DictionaryDatum &, const Parameters_ &, const double)
Set values from dictionary.
Definition: iaf_psc_alpha_multisynapse.cpp:168
const double e
Definition: numerics.cpp:62
double_t y0_
Constant current.
Definition: iaf_psc_alpha_multisynapse.h:161
double_t V_reset_
Reset value of the membrane potential.
Definition: iaf_psc_alpha_multisynapse.h:125
double_t LowerBound_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition: iaf_psc_alpha_multisynapse.h:133
Independent parameters of the model.
Definition: iaf_psc_alpha_multisynapse.h:107
Buffer Layout.
Definition: ring_buffer.h:77
double_t TauR_
Refractory period in ms.
Definition: iaf_psc_alpha_multisynapse.h:116