Skip to content

Commit f333d5b

Browse files
committed
BOLD initialization : avoid divide by zero with default params
1 parent ec2434e commit f333d5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

neurolib/models/bold/timeIntegration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ def integrateBOLD_numba(BOLD, X, Q, F, V, Z, dt, N, rho, alpha, V0, k1, k2, k3,
9999
for i in range(len(Z[0, :])): # loop over all timesteps
100100
# component-wise loop for compatibilty with numba
101101
for j in range(N): # loop over all areas
102+
F[j] = max(F[j], EPS)
103+
102104
X[j] = X[j] + dt * (Z[j, i] - K[j] * X[j] - Gamma[j] * (F[j] - 1))
103105
Q[j] = Q[j] + dt / Tau[j] * (F[j] / rho * (1 - (1 - rho) ** (1 / F[j])) - Q[j] * V[j] ** (1 / alpha - 1))
104106
V[j] = V[j] + dt / Tau[j] * (F[j] - V[j] ** (1 / alpha))
105107
F[j] = F[j] + dt * X[j]
106108

107-
F[j] = max(F[j], EPS)
108-
109109
BOLD[j, i] = V0 * (k1 * (1 - Q[j]) + k2 * (1 - Q[j] / V[j]) + k3 * (1 - V[j]))
110110
return BOLD, X, F, Q, V

0 commit comments

Comments
 (0)