Reverting to a refinement factor of 4 in the time-dependence of Geneva temperature; optimizing the caching; decreasing the timeout value in tests
This commit is contained in:
parent
56ecf150a2
commit
17956d766d
5 changed files with 8 additions and 8 deletions
|
|
@ -38,7 +38,7 @@ GenevaTemperatures_hourly = {
|
|||
}
|
||||
# same temperatures on a finer temperature mesh
|
||||
GenevaTemperatures = {
|
||||
month: GenevaTemperatures_hourly[month].refine(refine_factor=10)
|
||||
month: GenevaTemperatures_hourly[month].refine(refine_factor=4)
|
||||
for month,temperatures in Geneva_hourly_temperatures_celsius_per_hour.items()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -711,7 +711,6 @@ class InfectedPopulation(Population):
|
|||
|
||||
return self.emission_rate_when_present()
|
||||
|
||||
@cached()
|
||||
def emission_rate(self, time) -> _VectorisedFloat:
|
||||
"""
|
||||
The emission rate of the entire population.
|
||||
|
|
@ -741,7 +740,6 @@ class ConcentrationModel:
|
|||
return k + self.virus.decay_constant(self.room.humidity
|
||||
) + self.ventilation.air_exchange(self.room, time)
|
||||
|
||||
@cached()
|
||||
def _concentration_limit(self, time: float) -> _VectorisedFloat:
|
||||
"""
|
||||
Provides a constant that represents the theoretical asymptotic
|
||||
|
|
@ -753,7 +751,6 @@ class ConcentrationModel:
|
|||
|
||||
return (self.infected.emission_rate(time)) / (IVRR * V)
|
||||
|
||||
@cached()
|
||||
def state_change_times(self):
|
||||
"""
|
||||
All time dependent entities on this model must provide information about
|
||||
|
|
@ -798,6 +795,9 @@ class ConcentrationModel:
|
|||
return (self.last_state_change(stop) <= start)
|
||||
|
||||
@cached()
|
||||
def _concentration_at_state_change(self, time: float) -> _VectorisedFloat:
|
||||
return self.concentration(time)
|
||||
|
||||
def concentration(self, time: float) -> _VectorisedFloat:
|
||||
"""
|
||||
Virus quanta concentration, as a function of time.
|
||||
|
|
@ -816,7 +816,7 @@ class ConcentrationModel:
|
|||
concentration_limit = self._concentration_limit(next_state_change_time)
|
||||
|
||||
t_last_state_change = self.last_state_change(time)
|
||||
concentration_at_last_state_change = self.concentration(t_last_state_change)
|
||||
concentration_at_last_state_change = self._concentration_at_state_change(t_last_state_change)
|
||||
|
||||
delta_time = time - t_last_state_change
|
||||
fac = np.exp(-IVRR * delta_time)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def test_generate_report(baseline_form):
|
|||
# generate a report for it. Because this is what happens in the cara
|
||||
# calculator, we confirm that the generation happens within a reasonable
|
||||
# time threshold.
|
||||
time_limit: float = 30.0 # seconds
|
||||
time_limit: float = 20.0 # seconds
|
||||
|
||||
start = time.perf_counter()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import tornado.testing
|
|||
import cara.apps.calculator
|
||||
from cara.apps.calculator.report_generator import generate_qr_code
|
||||
|
||||
_TIMEOUT = 30.
|
||||
_TIMEOUT = 20.
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
|
|
|
|||
|
|
@ -394,4 +394,4 @@ def test_quanta_hourly_dep_refined(month,expected_quanta):
|
|||
)
|
||||
)
|
||||
quanta = m.quanta_exposure()
|
||||
npt.assert_allclose(quanta, expected_quanta, rtol=0.01)
|
||||
npt.assert_allclose(quanta, expected_quanta, rtol=0.02)
|
||||
|
|
|
|||
Loading…
Reference in a new issue