diff --git a/bluecellulab/cell/injector.py b/bluecellulab/cell/injector.py index a49a9fe..a881637 100644 --- a/bluecellulab/cell/injector.py +++ b/bluecellulab/cell/injector.py @@ -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) diff --git a/tests/test_cell/test_injector.py b/tests/test_cell/test_injector.py index eb06547..1d337b3 100644 --- a/tests/test_cell/test_injector.py +++ b/tests/test_cell/test_injector.py @@ -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, @@ -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