modified file name and references. removed unused variables
This commit is contained in:
parent
1171e51f90
commit
0cb6477cb2
3 changed files with 52 additions and 31 deletions
|
|
@ -79,33 +79,55 @@ DEFAULTS = {
|
|||
# ------------------ Activities ----------------------
|
||||
|
||||
ACTIVITIES: typing.List[typing.Dict[str, typing.Any]] = [
|
||||
{'name': 'office', 'activity': 'Seated', 'expiration': {'Speaking': 1, 'Breathing': 2}}, # Mostly silent in the office, but 1/3rd of time speaking.
|
||||
{'name': 'smallmeeting', 'activity': 'Seated', 'expiration': {'Speaking': 1, 'Breathing': None}},
|
||||
{'name': 'largemeeting', 'activity': 'Standing', 'expiration': {'Speaking': 1, 'Breathing': 2}}, # Each infected person spends 1/3 of time speaking.
|
||||
# Mostly silent in the office, but 1/3rd of time speaking.
|
||||
{'name': 'office', 'activity': 'Seated',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 2}},
|
||||
{'name': 'smallmeeting', 'activity': 'Seated',
|
||||
'expiration': {'Speaking': 1, 'Breathing': None}},
|
||||
# Each infected person spends 1/3 of time speaking.
|
||||
{'name': 'largemeeting', 'activity': 'Standing',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 2}},
|
||||
{'name': 'callcentre', 'activity': 'Seated', 'expiration': 'Speaking'},
|
||||
{'name': 'controlroom-day', 'activity': 'Seated', 'expiration': {'Speaking': 1, 'Breathing': 1}}, # Daytime control room shift, 50% speaking.
|
||||
{'name': 'controlroom-night', 'activity': 'Seated', 'expiration': {'Speaking': 1, 'Breathing': 9}}, # Nightshift control room, 10% speaking.
|
||||
# Daytime control room shift, 50% speaking.
|
||||
{'name': 'controlroom-day', 'activity': 'Seated',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 1}},
|
||||
# Nightshift control room, 10% speaking.
|
||||
{'name': 'controlroom-night', 'activity': 'Seated',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 9}},
|
||||
{'name': 'library', 'activity': 'Seated', 'expiration': 'Breathing'},
|
||||
{'name': 'lab', 'activity': 'Light activity', 'expiration': {'Speaking': 1, 'Breathing': 1}}, # Model 1/2 of time spent speaking in a lab.
|
||||
{'name': 'workshop', 'activity': 'Moderate activity', 'expiration': {'Speaking': 1, 'Breathing': 1}}, # Model 1/2 of time spent speaking in a workshop.
|
||||
# Model 1/2 of time spent speaking in a lab.
|
||||
{'name': 'lab', 'activity': 'Light activity',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 1}},
|
||||
# Model 1/2 of time spent speaking in a workshop.
|
||||
{'name': 'workshop', 'activity': 'Moderate activity',
|
||||
'expiration': {'Speaking': 1, 'Breathing': 1}},
|
||||
{'name': 'training', 'activity': 'Standing', 'expiration': 'Speaking'},
|
||||
{'name': 'training_attendee', 'activity': 'Seated', 'expiration': 'Breathing'},
|
||||
{'name': 'gym', 'activity': 'Heavy exercise', 'expiration': 'Breathing'},
|
||||
{'name': 'household-day', 'activity': 'Light activity', 'expiration': {'Breathing': 5, 'Speaking': 5}},
|
||||
{'name': 'household-night', 'activity': 'Seated', 'expiration': {'Breathing': 7, 'Speaking': 3}},
|
||||
{'name': 'primary-school', 'activity': 'Light activity', 'expiration': {'Breathing': 5, 'Speaking': 5}},
|
||||
{'name': 'secondary-school', 'activity': 'Light activity', 'expiration': {'Breathing': 7, 'Speaking': 3}},
|
||||
{'name': 'university', 'activity': 'Seated', 'expiration': {'Breathing': 9, 'Speaking': 1}},
|
||||
{'name': 'restaurant', 'activity': 'Seated', 'expiration': {'Breathing': 1, 'Speaking': 9}},
|
||||
{'name': 'household-day', 'activity': 'Light activity',
|
||||
'expiration': {'Breathing': 5, 'Speaking': 5}},
|
||||
{'name': 'household-night', 'activity': 'Seated',
|
||||
'expiration': {'Breathing': 7, 'Speaking': 3}},
|
||||
{'name': 'primary-school', 'activity': 'Light activity',
|
||||
'expiration': {'Breathing': 5, 'Speaking': 5}},
|
||||
{'name': 'secondary-school', 'activity': 'Light activity',
|
||||
'expiration': {'Breathing': 7, 'Speaking': 3}},
|
||||
{'name': 'university', 'activity': 'Seated',
|
||||
'expiration': {'Breathing': 9, 'Speaking': 1}},
|
||||
{'name': 'restaurant', 'activity': 'Seated',
|
||||
'expiration': {'Breathing': 1, 'Speaking': 9}},
|
||||
{'name': 'precise', 'activity': None, 'expiration': None},
|
||||
]
|
||||
|
||||
# ------------------ Validation ----------------------
|
||||
|
||||
ACTIVITY_TYPES = [ activity['name'] for activity in ACTIVITIES ]
|
||||
COFFEE_OPTIONS_INT = {'coffee_break_0': 0, 'coffee_break_1': 1, 'coffee_break_2': 2, 'coffee_break_4': 4}
|
||||
CONFIDENCE_LEVEL_OPTIONS = {'confidence_low': 10, 'confidence_medium': 5, 'confidence_high': 2}
|
||||
MECHANICAL_VENTILATION_TYPES = {'mech_type_air_changes', 'mech_type_air_supply', 'not-applicable'}
|
||||
ACTIVITY_TYPES = [activity['name'] for activity in ACTIVITIES]
|
||||
COFFEE_OPTIONS_INT = {'coffee_break_0': 0, 'coffee_break_1': 1,
|
||||
'coffee_break_2': 2, 'coffee_break_4': 4}
|
||||
CONFIDENCE_LEVEL_OPTIONS = {'confidence_low': 10,
|
||||
'confidence_medium': 5, 'confidence_high': 2}
|
||||
MECHANICAL_VENTILATION_TYPES = {
|
||||
'mech_type_air_changes', 'mech_type_air_supply', 'not-applicable'}
|
||||
MASK_TYPES = {'Type I', 'FFP2', 'Cloth'}
|
||||
MASK_WEARING_OPTIONS = {'mask_on', 'mask_off'}
|
||||
MONTH_NAMES = [
|
||||
|
|
@ -113,13 +135,16 @@ MONTH_NAMES = [
|
|||
'August', 'September', 'October', 'November', 'December',
|
||||
]
|
||||
VACCINE_BOOSTER_TYPE = ['AZD1222_(AstraZeneca)', 'Ad26.COV2.S_(Janssen)', 'BNT162b2_(Pfizer)', 'BNT162b2_(Pfizer)_(4th_dose)', 'BNT162b2_(Pfizer)_and_mRNA-1273_(Moderna)',
|
||||
'BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)', 'BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)_(4th_dose)', 'CoronaVac_(Sinovac)', 'Coronavac_(Sinovac)', 'Sinopharm',
|
||||
'mRNA-1273_(Moderna)', 'mRNA-1273_(Moderna)_(4th_dose)', 'Other']
|
||||
'BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)', 'BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)_(4th_dose)', 'CoronaVac_(Sinovac)', 'Coronavac_(Sinovac)', 'Sinopharm',
|
||||
'mRNA-1273_(Moderna)', 'mRNA-1273_(Moderna)_(4th_dose)', 'Other']
|
||||
VACCINE_TYPE = ['Ad26.COV2.S_(Janssen)', 'Any_mRNA_-_heterologous', 'AZD1222_(AstraZeneca)', 'AZD1222_(AstraZeneca)_and_any_mRNA_-_heterologous', 'AZD1222_(AstraZeneca)_and_BNT162b2_(Pfizer)',
|
||||
'BBIBP-CorV_(Beijing_CNBG)', 'BNT162b2_(Pfizer)', 'BNT162b2_(Pfizer)_and_mRNA-1273_(Moderna)', 'CoronaVac_(Sinovac)', 'CoronaVac_(Sinovac)_and_AZD1222_(AstraZeneca)', 'Covishield',
|
||||
'mRNA-1273_(Moderna)', 'Sputnik_V_(Gamaleya)', 'CoronaVac_(Sinovac)_and_BNT162b2_(Pfizer)']
|
||||
VENTILATION_TYPES = {'natural_ventilation', 'mechanical_ventilation', 'no_ventilation'}
|
||||
VIRUS_TYPES = {'SARS_CoV_2', 'SARS_CoV_2_ALPHA', 'SARS_CoV_2_BETA','SARS_CoV_2_GAMMA', 'SARS_CoV_2_DELTA', 'SARS_CoV_2_OMICRON'}
|
||||
'BBIBP-CorV_(Beijing_CNBG)', 'BNT162b2_(Pfizer)', 'BNT162b2_(Pfizer)_and_mRNA-1273_(Moderna)', 'CoronaVac_(Sinovac)', 'CoronaVac_(Sinovac)_and_AZD1222_(AstraZeneca)', 'Covishield',
|
||||
'mRNA-1273_(Moderna)', 'Sputnik_V_(Gamaleya)', 'CoronaVac_(Sinovac)_and_BNT162b2_(Pfizer)']
|
||||
VENTILATION_TYPES = {'natural_ventilation',
|
||||
'mechanical_ventilation', 'no_ventilation'}
|
||||
VIRUS_TYPES = {'SARS_CoV_2', 'SARS_CoV_2_ALPHA', 'SARS_CoV_2_BETA',
|
||||
'SARS_CoV_2_GAMMA', 'SARS_CoV_2_DELTA', 'SARS_CoV_2_OMICRON'}
|
||||
VOLUME_TYPES = {'room_volume_explicit', 'room_volume_from_dimensions'}
|
||||
WINDOWS_OPENING_REGIMES = {'windows_open_permanently', 'windows_open_periodically', 'not-applicable'}
|
||||
WINDOWS_OPENING_REGIMES = {'windows_open_permanently',
|
||||
'windows_open_periodically', 'not-applicable'}
|
||||
WINDOWS_TYPES = {'window_sliding', 'window_hinged', 'not-applicable'}
|
||||
|
|
@ -16,7 +16,9 @@ import caimira.monte_carlo as mc
|
|||
from .. import calculator
|
||||
from caimira.monte_carlo.data import activity_distributions, virus_distributions, mask_distributions, short_range_distances
|
||||
from caimira.monte_carlo.data import expiration_distribution, expiration_BLO_factors, expiration_distributions, short_range_expiration_distributions
|
||||
from .DEFAULT_DATA import *
|
||||
from .defaults import (NO_DEFAULT, DEFAULT_MC_SAMPLE_SIZE, DEFAULTS, ACTIVITIES, ACTIVITY_TYPES, COFFEE_OPTIONS_INT, CONFIDENCE_LEVEL_OPTIONS,
|
||||
MECHANICAL_VENTILATION_TYPES, MASK_TYPES, MASK_WEARING_OPTIONS, MONTH_NAMES, VACCINE_BOOSTER_TYPE, VACCINE_TYPE,
|
||||
VENTILATION_TYPES, VIRUS_TYPES, VOLUME_TYPES, WINDOWS_OPENING_REGIMES, WINDOWS_TYPES)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing
|
|||
for time in times
|
||||
]
|
||||
lower_concentrations = concentrations_with_sr_breathing(form, model, times, short_range_intervals)
|
||||
highest_const = max(concentrations)
|
||||
|
||||
cumulative_doses = np.cumsum([
|
||||
np.array(model.deposited_exposure_between_bounds(float(time1), float(time2))).mean()
|
||||
|
|
@ -137,8 +136,6 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing
|
|||
prob = np.array(model.infection_probability())
|
||||
prob_dist_count, prob_dist_bins = np.histogram(prob/100, bins=100, density=True)
|
||||
prob_probabilistic_exposure = np.array(model.total_probability_rule()).mean()
|
||||
er = np.array(model.concentration_model.infected.emission_rate_per_person_when_present()).mean()
|
||||
exposed_occupants = model.exposed.number
|
||||
expected_new_cases = np.array(model.expected_new_cases()).mean()
|
||||
uncertainties_plot_src = img2base64(_figure2bytes(uncertainties_plot(model))) if form.conditional_probability_plot else None
|
||||
exposed_presence_intervals = [list(interval) for interval in model.exposed.presence_interval().boundaries()]
|
||||
|
|
@ -151,7 +148,6 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing
|
|||
"short_range_expirations": short_range_expirations,
|
||||
"concentrations": concentrations,
|
||||
"concentrations_zoomed": lower_concentrations,
|
||||
"highest_const": highest_const,
|
||||
"cumulative_doses": list(cumulative_doses),
|
||||
"long_range_cumulative_doses": list(long_range_cumulative_doses),
|
||||
"prob_inf": prob.mean(),
|
||||
|
|
@ -160,8 +156,6 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing
|
|||
"prob_hist_count": list(prob_dist_count),
|
||||
"prob_hist_bins": list(prob_dist_bins),
|
||||
"prob_probabilistic_exposure": prob_probabilistic_exposure,
|
||||
"emission_rate_per_person": er,
|
||||
"exposed_occupants": exposed_occupants,
|
||||
"expected_new_cases": expected_new_cases,
|
||||
"uncertainties_plot_src": uncertainties_plot_src,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue