Skip to content

Commit

Permalink
aln: fix index of input from i to i-1 (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
caglorithm committed Aug 30, 2023
1 parent bec8fbc commit ce434bd
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions neurolib/models/aln/timeIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ def timeIntegration_njit_elementwise(
noise_exc,
noise_inh,
):

# squared Jee_max
sq_Jee_max = Jee_max**2
sq_Jei_max = Jei_max**2
Expand All @@ -415,7 +414,6 @@ def timeIntegration_njit_elementwise(

### integrate ODE system:
for i in range(startind, startind + len(t)):

if not distr_delay:
# Get the input from one node into another from the rates at time t - connection_delay - 1
# remark: assume Kie == Kee and Kei == Kii
Expand All @@ -429,13 +427,12 @@ def timeIntegration_njit_elementwise(

# loop through all the nodes
for no in range(N):

# To save memory, noise is saved in the rates array
noise_exc[no] = rates_exc[no, i]
noise_inh[no] = rates_inh[no, i]

mue = Jee_max * seem[no] + Jei_max * seim[no] + mue_ou[no] + ext_exc_current[no, i]
mui = Jie_max * siem[no] + Jii_max * siim[no] + mui_ou[no] + ext_inh_current[no, i]
mue = Jee_max * seem[no] + Jei_max * seim[no] + mue_ou[no] + ext_exc_current[no, i - 1]
mui = Jie_max * siem[no] + Jii_max * siim[no] + mui_ou[no] + ext_inh_current[no, i - 1]

# compute row sum of Cmat*rd_exc and Cmat**2*rd_exc
rowsum = 0
Expand All @@ -446,20 +443,22 @@ def timeIntegration_njit_elementwise(

# z1: weighted sum of delayed rates, weights=c*K
z1ee = (
cee * Ke * rd_exc[no, no] + c_gl * Ke_gl * rowsum + c_gl * Ke_gl * ext_exc_rate[no, i]
cee * Ke * rd_exc[no, no] + c_gl * Ke_gl * rowsum + c_gl * Ke_gl * ext_exc_rate[no, i - 1]
) # rate from other regions + exc_ext_rate
z1ei = cei * Ki * rd_inh[no]
z1ie = (
cie * Ke * rd_exc[no, no] + c_gl * Ke_gl * ext_inh_rate[no, i]
cie * Ke * rd_exc[no, no] + c_gl * Ke_gl * ext_inh_rate[no, i - 1]
) # first test of external rate input to inh. population
z1ii = cii * Ki * rd_inh[no]
# z2: weighted sum of delayed rates, weights=c^2*K (see thesis last ch.)
z2ee = (
cee**2 * Ke * rd_exc[no, no] + c_gl**2 * Ke_gl * rowsumsq + c_gl**2 * Ke_gl * ext_exc_rate[no, i]
cee**2 * Ke * rd_exc[no, no]
+ c_gl**2 * Ke_gl * rowsumsq
+ c_gl**2 * Ke_gl * ext_exc_rate[no, i - 1]
)
z2ei = cei**2 * Ki * rd_inh[no]
z2ie = (
cie**2 * Ke * rd_exc[no, no] + c_gl**2 * Ke_gl * ext_inh_rate[no, i]
cie**2 * Ke * rd_exc[no, no] + c_gl**2 * Ke_gl * ext_inh_rate[no, i - 1]
) # external rate input to inh. population
z2ii = cii**2 * Ki * rd_inh[no]

Expand Down Expand Up @@ -595,7 +594,6 @@ def interpolate_values(table, xid1, yid1, dxid, dyid):

@numba.njit(locals={"idxX": numba.int64, "idxY": numba.int64})
def lookup_no_interp(x, dx, xi, y, dy, yi):

"""
Return the indices for the closest values for a look-up table
Choose the closest point in the grid
Expand Down Expand Up @@ -638,7 +636,6 @@ def lookup_no_interp(x, dx, xi, y, dy, yi):

@numba.njit(locals={"xid1": numba.int64, "yid1": numba.int64, "dxid": numba.float64, "dyid": numba.float64})
def fast_interp2_opt(x, dx, xi, y, dy, yi):

"""
Returns the values needed for interpolation:
- bilinear (2D) interpolation within ranges,
Expand Down

0 comments on commit ce434bd

Please sign in to comment.