From bb0bcebde8e9999a3d0468c5a43c31c5203c4e53 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 20 Oct 2023 12:40:06 +0200 Subject: [PATCH] fixed bug on precise activity --- caimira/apps/calculator/model_generator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/caimira/apps/calculator/model_generator.py b/caimira/apps/calculator/model_generator.py index 664eef2b..a5fce869 100644 --- a/caimira/apps/calculator/model_generator.py +++ b/caimira/apps/calculator/model_generator.py @@ -370,10 +370,15 @@ def build_CO2_model(self, sample_size=DEFAULT_MC_SAMPLE_SIZE) -> models.CO2Conce total_people = [infected_population.people_present(stop) + exposed_population.people_present(stop) for _, stop in zip(transition_times[:-1], transition_times[1:])] + if (self.activity_type == 'precise'): + activity_defn, _ = self.generate_precise_activity_expiration() + else: + activity_defn = ACTIVITIES[ACTIVITY_TYPES.index(self.activity_type)]['activity'] + population = mc.SimplePopulation( number=models.IntPiecewiseConstant(transition_times=tuple(transition_times), values=tuple(total_people)), presence=None, - activity=activity_distributions[ACTIVITIES[ACTIVITY_TYPES.index(self.activity_type)]['activity']], + activity=activity_distributions[activity_defn], ) # Builds a CO2 concentration model based on model inputs