This repository was archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAFSpikingExpIF.cs
89 lines (84 loc) · 3.76 KB
/
AFSpikingExpIF.cs
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
using RCNet.MathTools.Differential;
using RCNet.MathTools.VectorMath;
using System;
namespace RCNet.Neural.Activation
{
/// <summary>
/// Implements the Exponential Integrate and Fire neuron model.
/// </summary>
/// <remarks>
/// For more information visit the http://neuronaldynamics.epfl.ch/online/Ch5.S2.html site.
/// </remarks>
[Serializable]
public class AFSpikingExpIF : AFSpikingODE
{
//Constants
//Attributes
//Parameters
private readonly double _timeScale;
private readonly double _resistance;
private readonly double _rheobaseV;
private readonly double _sharpnessDeltaT;
//Constructor
/// <summary>
/// Creates an initialized instance.
/// </summary>
/// <param name="timeScale">The membrane time scale (ms).</param>
/// <param name="resistance">The membrane resistance (Mohm).</param>
/// <param name="restV">The membrane rest potential (mV).</param>
/// <param name="resetV">The membrane reset potential (mV).</param>
/// <param name="rheobaseV">The membrane rheobase threshold (mV).</param>
/// <param name="firingThresholdV">The membrane firing threshold (mV).</param>
/// <param name="sharpnessDeltaT">The sharpness of membrane potential change (mV).</param>
/// <param name="refractoryPeriods">The number of after-spike computation cycles while an input stimuli to be ignored (cycles).</param>
/// <param name="solverMethod">The ODE numerical solver method to be used.</param>
/// <param name="solverCompSteps">The number of computation sub-steps of the ODE numerical solver.</param>
/// <param name="stimuliDuration">The duration of the membrane stimulation (ms).</param>
/// <param name="initialVRatio">The membrane initial potential in form of a ratio between 0 and 1, where 0 corresponds to a Min(resetV, restV) potential and 1 corresponds to a firingThreshold.</param>
public AFSpikingExpIF(double timeScale,
double resistance,
double restV,
double resetV,
double rheobaseV,
double firingThresholdV,
double sharpnessDeltaT,
int refractoryPeriods,
ODENumSolver.Method solverMethod,
int solverCompSteps,
double stimuliDuration,
double initialVRatio = 0d
)
: base(restV,
resetV,
firingThresholdV,
refractoryPeriods,
solverMethod,
stimuliDuration,
solverCompSteps,
1,
10,
1,
initialVRatio
)
{
_timeScale = timeScale;
_resistance = resistance;
_rheobaseV = rheobaseV;
_sharpnessDeltaT = sharpnessDeltaT;
return;
}
//Methods
/// <inheritdoc/>
protected override Vector MembraneDiffEq(double t, Vector v)
{
Vector dvdt = new Vector(1);
//Ensure numerical stability
double exponent = Math.Min((v[VarMembraneVIdx] - _rheobaseV) / _sharpnessDeltaT, 20);
dvdt[VarMembraneVIdx] = (-(v[VarMembraneVIdx] - _restV)
+ _sharpnessDeltaT * Math.Exp(exponent)
+ _resistance * _stimuli
) / _timeScale;
return dvdt;
}
}//AFSpikingExpIF
}//Namespace