-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cortical_Column.h
184 lines (151 loc) · 6.5 KB
/
Cortical_Column.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Copyright (c) 2015 University of Lübeck
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* AUTHORS: Michael Schellenberger Costa: [email protected]
*
* Based on: Characterization of K-Complexes and Slow Wave Activity in a Neural Mass Model
* A Weigenand, M Schellenberger Costa, H-VV Ngo, JC Claussen, T Martinetz
* PLoS Computational Biology. 2014;10:e1003923
*/
/******************************************************************************/
/* Implementation of a cortical module */
/******************************************************************************/
#pragma once
#include <array>
#include <cmath>
#include <vector>
#include "Random_Stream.h"
class Cortical_Column {
public:
Cortical_Column(double* Par)
: sigma_p (Par[0])
, g_KNa (Par[1])
, dphi (Par[2])
{
set_RNG();
}
void set_input (double I) {input = I;}
void iterate_ODE (void);
private:
void set_RNG (void);
/* Firing rates */
double get_Qp (int) const;
double get_Qi (int) const;
/* Currents */
double I_ep (int) const;
double I_ei (int) const;
double I_gp (int) const;
double I_gi (int) const;
double I_L_p (int) const;
double I_L_i (int) const;
double I_KNa (int) const;
/* Potassium pump */
double Na_pump (int) const;
/* Noise function */
double noise_xRK (int, int) const;
double noise_aRK (int) const;
/* ODE functions */
void set_RK (int);
void add_RK (void);
/* Helper functions */
inline std::vector<double> init (double value)
{
return {value, 0.0, 0.0, 0.0, 0.0};
}
inline void add_RK (std::vector<double>& var) {
var[0] = (-3*var[0] + 2*var[1] + 4*var[2] + 2*var[3] + var[4])/6;
}
inline void add_RK_noise (std::vector<double>& var, unsigned noise) {
var[0] = (-3*var[0] + 2*var[1] + 4*var[2] + 2*var[3] + var[4])/6 + noise_aRK(noise);
}
/* Random number generators */
std::vector<randomStreamNormal> MTRands;
/* Container for noise */
std::vector<double> Rand_vars;
/* Declaration and Initialization of parameters */
/* Membrane time in ms */
static constexpr double tau_p = 30;
static constexpr double tau_i = 30;
/* Maximum firing rate in ms^-1 */
static constexpr double Qp_max = 30.E-3;
static constexpr double Qi_max = 60.E-3;
/* Sigmoid threshold in mV */
static constexpr double theta_p = -58.5;
static constexpr double theta_i = -58.5;
/* Sigmoid gain in mV */
const double sigma_p = 4;
static constexpr double sigma_i = 6;
/* Scaling parameter for sigmoidal mapping (dimensionless) */
static constexpr double C1 = (M_PI/sqrt(3));
/* Parameters of the firing adaption */
static constexpr double alpha_Na = 2.; /* Sodium influx per spike in mM ms */
static constexpr double tau_Na = 1.; /* Sodium time constant in ms */
static constexpr double R_pump = 0.09; /* Na-K pump constant in mM/ms */
static constexpr double Na_eq = 9.5; /* Na-eq concentration in mM */
/* PSP rise time in ms^-1 */
static constexpr double gamma_e = 70E-3;
static constexpr double gamma_g = 58.6E-3;
/* Conductivities */
/* Leak in aU*/
static constexpr double g_L = 1.;
/* Synaptic conductivity in ms */
static constexpr double g_AMPA = 1.;
static constexpr double g_GABA = 1.;
/* KNa in mS/cm^-2 */
const double g_KNa = 1.33;
/* Reversal potentials in mV */
/* Synaptic */
static constexpr double E_AMPA = 0;
static constexpr double E_GABA = -70;
/* Leak */
static constexpr double E_L_p = -66;
static constexpr double E_L_i = -64;
/* Potassium */
static constexpr double E_K = -100;
/* Noise parameters in ms^-1 */
static constexpr double mphi = 0.0;
const double dphi = 20E-1;
double input = 0.0;
/* Connectivities (dimensionless) */
static constexpr double N_pp = 120;
static constexpr double N_ip = 72;
static constexpr double N_pi = 90;
static constexpr double N_ii = 90;
/* Interation parameters for SRK4 */
static constexpr std::array<double,4> A = {0.5, 0.5, 1.0, 1.0};
static constexpr std::array<double,4> B = {0.75, 0.75, 0.0, 0.0};
/* Population variables */
std::vector<double> Vp = init(E_L_p), /* excitatory membrane voltage */
Vi = init(E_L_i), /* inhibitory membrane voltage */
Na = init(Na_eq), /* Na concentration */
s_ep= init(0.0), /* PostSP from excitatory to excitatory population */
s_ei= init(0.0), /* PostSP from excitatory to inhibitory population */
s_gp= init(0.0), /* PostSP from inhibitory to excitatory population */
s_gi= init(0.0), /* PostSP from inhibitory to inhibitory population */
x_ep= init(0.0), /* derivative of s_ep */
x_ei= init(0.0), /* derivative of s_ei */
x_gp= init(0.0), /* derivative of s_gp */
x_gi= init(0.0); /* derivative of s_gi */
/* Data storage access */
friend void get_data (unsigned, Cortical_Column&, std::vector<double*>&);
/* Stimulation protocol access */
friend class Stim;
};