Skip to content

Commit

Permalink
fixed mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdossan committed Jan 24, 2023
1 parent d117eb4 commit 2b47529
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions caimira/apps/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def update_plot(self, model: models.CO2ConcentrationModel):
figure_legends = [mlines.Line2D([], [], color='#3530fe', markersize=15, label='CO₂ concentration'),
patches.Patch(edgecolor="#96cbff", facecolor='#96cbff', label='Presence of person(s)')]
self.ax.legend(handles=figure_legends)
if 1500 < max(concentration):
self.ax.set_ylim(top=max(concentration)*1.1)
if 1500 < concentration_top:
self.ax.set_ylim(top=concentration_top*1.1)
else:
self.ax.set_ylim(top=1550)
self.ax.hlines([800, 1500], xmin=min(model.CO2_emitters.presence.boundaries()[0])*0.95, xmax=max(model.CO2_emitters.presence.boundaries()[1])*1.05, colors=['limegreen', 'salmon'], linestyles='dashed')
Expand All @@ -139,7 +139,7 @@ def __init__(self) -> None:

#: A list of scenario name and ModelState instances. This is intended to be
#: mutated. Any mutation should notify the appropriate Views for handling.
self._model_scenarios = []
self._model_scenarios: typing.List[ScenarioType] = []
self._active_scenario = 0
self.multi_model_view = MultiModelView(self)
# self.comparison_view = ExposureComparissonResult()
Expand Down
9 changes: 5 additions & 4 deletions caimira/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,11 +1008,12 @@ def _normed_concentration_limit(self, time: float) -> _VectorisedFloat:
if not self.population.person_present(time):
return self.min_background_concentration()/self.normalization_factor()
V = self.room.volume
# RR = self.removal_rate(time) if self.removal_rate(time) != 0 else 0.25
RR = self.removal_rate(time)

return (1. / (RR * V) + self.min_background_concentration()/
try:
return (1. / (RR * V) + self.min_background_concentration()/
self.normalization_factor())
except ZeroDivisionError:
return 0

@method_cache
def state_change_times(self) -> typing.List[float]:
Expand Down Expand Up @@ -1206,7 +1207,7 @@ def population(self) -> Population:
return self.CO2_emitters

def removal_rate(self, time: float) -> _VectorisedFloat:
return self.ventilation.air_exchange(self.room, time) + 0.25
return self.ventilation.air_exchange(self.room, time)

def min_background_concentration(self) -> _VectorisedFloat:
"""
Expand Down

0 comments on commit 2b47529

Please sign in to comment.