NEST main@caf0ae8
 
Loading...
Searching...
No Matches
eprop_archiving_node_readout.h
Go to the documentation of this file.
1/*
2 * eprop_archiving_node_readout.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 EPROP_ARCHIVING_NODE_READOUT_H
24#define EPROP_ARCHIVING_NODE_READOUT_H
25
26// models
28
29// nestkernel
30#include "histentry.h"
31#include "nest_time.h"
32#include "nest_types.h"
33#include "node.h"
34
35namespace nest
36{
37
41template < bool hist_shift_required >
42class EpropArchivingNodeReadout : public EpropArchivingNode< HistEntryEpropReadout >
43{
44public:
52
62
68 void append_new_eprop_history_entry( long time_step );
69
76 void write_error_signal_to_history( long time_step, const double error_signal );
77
78 void get_status( Dictionary& d ) const override;
79 void set_status( const Dictionary& d ) override;
80
81protected:
82 long model_dependent_history_shift_() const override;
83};
84
85template < bool hist_shift_required >
86inline void
88{
89 if constexpr ( not hist_shift_required )
90 {
91 d[ names::eprop_isi_trace_cutoff ] = eprop_isi_trace_cutoff_;
92 }
93}
94
95template < bool hist_shift_required >
96inline void
98{
99 if constexpr ( not hist_shift_required )
100 {
101 double eprop_isi_trace_cutoff_tmp = eprop_isi_trace_cutoff_;
102
103 update_value_param( d, names::eprop_isi_trace_cutoff, eprop_isi_trace_cutoff_tmp, this );
104
105 if ( eprop_isi_trace_cutoff_tmp < 0.0 )
106 {
107 throw BadProperty( "eprop_isi_trace_cutoff ≥ 0 required." );
108 }
109
110 eprop_isi_trace_cutoff_ = eprop_isi_trace_cutoff_tmp;
111 }
112}
113
114template < bool hist_shift_required >
115void
117{
118 if ( eprop_indegree_ == 0 )
119 {
120 return;
121 }
122
123 if constexpr ( hist_shift_required )
124 {
125 time_step -= delay_out_norm_;
126 }
127
128 eprop_history_.emplace_back( time_step, 0.0 );
129}
130
131template < bool hist_shift_required >
132void
134 const double error_signal )
135{
136 if ( eprop_indegree_ == 0 )
137 {
138 return;
139 }
140
141 if constexpr ( hist_shift_required )
142 {
143 time_step -= delay_out_norm_;
144 }
145
146 auto it_hist = get_eprop_history( time_step );
147 it_hist->error_signal_ = error_signal;
148}
149
150template < bool hist_shift_required >
151long
153{
154 if constexpr ( hist_shift_required )
155 {
156 return get_shift();
157 }
158 else
159 {
160 return -delay_rec_out_;
161 }
162}
163
164}
165
166#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Class implementing an intermediate archiving node model for readout node models supporting e-prop pla...
Definition eprop_archiving_node_readout.h:43
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition eprop_archiving_node_readout.h:87
EpropArchivingNodeReadout()
Constructs a new EpropArchivingNodeReadout object.
Definition eprop_archiving_node_readout.h:48
long model_dependent_history_shift_() const override
Returns the correct shift for history depending on whether it is a normal or a bsshslm_2020 model.
Definition eprop_archiving_node_readout.h:152
void append_new_eprop_history_entry(long time_step)
Creates an entry for the specified time step at the end of the eprop history.
Definition eprop_archiving_node_readout.h:116
EpropArchivingNodeReadout(const EpropArchivingNodeReadout &other)
Constructs a new EpropArchivingNodeReadout object by copying another EpropArchivingNodeReadout object...
Definition eprop_archiving_node_readout.h:58
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition eprop_archiving_node_readout.h:97
void write_error_signal_to_history(long time_step, const double error_signal)
Writes the error signal to the eprop history at the specified time step.
Definition eprop_archiving_node_readout.h:133
Base class implementing archiving for node models supporting e-prop plasticity.
Definition eprop_archiving_node.h:53
const std::string eprop_isi_trace_cutoff("eprop_isi_trace_cutoff")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
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
Declarations for base class Node.