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 pathAFSpikingIzhikevichIF.cs
103 lines (95 loc) · 4.29 KB
/
AFSpikingIzhikevichIF.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using RCNet.Extensions;
using RCNet.MathTools.Differential;
using RCNet.MathTools.VectorMath;
using System;
namespace RCNet.Neural.Activation
{
/// <summary>
/// Implements the Izhikevich Integrate and Fire neuron model.
/// </summary>
/// <remarks>
/// For more information visit the https://www.izhikevich.org/publications/spikes.pdf site.
/// </remarks>
[Serializable]
public class AFSpikingIzhikevichIF : AFSpikingODE
{
//Constants
/// <summary>
/// An index of recovery evolving variable.
/// </summary>
protected const int VarRecovery = 1;
//Attributes
private readonly double _recoveryTimeScale;
private readonly double _recoverySensitivity;
private readonly double _recoveryReset;
//Constructor
/// <summary>
/// Creates an initialized instance.
/// </summary>
/// <param name="recoveryTimeScale">The time scale of the recovery variable.</param>
/// <param name="recoverySensitivity">The sensitivity of the recovery variable to the sub-threshold fluctuations of the membrane potential.</param>
/// <param name="recoveryReset">The after-spike reset of the recovery variable.</param>
/// <param name="restV">The membrane rest potential (mV).</param>
/// <param name="resetV">The membrane reset potential (mV).</param>
/// <param name="firingThresholdV">The membrane firing threshold (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 AFSpikingIzhikevichIF(double recoveryTimeScale,
double recoverySensitivity,
double recoveryReset,
double restV,
double resetV,
double firingThresholdV,
int refractoryPeriods,
ODENumSolver.Method solverMethod,
int solverCompSteps,
double stimuliDuration,
double initialVRatio = 0d
)
: base(restV,
resetV,
firingThresholdV,
refractoryPeriods,
solverMethod,
stimuliDuration,
solverCompSteps,
2,
100,
1,
initialVRatio
)
{
_recoveryTimeScale = recoveryTimeScale;
_recoverySensitivity = recoverySensitivity;
_recoveryReset = recoveryReset;
_evolVars[VarRecovery] = (_recoverySensitivity * _evolVars[VarMembraneVIdx]);
return;
}
//Properties
//Methods
/// <inheritdoc/>
public override void Reset()
{
base.Reset();
_evolVars[VarRecovery] = (_recoverySensitivity * _evolVars[VarMembraneVIdx]);
return;
}
/// <inheritdoc/>
protected override Vector MembraneDiffEq(double t, Vector v)
{
Vector dvdt = new Vector(2);
dvdt[VarMembraneVIdx] = 0.04 * v[VarMembraneVIdx].Power(2) + 5 * v[VarMembraneVIdx] + 140 - v[VarRecovery] + _stimuli;
dvdt[VarRecovery] = _recoveryTimeScale * (_recoverySensitivity * v[VarMembraneVIdx] - v[VarRecovery]);
return dvdt;
}
/// <inheritdoc/>
protected override void OnFiring()
{
_evolVars[VarRecovery] += _recoveryReset;
return;
}
}//AFSpikingIzhikevichIF
}//Namespace