added additional validation for mypy
This commit is contained in:
parent
ec5634d468
commit
c1c95c5c69
4 changed files with 15 additions and 16 deletions
|
|
@ -180,7 +180,7 @@ class ExposureModelResult(View):
|
|||
self.ax2.ignore_existing_data_limits = False
|
||||
self.cumulative_line.set_data(ts[:-1], cumulative_doses)
|
||||
|
||||
concentration_top = max(concentration)
|
||||
concentration_top = max(np.array(concentration))
|
||||
self.ax.set_ylim(bottom=0., top=concentration_top)
|
||||
cumulative_top = max(cumulative_doses)
|
||||
self.ax2.set_ylim(bottom=0., top=cumulative_top)
|
||||
|
|
@ -268,7 +268,7 @@ class ExposureComparissonResult(View):
|
|||
for label, cumulative_dose, color in zip(labels, cumulative_doses, colors):
|
||||
self.ax2.plot(ts[:-1], cumulative_dose, label=label, color=color, linestyle="dotted")
|
||||
|
||||
concentration_top = max([max(concentration) for concentration in concentrations])
|
||||
concentration_top = max([max(np.array(concentration)) for concentration in concentrations])
|
||||
self.ax.set_ylim(bottom=0., top=concentration_top)
|
||||
cumulative_top = max([max(cumulative_dose) for cumulative_dose in cumulative_doses])
|
||||
self.ax2.set_ylim(bottom=0., top=cumulative_top)
|
||||
|
|
|
|||
|
|
@ -588,10 +588,9 @@ class Particle:
|
|||
due to instantaneous evaporation of the particle in the air.
|
||||
"""
|
||||
if self.diameter is None:
|
||||
vg = 1.88e-4
|
||||
return 1.88e-4
|
||||
else:
|
||||
vg = 1.88e-4 * (self.diameter*evaporation_factor / 2.5)**2
|
||||
return vg
|
||||
return 1.88e-4 * (self.diameter*evaporation_factor / 2.5)**2
|
||||
|
||||
def fraction_deposited(self, evaporation_factor: float=0.3) -> _VectorisedFloat:
|
||||
"""
|
||||
|
|
@ -1164,8 +1163,8 @@ class ShortRangeModel:
|
|||
# The set of points where we want the interpolated values are the short-range particle diameters (given the current expiration);
|
||||
# The set of points with a known value are the long-range particle diameters (given the initial expiration);
|
||||
# The set of known values are the long-range concentration values normalized by the viral load.
|
||||
long_range_normed_concentration_interpolated=np.interp(self.expiration.particle.diameter,
|
||||
concentration_model.infected.particle.diameter, long_range_normed_concentration)
|
||||
long_range_normed_concentration_interpolated=np.interp(np.array(self.expiration.particle.diameter),
|
||||
np.array(concentration_model.infected.particle.diameter), long_range_normed_concentration)
|
||||
|
||||
# Short-range concentration formula. The long-range concentration is added in the concentration method (ExposureModel).
|
||||
# based on continuum model proposed by Jia et al (2022) - https://doi.org/10.1016/j.buildenv.2022.109166
|
||||
|
|
@ -1245,8 +1244,8 @@ class ShortRangeModel:
|
|||
/concentration_model.infected.activity.exhalation_rate
|
||||
)
|
||||
normed_int_concentration_interpolated = np.interp(
|
||||
self.expiration.particle.diameter,
|
||||
concentration_model.infected.particle.diameter,
|
||||
np.array(self.expiration.particle.diameter),
|
||||
np.array(concentration_model.infected.particle.diameter),
|
||||
normed_int_concentration
|
||||
)
|
||||
return normed_int_concentration_interpolated
|
||||
|
|
@ -1357,7 +1356,7 @@ class ExposureModel:
|
|||
Then, the deposited exposure given the long-range interactions is added to the
|
||||
initial deposited exposure.
|
||||
"""
|
||||
deposited_exposure = 0.
|
||||
deposited_exposure: _VectorisedFloat = 0.
|
||||
for interaction in self.short_range:
|
||||
start, stop = interaction.extract_between_bounds(time1, time2)
|
||||
short_range_jet_exposure = interaction._normed_jet_exposure_between_bounds(
|
||||
|
|
@ -1407,7 +1406,7 @@ class ExposureModel:
|
|||
"""
|
||||
The number of virus per m^3 deposited on the respiratory tract.
|
||||
"""
|
||||
deposited_exposure = 0.0
|
||||
deposited_exposure: _VectorisedFloat = 0.0
|
||||
|
||||
for start, stop in self.exposed.presence.boundaries():
|
||||
deposited_exposure += self.deposited_exposure_between_bounds(start, stop)
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ def test_ventilation_mechanical(baseline_form: model_generator.FormData):
|
|||
baseline_form.air_supply = 500.
|
||||
|
||||
ts = np.linspace(8, 16, 100)
|
||||
np.testing.assert_allclose([mech.air_exchange(room, t)+0.25 for t in ts],
|
||||
[baseline_form.ventilation().air_exchange(room, t) for t in ts])
|
||||
np.testing.assert_allclose(np.array([mech.air_exchange(room, t)+0.25 for t in ts]),
|
||||
np.array([baseline_form.ventilation().air_exchange(room, t) for t in ts]))
|
||||
|
||||
|
||||
def test_ventilation_airchanges(baseline_form: model_generator.FormData):
|
||||
|
|
@ -129,8 +129,8 @@ def test_ventilation_airchanges(baseline_form: model_generator.FormData):
|
|||
baseline_form.air_changes = 3.
|
||||
|
||||
ts = np.linspace(8, 16, 100)
|
||||
np.testing.assert_allclose([airchange.air_exchange(room, t)+0.25 for t in ts],
|
||||
[baseline_form.ventilation().air_exchange(room, t) for t in ts])
|
||||
np.testing.assert_allclose(np.array([airchange.air_exchange(room, t)+0.25 for t in ts]),
|
||||
np.array([baseline_form.ventilation().air_exchange(room, t) for t in ts]))
|
||||
|
||||
|
||||
def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -27,7 +27,7 @@ REQUIREMENTS: dict = {
|
|||
'matplotlib',
|
||||
'memoization',
|
||||
'mistune',
|
||||
'numpy != 1.23, !=1.23.1, != 1.23.2',
|
||||
'numpy',
|
||||
'psutil',
|
||||
'python-dateutil',
|
||||
'retry',
|
||||
|
|
|
|||
Loading…
Reference in a new issue