Skip to content

Commit

Permalink
keep e, i in range [0,1] (#233)
Browse files Browse the repository at this point in the history
* keep e, i in range [0,1]

* refactor as suggested
  • Loading branch information
lenasal committed May 2, 2023
1 parent 6771599 commit e1e0509
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions neurolib/models/wc/timeIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ def S_I(x):
excs[no, i] = excs[no, i - 1] + dt * exc_rhs
inhs[no, i] = inhs[no, i - 1] + dt * inh_rhs

# make sure e and i variables do not exceed 1 (can only happen with noise)
if excs[no, i] > 1.0:
excs[no, i] = 1.0
if excs[no, i] < 0.0:
excs[no, i] = 0.0

if inhs[no, i] > 1.0:
inhs[no, i] = 1.0
if inhs[no, i] < 0.0:
inhs[no, i] = 0.0

# Ornstein-Uhlenbeck process
exc_ou[no] = (
exc_ou[no] + (exc_ou_mean - exc_ou[no]) * dt / tau_ou + sigma_ou * sqrt_dt * noise_exc[no]
Expand Down

0 comments on commit e1e0509

Please sign in to comment.