You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/activation_functions.md
+67-17Lines changed: 67 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,26 @@ where `t_contract = max(0, t - t_active)`
38
38
}
39
39
```
40
40
41
+
Or with explicit activation function specification:
42
+
```json
43
+
{
44
+
"type": "ChamberElastanceInductor",
45
+
"name": "ventricle",
46
+
"values": {
47
+
"Emax": 1.057,
48
+
"Emin": 0.091,
49
+
"Vrd": 26.1,
50
+
"Vrs": 18.0,
51
+
"Impedance": 0.000351787,
52
+
"activation_function_type": "half_cosine",
53
+
"activation_function_values": {
54
+
"t_active": 0.2,
55
+
"t_twitch": 0.3
56
+
}
57
+
}
58
+
}
59
+
```
60
+
41
61
### 2. Piecewise Cosine Activation (Type 1)
42
62
43
63
The default activation function for `LinearElastanceChamber` (formerly `PiecewiseCosineChamber`). It models separate contraction and relaxation phases:
@@ -63,10 +83,13 @@ The default activation function for `LinearElastanceChamber` (formerly `Piecewis
63
83
"Emax": 199.95,
64
84
"Epass": 260.59,
65
85
"Vrest": 26.24,
66
-
"contract_start": 0.025,
67
-
"relax_start": 0.08625,
68
-
"contract_duration": 0.06125,
69
-
"relax_duration": 0.18375
86
+
"activation_function_type": "piecewise_cosine",
87
+
"activation_function_values": {
88
+
"contract_start": 0.025,
89
+
"relax_start": 0.08625,
90
+
"contract_duration": 0.06125,
91
+
"relax_duration": 0.18375
92
+
}
70
93
}
71
94
}
72
95
```
@@ -107,23 +130,49 @@ C is a normalization constant ensuring maximum activation is 1.
107
130
"Vrd": 26.1,
108
131
"Vrs": 18.0,
109
132
"Impedance": 0.000351787,
110
-
"activation_type": 2,
111
-
"t_shift": 0.15,
112
-
"tau_1": 0.25,
113
-
"tau_2": 0.35,
114
-
"m1": 1.5,
115
-
"m2": 10.0
133
+
"activation_function_type": "two_hill",
134
+
"activation_function_values": {
135
+
"t_shift": 0.15,
136
+
"tau_1": 0.25,
137
+
"tau_2": 0.35,
138
+
"m1": 1.5,
139
+
"m2": 10.0
140
+
}
116
141
}
117
142
}
118
143
```
119
144
120
145
## Switching Between Activation Functions
121
146
122
-
To use a specific activation function, add the `activation_type` parameter to your chamber configuration:
147
+
To use a specific activation function, add the `activation_function_type` parameter to your chamber configuration:
148
+
149
+
-`activation_function_type: "half_cosine"` - Half Cosine (default for ChamberElastanceInductor)
150
+
-`activation_function_type: "piecewise_cosine"` - Piecewise Cosine (default for LinearElastanceChamber)
151
+
-`activation_function_type: "two_hill"` - Two Hill
152
+
153
+
Group the activation function-specific parameters under `activation_function_values` as a nested dictionary.
154
+
155
+
## Backward Compatibility
156
+
157
+
For backward compatibility, the old flat format is also supported:
158
+
159
+
```json
160
+
{
161
+
"type": "ChamberElastanceInductor",
162
+
"name": "ventricle",
163
+
"values": {
164
+
"Emax": 1.057,
165
+
"Emin": 0.091,
166
+
"Vrd": 26.1,
167
+
"Vrs": 18.0,
168
+
"t_active": 0.2,
169
+
"t_twitch": 0.3,
170
+
"Impedance": 0.000351787
171
+
}
172
+
}
173
+
```
123
174
124
-
-`activation_type: 0` - Half Cosine (default for ChamberElastanceInductor)
125
-
-`activation_type: 1` - Piecewise Cosine (default for LinearElastanceChamber)
126
-
-`activation_type: 2` - Two Hill
175
+
This format will continue to work, with the activation function determined by which parameters are provided.
127
176
128
177
## Elastance Calculation
129
178
@@ -148,6 +197,7 @@ The two-hill activation function is described in:
148
197
## Backward Compatibility
149
198
150
199
Existing configuration files will continue to work without modification:
151
-
-`ChamberElastanceInductor` defaults to half cosine activation (type 0)
152
-
-`LinearElastanceChamber` defaults to piecewise cosine activation (type 1)
153
-
-`PiecewiseCosineChamber` is maintained as an alias to `LinearElastanceChamber` for backward compatibility
200
+
-`ChamberElastanceInductor` defaults to half cosine activation when `t_active` and `t_twitch` are provided
201
+
-`LinearElastanceChamber` defaults to piecewise cosine activation when contraction/relaxation parameters are provided
202
+
- The old numeric `activation_type` parameter (0, 1, 2) is still supported but deprecated in favor of the string format
203
+
- Parameters can be specified at the top level without using `activation_function_values` for backward compatibility
0 commit comments