Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bluecellulab/cell/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def add_voltage_clamp(
vclamp.amp1 = level

if durations is not None and levels is not None:
if len(levels) != len(durations) - 1:
if len(levels) != len(durations):
raise BluecellulabError("Inconsistent durations and levels for seclamp.")

voltage_vec = h.Vector(levels)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cell/test_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_multilevel_voltage_clamp(self):
amp = 10
stop_time = 10
voltages = [20, 30]
durations = [2, 3, 5]
durations = [2, 3]
rs = 1
seclamp_obj = self.cell.add_voltage_clamp(
stop_time=stop_time, level=amp, rs=rs, levels=voltages, durations=durations,
Expand All @@ -158,6 +158,7 @@ def test_multilevel_voltage_clamp(self):
self.sim.run(10, dt=0.2, cvode=False)
voltage_rec = np.array(v_rec.to_python())
# has to add one 10 at the beginning for t=0
# last value (30) will last until clamp is off
assert (voltage_rec == np.array(
[
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, # 10 + 1 extra for t=0
Expand Down
Loading