Permalink
Browse files

Cleanup. Made comments line save

Signed-off-by: Schellenberger <schellenberger@inb.uni-luebeck.de>
  • Loading branch information...
1 parent 52e9992 commit 1531e78f1a632e23ba54f51bc6cad08c4f05a28d @miscco committed Apr 24, 2014
Showing with 496 additions and 288 deletions.
  1. +37 −15 Cortical_Column.cpp
  2. +89 −69 Cortical_Column.h
  3. +34 −10 Main.cpp
  4. +25 −2 ODE.h
  5. +12 −19 Plots.m
  6. +61 −38 Stimulation.h
  7. +41 −18 TC.cpp
  8. +52 −40 Thalamic_Column.cpp
  9. +95 −73 Thalamic_Column.h
  10. +23 −0 macros.h
  11. +27 −4 saves.h
View
@@ -1,3 +1,25 @@
+/*
+* Copyright (c) 2014 Michael Schellenberger Costa
+*
+* 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.
+*/
+
/****************************************************************************************************/
/* Functions of the cortical module */
/****************************************************************************************************/
@@ -7,15 +29,15 @@
/* Initialization of RNG */
/****************************************************************************************************/
void Cortical_Column::set_RNG(void) {
- // the number of independent streams
+ /* Number of independent streams */
int N = 4;
- // get the RNG
+ /* Create RNG for each stream */
for (int i=0; i<N; ++i){
- // add the RNG
- MTRands.push_back({ENG(rand()), DIST (mphi, dphi)});
+ /* Add the RNG */
+ MTRands.push_back({ENG(rand()), DIST (mphi, sqrt(dphi))});
- // get the random number for the first iteration
+ /* Get the random number for the first iteration */
Rand_vars.push_back(MTRands[i]());
}
}
@@ -27,14 +49,14 @@ void Cortical_Column::set_RNG(void) {
/****************************************************************************************************/
/* Firing Rate functions */
/****************************************************************************************************/
-// pyramidal firing rate
+/* Pyramidal firing rate */
double Cortical_Column::get_Qe (int N) const{
_SWITCH((Ve))
double q = Qe_max / (1 + exp(-C1 * (var_Ve - theta_e) / sigma_e));
return q;
}
-// cortical inhibitory firing rate
+/* Inhibitory firing rate */
double Cortical_Column::get_Qi (int N) const{
_SWITCH((Vi))
double q = Qi_max / (1 + exp(-C1 * (var_Vi - theta_i) / sigma_i));
@@ -48,27 +70,27 @@ double Cortical_Column::get_Qi (int N) const{
/****************************************************************************************************/
/* Synaptic currents */
/****************************************************************************************************/
-// excitatory input to pyramidal population
+/* Excitatory input to pyramidal population */
double Cortical_Column::I_ee (int N) const{
_SWITCH((Ve)(Phi_ee))
double I = var_Phi_ee * (var_Ve - E_AMPA);
return I;
}
-// inhibitory input to pyramidal population
+/* Inhibitory input to pyramidal population */
double Cortical_Column::I_ie (int N) const{
_SWITCH((Ve)(Phi_ie))
double I = var_Phi_ie * (var_Ve - E_GABA);
return I;
}
-// excitatory input to inhibitory population
+/* Excitatory input to inhibitory population */
double Cortical_Column::I_ei (int N) const{
_SWITCH((Vi)(Phi_ei))
double I = var_Phi_ei * (var_Vi - E_AMPA);
return I;
}
-// inhibitory input to inhibitory population
+/* Inhibitory input to inhibitory population */
double Cortical_Column::I_ii (int N) const{
_SWITCH((Vi)(Phi_ii))
double I = var_Phi_ii * (var_Vi - E_GABA);
@@ -82,21 +104,21 @@ double Cortical_Column::I_ii (int N) const{
/****************************************************************************************************/
/* Current functions */
/****************************************************************************************************/
-// Leak current of pyramidal population
+/* Leak current of pyramidal population */
double Cortical_Column::I_L_e (int N) const{
_SWITCH((Ve))
double I = g_L * (var_Ve - E_L_e);
return I;
}
-// Leak current of inhibitory population
+/* Leak current of inhibitory population */
double Cortical_Column::I_L_i (int N) const{
_SWITCH((Vi))
double I = g_L * (var_Vi - E_L_i);
return I;
}
-// sodium dependent potassium current
+/* Sodium dependent potassium current */
double Cortical_Column::I_KNa (int N) const{
_SWITCH((Ve)(Na))
double w_KNa = 0.37/(1+pow(38.7/var_Na, 3.5));
@@ -180,7 +202,7 @@ void Cortical_Column::add_RK(void) {
x_ii [0] += (x_ii [1] + x_ii [2] * 2 + x_ii [3] * 2 + x_ii [4])/6;
y_e [0] += (y_e [1] + y_e [2] * 2 + y_e [3] * 2 + y_e [4])/6;
- // generating the noise for the next iteration
+ /* Generat noise for the next iteration */
for (unsigned i=0; i<Rand_vars.size(); ++i) {
Rand_vars[i] = MTRands[i]();
}
View
@@ -1,3 +1,25 @@
+/*
+* Copyright (c) 2014 Michael Schellenberger Costa
+*
+* 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.
+*/
+
/************************************************************************************************/
/* Header file of a cortical module */
/************************************************************************************************/
@@ -7,18 +29,17 @@
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/variate_generator.hpp>
-#include "macros.h"
#include "Thalamic_Column.h"
+#include "macros.h"
using std::vector;
-
class Thalamic_Column;
/****************************************************************************************************/
/* Typedefs for RNG */
/****************************************************************************************************/
-typedef boost::mt11213b ENG; // Mersenne Twister
-typedef boost::normal_distribution<double> DIST; // Normal Distribution
-typedef boost::variate_generator<ENG,DIST> GEN; // Variate generator
+typedef boost::mt11213b ENG; /* Mersenne Twister */
+typedef boost::normal_distribution<double> DIST; /* Normal Distribution */
+typedef boost::variate_generator<ENG,DIST> GEN; /* Variate generator */
/****************************************************************************************************/
/* end */
/****************************************************************************************************/
@@ -29,30 +50,29 @@ typedef boost::variate_generator<ENG,DIST> GEN; // Variate generator
/****************************************************************************************************/
class Cortical_Column {
public:
- // Constructors
+ /* Constructors */
Cortical_Column(void)
{set_RNG();}
Cortical_Column(double* Par, double* Con)
- :tau_e (Par[0]), theta_e (Par[1]), sigma_e (Par[2]), alpha_Na (Par[3]),
- tau_Na (Par[4]), g_KNa (Par[5]), N_te (Con[2]), N_ti (Con[3]),
- dphi (Par[6])
+ :sigma_e (Par[0]), alpha_Na (Par[1]), tau_Na (Par[2]), dphi (Par[3]),
+ N_te (Con[2]), N_ti (Con[3])
{set_RNG();}
- // get the pointer to the cortical module
+ /* Connect to the thalamic module */
void get_Thalamus(Thalamic_Column& T) {Thalamus = &T;}
- // get axonal flux
+ /* Return axonal flux */
double get_phi (int N) const {_SWITCH((phi_e)); return var_phi_e;}
- // Initialize the RNGs
+ /* Initialize the RNGs */
void set_RNG (void);
- // Firing rates
+ /* Firing rates */
double get_Qe (int) const;
double get_Qi (int) const;
- // Currents
+ /* Currents */
double I_ee (int) const;
double I_ei (int) const;
double I_ie (int) const;
@@ -61,112 +81,112 @@ class Cortical_Column {
double I_L_i (int) const;
double I_KNa (int) const;
- // Potassium pump
+ /* Potassium pump */
double Na_pump (int) const;
- // Noise function
+ /* Noise function */
double noise_xRK (int, int) const;
- // ODE functions
+ /* ODE functions */
void set_RK (int);
void add_RK (void);
- // Data storage
+ /* Data storage access */
friend void get_data (int, Cortical_Column&, Thalamic_Column&, _REPEAT(double*, 2));
+ /* Stimulation protocoll access */
+ friend class Stim;
+
private:
- // Population variables
- vector<double> Ve = _INIT(E_L_e), // excitatory membrane voltage
- Vi = _INIT(E_L_i), // inhibitory membrane voltage
- Na = _INIT(Na_eq), // Na concentration
- Phi_ee = _INIT(0.0), // PostSP from excitatory to excitatory population
- Phi_ei = _INIT(0.0), // PostSP from excitatory to inhibitory population
- Phi_ie = _INIT(0.0), // PostSP from inhibitory to excitatory population
- Phi_ii = _INIT(0.0), // PostSP from inhibitory to inhibitory population
- phi_e = _INIT(0.0), // axonal flux
- x_ee = _INIT(0.0), // derivative of Phi_ee
- x_ei = _INIT(0.0), // derivative of Phi_ei
- x_ie = _INIT(0.0), // derivative of Phi_ie
- x_ii = _INIT(0.0), // derivative of Phi_ii
- y_e = _INIT(0.0); // derivative of phi_t
-
- // Random number generators
+ /* Population variables */
+ vector<double> Ve = _INIT(E_L_e), /* excitatory membrane voltage */
+ Vi = _INIT(E_L_i), /* inhibitory membrane voltage */
+ Na = _INIT(Na_eq), /* Na concentration */
+ Phi_ee = _INIT(0.0), /* PostSP from excitatory to excitatory population */
+ Phi_ei = _INIT(0.0), /* PostSP from excitatory to inhibitory population */
+ Phi_ie = _INIT(0.0), /* PostSP from inhibitory to excitatory population */
+ Phi_ii = _INIT(0.0), /* PostSP from inhibitory to inhibitory population */
+ phi_e = _INIT(0.0), /* axonal flux */
+ x_ee = _INIT(0.0), /* derivative of Phi_ee */
+ x_ei = _INIT(0.0), /* derivative of Phi_ei */
+ x_ie = _INIT(0.0), /* derivative of Phi_ie */
+ x_ii = _INIT(0.0), /* derivative of Phi_ii */
+ y_e = _INIT(0.0); /* derivative of phi_t */
+
+ /* Random number generators */
vector<GEN> MTRands;
- // Container for noise
+ /* Container for noise */
vector<double> Rand_vars;
- // Declaration and Initialization of parameters
- // Membrane time in ms
+ /* Declaration and Initialization of parameters */
+ /* Membrane time in ms */
const double tau_e = 30;
const double tau_i = 30;
- // Maximum firing rate in ms^-1
+ /* Maximum firing rate in ms^-1 */
const double Qe_max = 30.E-3;
const double Qi_max = 60.E-3;
- // Sigmoid threshold in mV
+ /* Sigmoid threshold in mV */
const double theta_e = -58.5;
const double theta_i = -58.5;
- // Sigmoid gain in mV
+ /* Sigmoid gain in mV */
const double sigma_e = 4;
const double sigma_i = 6;
- // Scaling parameter for sigmoidal mapping (dimensionless)
+ /* Scaling parameter for sigmoidal mapping (dimensionless) */
const double C1 = (3.14159265/sqrt(3));
- // parameters of the firing adaption
- const double alpha_Na = 2; // Sodium influx per spike in mM ms
- const double tau_Na = 1; // Sodium time constant in ms
+ /* parameters of the firing adaption */
+ const double alpha_Na = 2; /* Sodium influx per spike in mM ms */
+ const double tau_Na = 1; /* Sodium time constant in ms */
- const double R_pump = 0.09; // Na-K pump constant in mM/ms
- const double Na_eq = 9.5; // Na-eq concentration in mM
+ const double R_pump = 0.09; /* Na-K pump constant in mM/ms */
+ const double Na_eq = 9.5; /* Na-eq concentration in mM */
- // PSP rise time in ms^-1
+ /* PSP rise time in ms^-1 */
const double gamma_e = 70E-3;
const double gamma_i = 58.6E-3;
- /* axonal flux time constant */
- const double nu = 60E-3;
+ /* Axonal flux time constant */
+ const double nu = 120E-3;
-
- // Conductivities in mS/cm^-2
- // Leak current
+ /* Conductivities in mS/cm^-2 */
+ /* Leak */
const double g_L = 1;
- // KNa current
+ /* KNa */
const double g_KNa = 1.33;
- // Connectivities (dimensionless)
- const double N_ee = 120;
- const double N_ei = 72;
- const double N_ie = 90;
- const double N_ii = 90;
- const double N_te = 10;
- const double N_ti = 10;
-
- // Reversal potentials in mV
- // synaptic
+ /* Reversal potentials in mV */
+ /* synaptic */
const double E_AMPA = 0;
const double E_GABA = -70;
- // Leak
+ /* Leak */
const double E_L_e = -66;
const double E_L_i = -64;
- // Potassium
+ /* Potassium */
const double E_K = -100;
- // Noise parameters in ms^-1
+ /* Noise parameters in ms^-1 */
const double mphi = 0E-3;
- const double dphi = 30E-3;;
+ const double dphi = 60E-3;;
double input = 0.0;
+ /* Connectivities (dimensionless) */
+ const double N_ee = 120;
+ const double N_ei = 72;
+ const double N_ie = 90;
+ const double N_ii = 90;
+ const double N_te = 10;
+ const double N_ti = 10;
+
/* Pointer to thalamic column */
Thalamic_Column* Thalamus;
-
- friend class Stim;
};
/****************************************************************************************************/
/* end */
Oops, something went wrong.

0 comments on commit 1531e78

Please sign in to comment.