From ce434bd9895f1b7d3bd57f7d8eeae08b4b970973 Mon Sep 17 00:00:00 2001 From: Caglar Cakan Date: Wed, 30 Aug 2023 12:53:34 +0200 Subject: [PATCH] aln: fix index of input from i to i-1 (#240) --- neurolib/models/aln/timeIntegration.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/neurolib/models/aln/timeIntegration.py b/neurolib/models/aln/timeIntegration.py index 67fc19b5..f8cf2c52 100644 --- a/neurolib/models/aln/timeIntegration.py +++ b/neurolib/models/aln/timeIntegration.py @@ -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 @@ -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 @@ -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 @@ -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] @@ -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 @@ -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,