added report data

This commit is contained in:
Luis Aleixo 2023-06-29 16:24:15 +01:00
parent be732da4ea
commit ddfe158467
3 changed files with 50 additions and 11 deletions

View file

@ -528,6 +528,19 @@
<li><p class="data_text">HEPA amount: {{ form.hepa_amount }} m³ / hour</p></li>
</ul>
{% endif %}
<li><p class="data_text">From Fitting:
{% if form.ventilation_type == "from_fitting" %}
Yes
<table border="1" style="width: 20%; margin-left: 30px; margin-top: 20px">
<tr><th>Ventilation value (ACH)</th></tr>
{% for ventilation in form.CO2_fitting_result['ventilation_values'] %}
<tr><th>{{ventilation}}</th></tr>
{% endfor %}
</table>
{% else %}
No </p></li>
{% endif %}
</p></li>
</ul>
</div>
</div>
@ -578,6 +591,9 @@
{% elif form.activity_type == "gym" %}
Gym - For comparison only, all persons doing heavy physical exercise, breathing and not speaking.
{% endif %}
{% if form.CO2_data_option %}
<p style="margin-left: 30px">Exhalation rate from fitting algorithm - {{form.CO2_fitting_result['exhalation_rate'] | round(2, 'floor')}} m³/h</p>
{% endif %}
</p></li>
{% if form.short_range_option == "short_range_yes" %}
<li><p class="data_text">

View file

@ -1578,10 +1578,7 @@ class ExposureModel:
c_model.ventilation.air_exchange(c_model.room, time)) for time in c_model.state_change_times()))):
raise ValueError("If the diameter is an array, none of the ventilation parameters "
"or virus decay constant can be arrays at the same time.")
if not isinstance(self.exposed.number, int):
raise NotImplementedError("Cannot use dynamic occupancy for"
" the exposed population")
@method_cache
def population_state_change_times(self) -> typing.List[float]:
"""

View file

@ -27,7 +27,7 @@ def full_exposure_model():
short_range=(),
exposed=models.Population(
number=10,
presence=models.SpecificInterval(((8, 12), (13, 17), )),
presence=models.SpecificInterval(((8, 12), (13, 17), )),
mask=models.Mask.types['No mask'],
activity=models.Activity.types['Seated'],
host_immunity=0.
@ -51,11 +51,37 @@ def baseline_infected_population_number():
@pytest.fixture
def dynamic_single_exposure_model(full_exposure_model, baseline_infected_population_number):
def baseline_exposed_population_number():
return models.Population(
number=models.IntPiecewiseConstant(
(8, 12, 13, 17), (10, 0, 10)),
presence=None,
mask=models.Mask.types['No mask'],
activity=models.Activity.types['Seated'],
host_immunity=0.,
)
@pytest.fixture
def dynamic_infected_single_exposure_model(full_exposure_model, baseline_infected_population_number):
return dc_utils.nested_replace(full_exposure_model,
{'concentration_model.infected': baseline_infected_population_number, })
@pytest.fixture
def dynamic_exposed_single_exposure_model(full_exposure_model, baseline_exposed_population_number):
return dc_utils.nested_replace(full_exposure_model,
{'exposed': baseline_exposed_population_number, })
@pytest.fixture
def dynamic_population_exposure_model(full_exposure_model, baseline_infected_population_number ,baseline_exposed_population_number):
return dc_utils.nested_replace(full_exposure_model, {
'concentration_model.infected': baseline_infected_population_number,
'exposed': baseline_exposed_population_number,
})
@pytest.mark.parametrize(
"time",
[4., 8., 10., 12., 13., 14., 16., 20., 24.],
@ -91,16 +117,16 @@ def test_population_number(full_exposure_model: models.ExposureModel,
[4., 8., 10., 12., 13., 14., 16., 20., 24.],
)
def test_concentration_model_dynamic_population(full_exposure_model: models.ExposureModel,
dynamic_single_exposure_model: models.ExposureModel,
dynamic_infected_single_exposure_model: models.ExposureModel,
time: float):
assert full_exposure_model.concentration(time) == dynamic_single_exposure_model.concentration(time)
assert full_exposure_model.concentration(time) == dynamic_infected_single_exposure_model.concentration(time)
@pytest.mark.parametrize("number_of_infected",[1, 2, 3, 4, 5])
@pytest.mark.parametrize("time",[9., 12.5, 16.])
def test_linearity_with_number_of_infected(full_exposure_model: models.ExposureModel,
dynamic_single_exposure_model: models.ExposureModel,
dynamic_infected_single_exposure_model: models.ExposureModel,
time: float,
number_of_infected: int):
@ -112,8 +138,8 @@ def test_linearity_with_number_of_infected(full_exposure_model: models.ExposureM
}
)
npt.assert_almost_equal(static_multiple_exposure_model.concentration(time), dynamic_single_exposure_model.concentration(time) * number_of_infected)
npt.assert_almost_equal(static_multiple_exposure_model.deposited_exposure(), dynamic_single_exposure_model.deposited_exposure() * number_of_infected)
npt.assert_almost_equal(static_multiple_exposure_model.concentration(time), dynamic_infected_single_exposure_model.concentration(time) * number_of_infected)
npt.assert_almost_equal(static_multiple_exposure_model.deposited_exposure(), dynamic_infected_single_exposure_model.deposited_exposure() * number_of_infected)
@pytest.mark.parametrize(