Skip to content

Commit

Permalink
formatting, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
espenhgn committed Apr 1, 2022
1 parent 35b3c8c commit f739ae1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lfpykit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,8 @@ def _squeeze_cell_in_depth_direction(self):
bad_comps, reason = self._return_comp_outside_slice()
msg = ("Compartments {} of cell ({}) has cell.{} slice. "
"Increase squeeze_cell_factor, move or rotate cell."
).format(cell.get_idx()[bad_comps], self.cell, reason)
).format(np.arange(self.cell.totnsegs)[bad_comps],
self.cell, reason)

raise RuntimeError(msg)

Expand Down Expand Up @@ -1321,7 +1322,8 @@ def _test_cell_extent(self):
bad_comps, reason = self._return_comp_outside_slice()
msg = ("Compartments {} of cell ({}) has cell.{} slice "
"and argument squeeze_cell_factor is None."
).format(cell.get_idx()[bad_comps], self.cell, reason)
).format(np.arange(self.cell.totnsegs)[bad_comps],
self.cell, reason)
raise RuntimeError(msg)
else:
if self.verbose:
Expand Down
12 changes: 8 additions & 4 deletions lfpykit/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,25 +581,29 @@ def test_RecMEAElectrode_02(self):
stick.z[true_bad_comp, 0] = 1000
bad_comp, reason = MEA._return_comp_outside_slice()
np.testing.assert_equal(reason, "zstart above")
np.testing.assert_equal(true_bad_comp, bad_comp)
np.testing.assert_equal(true_bad_comp,
np.arange(stick.totnsegs)[bad_comp])
stick.z[true_bad_comp, 0] = 100

stick.z[true_bad_comp, 0] = -1000
bad_comp, reason = MEA._return_comp_outside_slice()
np.testing.assert_equal(reason, "zstart below")
np.testing.assert_equal(true_bad_comp, bad_comp)
np.testing.assert_equal(true_bad_comp,
np.arange(stick.totnsegs)[bad_comp])
stick.z[true_bad_comp, 0] = 100

stick.z[true_bad_comp, -1] = 1000
bad_comp, reason = MEA._return_comp_outside_slice()
np.testing.assert_equal(reason, "zend above")
np.testing.assert_equal(true_bad_comp, bad_comp)
np.testing.assert_equal(true_bad_comp,
np.arange(stick.totnsegs)[bad_comp])
stick.z[true_bad_comp, -1] = 100

stick.z[true_bad_comp, -1] = -1000
bad_comp, reason = MEA._return_comp_outside_slice()
np.testing.assert_equal(reason, "zend below")
np.testing.assert_equal(true_bad_comp, bad_comp)
np.testing.assert_equal(true_bad_comp,
np.arange(stick.totnsegs)[bad_comp])
stick.z[true_bad_comp, -1] = 100

def test_RecMEAElectrode_03(self):
Expand Down

0 comments on commit f739ae1

Please sign in to comment.