Skip to content

Commit

Permalink
fi test bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Mar 23, 2022
1 parent cb9f0cf commit 0de0693
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions brainpy/connect/tests/test_regular_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_one2one():
num = bp.tools.size2num(size)

actual_mat = bp.math.zeros((num, num), dtype=bp.math.bool_)
actual_mat = bp.math.fill_diagonal(actual_mat, True)
bp.math.fill_diagonal(actual_mat, True)

assert bp.math.array_equal(actual_mat, conn_mat)
assert bp.math.array_equal(pre_ids, bp.math.arange(num))
Expand Down Expand Up @@ -42,7 +42,7 @@ def test_all2all():
print(mat)
actual_mat = bp.math.ones((num, num), dtype=bp.math.bool_)
if not has_self:
actual_mat = bp.math.fill_diagonal(actual_mat, False)
bp.math.fill_diagonal(actual_mat, False)

assert bp.math.array_equal(actual_mat, mat)

Expand Down
3 changes: 2 additions & 1 deletion brainpy/math/delay_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def __init__(

def _check_time(self, times, transforms):
prev_time, current_time = times
current_time = current_time[0]
if prev_time > current_time + 1e-6:
raise ValueError(f'\n'
f'!!! Error in {self.__class__.__name__}: \n'
Expand All @@ -194,7 +195,7 @@ def __call__(self, time, indices=None):
return self._after_t0(time)

def _after_t0(self, prev_time):
diff = self.delay_len - (self.current_time - prev_time)
diff = self.delay_len - (self.current_time[0] - prev_time)
if isinstance(diff, ndarray):
diff = diff.value
if self.interp_method == _INTERP_LINEAR:
Expand Down

0 comments on commit 0de0693

Please sign in to comment.