Ensure that 0 is always one of the state change times.
This commit is contained in:
parent
06b606f3fa
commit
f22ba928e0
2 changed files with 10 additions and 10 deletions
|
|
@ -769,7 +769,7 @@ class ConcentrationModel:
|
|||
the times at which their state changes.
|
||||
|
||||
"""
|
||||
state_change_times = set()
|
||||
state_change_times = {0.}
|
||||
state_change_times.update(self.infected.presence.transition_times())
|
||||
state_change_times.update(self.ventilation.transition_times())
|
||||
return sorted(state_change_times)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ def test_concentration_model_vectorisation(override_params):
|
|||
|
||||
@pytest.fixture
|
||||
def simple_conc_model():
|
||||
interesting_times = models.SpecificInterval(([0., 1.], [1.1, 1.999], [2., 3.]), )
|
||||
interesting_times = models.SpecificInterval(([0.5, 1.], [1.1, 2], [2., 3.]), )
|
||||
return models.ConcentrationModel(
|
||||
models.Room(75),
|
||||
models.AirChange(interesting_times, 100),
|
||||
|
|
@ -71,14 +71,14 @@ def simple_conc_model():
|
|||
@pytest.mark.parametrize(
|
||||
"time, expected_last_state_change", [
|
||||
[-15., 0.], # Out of range goes to the first state.
|
||||
[0., 0],
|
||||
[1., 0],
|
||||
[0., 0.],
|
||||
[0.5, 0.0],
|
||||
[0.51, 0.5],
|
||||
[1., 0.5],
|
||||
[1.05, 1.],
|
||||
[1.1, 1.],
|
||||
[1.11, 1.1],
|
||||
[1.999, 1.1],
|
||||
[1.9991, 1.999],
|
||||
[2., 1.999],
|
||||
[2., 1.1],
|
||||
[2.1, 2],
|
||||
[3., 2],
|
||||
[15., 3.], # Out of range goes to the last state.
|
||||
|
|
@ -94,12 +94,12 @@ def test_last_state_change_time(
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"time, expected_next_state_change", [
|
||||
[0, 0],
|
||||
[0.0, 0.0],
|
||||
[0.5, 0.5],
|
||||
[1, 1],
|
||||
[1.05, 1.1],
|
||||
[1.1, 1.1],
|
||||
[1.11, 1.999],
|
||||
[1.9991, 2],
|
||||
[1.11, 2],
|
||||
[2, 2],
|
||||
[2.1, 3],
|
||||
[3, 3],
|
||||
|
|
|
|||
Loading…
Reference in a new issue