NEST main@caf0ae8
 
Loading...
Searching...
No Matches
mip_generator.h
Go to the documentation of this file.
1/*
2 * mip_generator.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 MIP_GENERATOR_H
24#define MIP_GENERATOR_H
25
26// Includes from nestkernel:
27#include "connection.h"
28#include "device_node.h"
29#include "event.h"
30#include "nest_types.h"
31#include "random_generators.h"
32#include "stimulation_device.h"
33
34namespace nest
35{
36
37/* BeginUserDocs: device, generator
38
39Short description
40+++++++++++++++++
41
42Create spike trains as described by the MIP model
43
44Description
45+++++++++++
46
47The ``mip_generator`` generates correlated spike trains using an Multiple
48Interaction Process (MIP) as described in :footcite:p:`Kuhn2003`. Underlying principle is a
49Poisson parent process with rate r, the spikes of which are copied into the
50child processes with a certain probability p. Every node the mip_generator is
51connected to receives a distinct child process as input, whose rate is `p*r`.
52The value of the pairwise correlation coefficient of two child processes
53created by a MIP process equals p.
54
55The MIP generator may emit more than one spike through a child process
56during a single time step, especially at high rates. If this happens,
57the generator does not actually send out n spikes. Instead, it emits
58a single spike with n-fold synaptic weight for the sake of efficiency.
59Furthermore, note that as with the Poisson generator, different threads
60have their own copy of a MIP generator. By using the same mother_seed
61it is ensured that the mother process is identical for each of the
62generators.
63
64.. include:: ../models/stimulation_device.rst
65
66rate
67 Mean firing rate of the parent process, spikes/s
68
69p_copy
70 Copy probability
71
72Set parameters from a stimulation backend
73~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
75The parameters in this stimulation device can be updated with input
76coming from a stimulation backend. The data structure used for the
77update holds one value for each of the parameters mentioned above.
78The indexing is as follows:
79
80 0. rate
81 1. p_copy
82
83Sends
84+++++
85
86SpikeEvent
87
88References
89++++++++++
90
91.. footbibliography::
92
93See also
94++++++++
95
96poisson_generator
97
98Examples using this model
99+++++++++++++++++++++++++
100
101.. listexamples:: mip_generator
102
103EndUserDocs */
104
108void register_mip_generator( const std::string& name );
109
111{
112
113public:
115 mip_generator( const mip_generator& rhs );
116
122 using Node::event_hook;
123
124 size_t send_test_event( Node&, size_t, synindex, bool ) override;
125
126 void get_status( Dictionary& ) const override;
127 void set_status( const Dictionary& ) override;
128
129 StimulationDevice::Type get_type() const override;
130 void set_data_from_stimulation_backend( std::vector< double >& input_param ) override;
131
132private:
133 void init_state_() override;
134 void init_buffers_() override;
135 void pre_run_hook() override;
136
137 void update( Time const&, const long, const long ) override;
138
142 void event_hook( DSSpikeEvent& ) override;
143
144 // ------------------------------------------------------------
145
150 {
151 double rate_;
152 double p_copy_;
153
154 Parameters_();
155
156 void get( Dictionary& ) const;
157 void set( const Dictionary&, Node* node );
158 };
159
160 // ------------------------------------------------------------
161
166
167 // ------------------------------------------------------------
168
171};
172
173inline size_t
174mip_generator::send_test_event( Node& target, size_t receptor_type, synindex syn_id, bool dummy_target )
175{
177
178 if ( dummy_target )
179 {
180 DSSpikeEvent e;
181 e.set_sender( *this );
182 return target.handles_test_event( e, receptor_type );
183 }
184 else
185 {
186 SpikeEvent e;
187 e.set_sender( *this );
188 return target.handles_test_event( e, receptor_type );
189 }
190}
191
192inline void
198
199inline void
201{
202 Parameters_ ptmp = P_; // temporary copy in case of errors
203 ptmp.set( d, this ); // throws if BadProperty
204
205 // We now know that ptmp is consistent. We do not write it back
206 // to P_ before we are also sure that the properties to be set
207 // in the parent class are internally consistent.
209
210 // if we get here, temporaries contain consistent set of properties
211 P_ = ptmp;
212}
213
219
220} // namespace nest
221
222#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
"Callback request event" for use in Device.
Definition event.h:521
Base class for all NEST network objects.
Definition node.h:99
virtual void event_hook(DSSpikeEvent &)
Modify Event object parameters during event delivery.
Definition node.cpp:586
Event for spike information.
Definition event.h:418
Base class for common properties of StimulationDevices.
Definition stimulation_device.h:154
void enforce_single_syn_type(synindex)
Throws IllegalConnection if synapse id differs from initial synapse id.
Definition stimulation_device.cpp:62
Type
Device type.
Definition stimulation_device.h:187
@ SPIKE_GENERATOR
Definition stimulation_device.h:189
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition stimulation_device.cpp:125
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition stimulation_device.cpp:168
Definition nest_time.h:135
Definition mip_generator.h:111
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition mip_generator.h:200
Parameters_ P_
Definition mip_generator.h:169
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition mip_generator.cpp:131
Variables_ V_
Definition mip_generator.h:170
StimulationDevice::Type get_type() const override
Definition mip_generator.h:215
void init_buffers_() override
Configure persistent internal data structures.
Definition mip_generator.cpp:110
void init_state_() override
Configure state variables depending on runtime information.
Definition mip_generator.cpp:104
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition mip_generator.h:174
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition mip_generator.h:193
void event_hook(DSSpikeEvent &) override
Definition mip_generator.cpp:154
mip_generator()
Definition mip_generator.cpp:87
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition mip_generator.cpp:116
void set_data_from_stimulation_backend(std::vector< double > &input_param) override
Definition mip_generator.cpp:192
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_mip_generator(const std::string &name)
Definition mip_generator.cpp:39
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Store independent parameters of the model.
Definition mip_generator.h:150
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition mip_generator.cpp:67
Parameters_()
Sets default parameter values.
Definition mip_generator.cpp:49
void get(Dictionary &) const
Store current values in dictionary.
Definition mip_generator.cpp:60
double p_copy_
copy probability for each spike in the parent process
Definition mip_generator.h:152
double rate_
process rate in spks/s
Definition mip_generator.h:151
Definition mip_generator.h:163
poisson_distribution poisson_dist_
poisson_distribution
Definition mip_generator.h:164