Permalink
Browse files

Moved paramters into the class definition.

That makes it easier to modify them at initialization.

Signed-off-by: Schellenberger <schellenberger@inb.uni-luebeck.de>
  • Loading branch information...
1 parent 37f038e commit f5a83cfa4e07cc1d08536030ee2b84021d196dac @miscco committed Apr 3, 2014
Showing with 230 additions and 258 deletions.
  1. +7 −8 .cproject
  2. +6 −7 Plots.m
  3. +76 −47 Stimulation.h
  4. +19 −19 Thalamic_Column.cpp
  5. +108 −42 Thalamic_Column.h
  6. +14 −13 Thalamus.cpp
  7. +0 −122 parameters.h
View
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 4.0.0?>
-
-<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.2035009566">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.2035009566" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
- <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -23,7 +21,7 @@
<builder buildPath="${workspace_loc:/Steyn-Ross/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.1425458860" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.209904263" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2059871958" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
- <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.349862431" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.349862431" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1666482058" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.other.other.1199345592" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-std=c++0x -c -fmessage-length=0" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.426453201" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -36,7 +34,7 @@
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1785383603" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.782864723" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.flags.712983263" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-std=c++0x " valueType="string"/>
- <option id="gnu.cpp.link.option.libs.1849787926" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"/>
+ <option id="gnu.cpp.link.option.libs.1849787926" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1171029032" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -58,12 +56,12 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1896797791" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
- <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -106,12 +104,12 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.2035009566.1093924399" moduleId="org.eclipse.cdt.core.settings" name="MATLAB">
<externalSettings/>
<extensions>
- <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -175,4 +173,5 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope"/>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>
View
13 Plots.m
@@ -1,21 +1,20 @@
% mex command is given by:
% mex CXXFLAGS="\$CXXFLAGS -std=gnu++0x -fpermissive" Thalamus.cpp Thalamic_Column.cpp
-function Plots(T, onset)
+function Plots(T)
if nargin == 0
- Con = [10; % N_tr
- 20; % N_rt
- 40]; % N_rr
+ Con = [2; % N_tr
+ 5.5; % N_rt
+ 5]; % N_rr
var_stim = [ 0; % strength of the stimulus in Hz (spikes per second)
0; % time between stimuli in s
0; % time until first stimuli in s
0]; % duration of the stimulus in ms
- T = 30; % duration of the simulation
+ T = 60; % duration of the simulation
end
-
-[Vt] = Thalamus(T, Con, var_stim);
+[Vt, Vr] = Thalamus(T, Con, var_stim);
L = max(size(Vt));
timeaxis = linspace(0,T,L);
View
@@ -9,86 +9,115 @@
/****************************************************************************************************/
class Stim {
public:
- // empty constructor for compiling
+ /* empty constructor for compiling */
Stim(void);
- Stim(Thalamic_Column& C, double* var)
- {Thalamus = &T;
- setup(var);}
+ Stim(Thalamic_Column& T, double* var)
+ { Thalamus = &T;
+ setup(var);}
- // scaling from SI to simulation variables s -> ms
+ /* setup with respect to stimulation mode */
void setup (double* var_stim) {
extern const int onset;
extern const int res;
extern const int dt;
- // scale the stimulation strength with respect to ms^-1
- strength = var_stim[0] / 1000;
+ /* mode of stimulation */
+ mode = (int) var_stim[0];
- // scale the stimulation variables with respect to simulation resolution
- ISI = (int) var_stim[1] * res;
+ /* scale the stimulation strength from s^-1 to ms^-1 */
+ strength = var_stim[1] / 1000;
- // stimulation starts after the onset
- start = (int)(var_stim[2] + onset) *res;
+ /* scale duration from ms to dt */
+ duration = (int) var_stim[2] * res / 1000;
+
+ /* scale the ISI from s to ms^-1 */
+ ISI = (int) var_stim[3] * res;
+
+ /* scale time to stimulus from ms to dt */
+ time_to_stim= (int) var_stim[4] * res / 1000;
+
+ if(mode==1) {
+ time_to_stim = (onset+1) * res;
+ }
+
+ correction = onset * res;
- // rescale duration with respect to dt
- duration = (int) var_stim[3]/dt;
}
void check_stim (int time) {
- // check whether a stimulation should start
- // the duration of the stimulation is ignored
- if(time==(start + count_stim*ISI)){
- // turn the stimulation on
- mode = 1;
- Thalamus->set_input(strength);
- }
+ /* check if stimulation should start */
+ switch (mode) {
- // check whether a stimulation should end
- if(mode ==1 && count_dur ==duration) {
- // turn off the stimulation
- mode = 0;
- Thalamus->set_input(0.0);
+ /* no stimulation */
+ default:
+ break;
- // add counter for stimulation occurrence
- count_stim++ ;
+ /* periodic stimulation */
+ case 1:
+ /* check if time is reached */
+ if(time == time_to_stim) {
+ /* switch stimulation on */
+ stimulation_started = true;
+ Thalamus->set_input(strength);
+
+ /* update the timer */
+ time_to_stim += ISI;
+ }
+ break;
- // reset the stimulation counter
- count_dur = 0;
}
- // if stimulation is on track count its duration
- if(mode==1){
- count_dur++;
+ /* wait to switch the stimulation off */
+ if(stimulation_started) {
+ count_duration++;
+
+ /* switch stimulation off */
+ if(count_duration==duration) {
+ stimulation_started = false;
+ count_duration = 0;
+ Thalamus->set_input(0.0);
+ }
}
}
private:
- // stimulation strength
- double strength = 0.0;
+ /* Stimulation parameters */
+ /* stimulation strength */
+ double strength = 0.0;
+
+ /* duration of the stimulation */
+ int duration = 500;
- // inter stimulus interval
- int ISI = 0;
+ /* inter stimulus intervall in case of periodic stimulation */
+ int ISI = 5E4;
- // onset until stimulation starts
- int start = 0;
+ /* time until stimulus after minimum was found */
+ int time_to_stim = 5500;
- // duration of the stimulation
- int duration = 0;
+ /* mode of stimulation */
+ /* 0 == none */
+ /* 1 == periodic */
+ int mode = 0;
- // counter for stimulation events
- int count_stim = 0;
+ /* Internal variables */
+ /* Simulation on for TRUE and off for FALSE */
+ bool stimulation_started= false;
- // counter for stimulation length
- int count_dur = 0;
+ /* onset in timesteps to correct the given time of the markers */
+ int correction = 10000;
- // Simulation on for TRUE and off for FALSE
- bool mode = 0;
+ /* counter for stimulation duration */
+ int count_duration = 0;
- // Pointer to thalamic module
+ /* counter after minimum */
+ int count_to_start = 0;
+
+ /* pointer to thalamic column */
Thalamic_Column* Thalamus;
+
};
/****************************************************************************************************/
/* end */
View
@@ -13,7 +13,7 @@ void Thalamic_Column::set_RNG(void) {
// get the RNG
for (int i=0; i<N; ++i){
// add the RNG
- MTRands.push_back({ENG(rand()), DIST (mphi_t, dphi_t)});
+ MTRands.push_back({ENG(rand()), DIST (mphi, dphi)});
// get the random number for the first iteration
Rand_vars.push_back(MTRands[i]());
@@ -51,27 +51,27 @@ double Thalamic_Column::get_Qr (int N) const{
// excitatory input to TC population
double Thalamic_Column::I_et (int N) const{
_SWITCH((Vt)(Phi_tt))
- double psi = g_AMPA * var_Phi_tt * (var_Vt - E_AMPA);
+ double psi = var_Phi_tt * (var_Vt - E_AMPA);
return psi;
}
// inhibitory input to TC population
double Thalamic_Column::I_it (int N) const{
_SWITCH((Vt)(Phi_rt))
- double psi = g_GABA * var_Phi_rt * (var_Vt - E_GABA);
+ double psi = var_Phi_rt * (var_Vt - E_GABA);
return psi;
}
// excitatory input to RE population
double Thalamic_Column::I_er (int N) const{
_SWITCH((Vr)(Phi_tr))
- double psi = g_AMPA * var_Phi_tr * (var_Vr - E_AMPA);
+ double psi = var_Phi_tr * (var_Vr - E_AMPA);
return psi;
}
// inhibitory input to RE population
double Thalamic_Column::I_ir (int N) const{
_SWITCH((Vr)(Phi_rr))
- double psi = g_GABA * var_Phi_rr * (var_Vr - E_GABA);
+ double psi = var_Phi_rr * (var_Vr - E_GABA);
return psi;
}
/****************************************************************************************************/
@@ -179,51 +179,51 @@ double Thalamic_Column::tau_m_h (int N) const{
// Leak current of TC population
double Thalamic_Column::I_L_t (int N) const{
_SWITCH((Vt))
- double I = gL_t * (var_Vt - E_L_t);
+ double I = g_L_t * (var_Vt - E_L_t);
return I;
}
// Potassium leak current of TC population
double Thalamic_Column::I_LK_t (int N) const{
_SWITCH((Vt))
- double I = gLK_t * (var_Vt - E_LK_t);
+ double I = g_LK_t * (var_Vt - E_K);
return I;
}
// Leak current of RE population
double Thalamic_Column::I_L_r (int N) const{
_SWITCH((Vr))
- double I = gL_r * (var_Vr - E_L_r);
+ double I = g_L_r * (var_Vr - E_L_r);
return I;
}
// Potassium leak current of RE population
double Thalamic_Column::I_LK_r (int N) const{
_SWITCH((Vr))
- double I = gLK_r * (var_Vr - E_LK_r);
+ double I = g_LK_r * (var_Vr - E_K);
return I;
}
// T-type current of TC population
double Thalamic_Column::I_T_t (int N) const{
_SWITCH((Vt)(h_T_t))
- //double I = gTt * pow(var_m_T_t, 2) * var_h_T_t * (var_Vt - E_Ca);
- double I = gTt * pow(m_inf_T_t(N), 2) * var_h_T_t * (var_Vt - E_Ca);
+ //double I = g_T_t * pow(var_m_T_t, 2) * var_h_T_t * (var_Vt - E_Ca);
+ double I = g_T_t * pow(m_inf_T_t(N), 2) * var_h_T_t * (var_Vt - E_Ca);
return I;
}
// T-type current of RE population
double Thalamic_Column::I_T_r (int N) const{
_SWITCH((Vr)(h_T_r)(m_T_r))
- double I = gTr * pow(var_m_T_r, 2) * var_h_T_r * (var_Vr - E_Ca);
- //double I = gTr * pow(m_inf_T_r(N), 2) * var_h_T_r * (var_Vr - E_Ca);
+ double I = g_T_r * pow(var_m_T_r, 2) * var_h_T_r * (var_Vr - E_Ca);
+ //double I = g_T_r * pow(m_inf_T_r(N), 2) * var_h_T_r * (var_Vr - E_Ca);
return I;
}
// h-type current of TC population
double Thalamic_Column::I_h (int N) const{
_SWITCH((Vt)(m_h)(m_h2))
- double I = gh * (var_m_h + g_inc * var_m_h2) * (var_Vt - E_h);
+ double I = g_h * (var_m_h + g_inc * var_m_h2) * (var_Vt - E_h);
return I;
}
/****************************************************************************************************/
@@ -269,10 +269,10 @@ void Thalamic_Column::set_RK (int N) {
Phi_tr [N] = dt*(var_x_tr);
Phi_rt [N] = dt*(var_x_rt);
Phi_rr [N] = dt*(var_x_rr);
- x_tt [N] = dt*(pow(gamma_t, 2) * (noise_xRK(N) - var_Phi_tt) - 2 * gamma_t * var_x_tt);
- x_tr [N] = dt*(pow(gamma_t, 2) * (N_tr * get_Qt(N) - var_Phi_tr) - 2 * gamma_t * var_x_tr);
- x_rt [N] = dt*(pow(gamma_r, 2) * (N_rt * get_Qr(N) - var_Phi_rt) - 2 * gamma_r * var_x_rt);
- x_rr [N] = dt*(pow(gamma_r, 2) * (N_rr * get_Qr(N) - var_Phi_rr) - 2 * gamma_r * var_x_rr);
+ x_tt [N] = dt*(pow(gamma_e, 2) * (noise_xRK(N) - var_Phi_tt) - 2 * gamma_e * var_x_tt);
+ x_tr [N] = dt*(pow(gamma_e, 2) * (N_tr * get_Qt(N) - var_Phi_tr) - 2 * gamma_e * var_x_tr);
+ x_rt [N] = dt*(pow(gamma_i, 2) * (N_rt * get_Qr(N) - var_Phi_rt) - 2 * gamma_i * var_x_rt);
+ x_rr [N] = dt*(pow(gamma_i, 2) * (N_rr * get_Qr(N) - var_Phi_rr) - 2 * gamma_i * var_x_rr);
}
/****************************************************************************************************/
/* end */
@@ -291,7 +291,7 @@ void Thalamic_Column::add_RK(void) {
Phi_tr [0] += (Phi_tr [1] + Phi_tr [2] * 2 + Phi_tr [3] * 2 + Phi_tr [4])/6;
Phi_rt [0] += (Phi_rt [1] + Phi_rt [2] * 2 + Phi_rt [3] * 2 + Phi_rt [4])/6;
Phi_rr [0] += (Phi_rr [1] + Phi_rr [2] * 2 + Phi_rr [3] * 2 + Phi_rr [4])/6;
- x_tt [0] += (x_tt [1] + x_tt [2] * 2 + x_tt [3] * 2 + x_tt [4])/6 + pow(gamma_t, 2) * h * Rand_vars[0];
+ x_tt [0] += (x_tt [1] + x_tt [2] * 2 + x_tt [3] * 2 + x_tt [4])/6 + pow(gamma_e, 2) * h * Rand_vars[0];
x_tr [0] += (x_tr [1] + x_tr [2] * 2 + x_tr [3] * 2 + x_tr [4])/6;
x_rt [0] += (x_rt [1] + x_rt [2] * 2 + x_rt [3] * 2 + x_rt [4])/6;
x_rr [0] += (x_rr [1] + x_rr [2] * 2 + x_rr [3] * 2 + x_rr [4])/6;
Oops, something went wrong.

0 comments on commit f5a83cf

Please sign in to comment.