Remove the unused _is_interval_between_state_changes method.

This commit is contained in:
Phil Elson 2021-08-06 10:01:31 +02:00
parent 0e71ace0d9
commit 06b606f3fa
2 changed files with 2 additions and 28 deletions

View file

@ -784,7 +784,7 @@ class ConcentrationModel:
"""
times = self.state_change_times()
t_index = np.searchsorted(times, time)
t_index: int = np.searchsorted(times, time) # type: ignore
# Search sorted gives us the index to insert the given time. Instead we
# want to get the index of the most recent time, so reduce the index by
# one unless we are already at 0.
@ -804,14 +804,6 @@ class ConcentrationModel:
f"state change time ({change_time})"
)
def _is_interval_between_state_changes(self, start: float, stop: float) -> bool:
"""
Check that the times start and stop are in-between two state
changes of the concentration model (to ensure sure that all
model parameters stay constant between start and stop).
"""
return (self.last_state_change(stop) <= start)
@method_cache
def _concentration_cached(self, time: float) -> _VectorisedFloat:
# A cached version of the concentration method. Use this method if you

View file

@ -70,7 +70,7 @@ def simple_conc_model():
@pytest.mark.parametrize(
"time, expected_last_state_change", [
[-15., 0.], # Out of range goes to the last state.
[-15., 0.], # Out of range goes to the first state.
[0., 0],
[1., 0],
[1.05, 1.],
@ -121,24 +121,6 @@ def test_next_state_change_time_out_of_range(simple_conc_model: models.Concentra
simple_conc_model._next_state_change(3.1)
@pytest.mark.parametrize(
"start, stop, is_valid", [
[0, 1.05, False],
[0.99, 1.1, False],
[0.5, 1.01, False],
[0, 1, True],
[1.01, 1.1, True],
[0.01, 1, True],
[1.11, 1.99, True],
]
)
def test_valid_interval(
start, stop, is_valid,
simple_conc_model: models.ConcentrationModel
):
assert simple_conc_model._is_interval_between_state_changes(start, stop) == is_valid
def test_integrated_concentration(simple_conc_model):
c1 = simple_conc_model.integrated_concentration(0, 2)
c2 = simple_conc_model.integrated_concentration(0, 1)