add mask dependency

This commit is contained in:
Andrejh 2021-09-08 15:40:07 +02:00
parent eb8feb6ed4
commit 95cfddcdbe
3 changed files with 18 additions and 17 deletions

View file

@ -29,7 +29,7 @@ yann_er = [8396.78166, 45324.55964, 400054.0827]
######### Standard exposure models ###########
######### Breathing model ###########
def breathing_exposure(activity: str):
def breathing_exposure(activity: str, mask: str):
exposure_mc = mc.ExposureModel(
concentration_model=mc.ConcentrationModel(
room=models.Room(volume=100, humidity=0.5),
@ -44,7 +44,7 @@ def breathing_exposure(activity: str):
infectious_dose=50.,
),
presence=mc.SpecificInterval(((0, 2),)),
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
activity=activity_distributions[activity],
expiration=models.Expiration.types['Breathing'],
),
@ -53,13 +53,13 @@ def breathing_exposure(activity: str):
number=14,
presence=mc.SpecificInterval(((0, 2),)),
activity=models.Activity.types[activity],
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
),
)
return exposure_mc
######### Speaking model ###########
def speaking_exposure(activity: str):
def speaking_exposure(activity: str, mask: str):
exposure_mc = mc.ExposureModel(
concentration_model=mc.ConcentrationModel(
room=models.Room(volume=100, humidity=0.5),
@ -74,7 +74,7 @@ def speaking_exposure(activity: str):
infectious_dose=50.,
),
presence=mc.SpecificInterval(((0, 2),)),
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
activity=activity_distributions[activity],
expiration=models.Expiration.types['Talking'],
),
@ -83,13 +83,13 @@ def speaking_exposure(activity: str):
number=14,
presence=mc.SpecificInterval(((0, 2),)),
activity=models.Activity.types[activity],
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
),
)
return exposure_mc
######### Shouting model ###########
def shouting_exposure(activity: str):
def shouting_exposure(activity: str, mask: str):
exposure_mc = mc.ExposureModel(
concentration_model=mc.ConcentrationModel(
room=models.Room(volume=100, humidity=0.5),
@ -104,7 +104,7 @@ def shouting_exposure(activity: str):
infectious_dose=50.,
),
presence=mc.SpecificInterval(((0, 2),)),
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
activity=activity_distributions[activity],
expiration=models.Expiration.types['Shouting'],
),
@ -113,7 +113,7 @@ def shouting_exposure(activity: str):
number=14,
presence=mc.SpecificInterval(((0, 2),)),
activity=models.Activity.types[activity],
mask=models.Mask.types["No mask"],
mask=models.Mask.types[mask],
),
)
return exposure_mc

View file

@ -30,8 +30,9 @@ print('\n<<<<<<<<<<< Vlout for Breathing, seated with chosen Cn,B >>>>>>>>>>>')
print('\n')
############ Plots with viral loads and emission rates + statistical data ############
present_vl_er_histograms(activity='Seated')
present_vl_er_histograms(activity='Light activity')
present_vl_er_histograms(activity='Seated', mask='No mask')
present_vl_er_histograms(activity='Light activity', mask='No mask')
present_vl_er_histograms(activity='Heavy exercise', mask='No mask')
############ CDFs for comparing the QR-Values in different scenarios ############
#generate_cdf_curves()

View file

@ -257,9 +257,9 @@ def exposure_model_from_vl_talking_cn():
############ Statistical Data ############
def get_statistical_data(activity: str):
def get_statistical_data(activity: str, mask: str):
############ Breathing model ############
exposure_mc = breathing_exposure(activity)
exposure_mc = breathing_exposure(activity, mask)
exposure_model = exposure_mc.build_model(size=SAMPLE_SIZE)
emission_rate = exposure_model.concentration_model.infected.emission_rate_when_present(
cn_B=0.06, cn_L=0.2)
@ -268,7 +268,7 @@ def get_statistical_data(activity: str):
print_er_info(emission_rate, breathing_er)
############ Speaking model ############
exposure_mc = speaking_exposure(activity)
exposure_mc = speaking_exposure(activity, mask)
exposure_model = exposure_mc.build_model(size=SAMPLE_SIZE)
emission_rate = exposure_model.concentration_model.infected.emission_rate_when_present(
cn_B=0.06, cn_L=0.2)
@ -277,7 +277,7 @@ def get_statistical_data(activity: str):
print_er_info(emission_rate, speaking_er)
############ Shouting model ############
exposure_mc = shouting_exposure(activity)
exposure_mc = shouting_exposure(activity, mask)
exposure_model = exposure_mc.build_model(size=SAMPLE_SIZE)
emission_rate = exposure_model.concentration_model.infected.emission_rate_when_present(
cn_B=0.06, cn_L=0.2)
@ -290,8 +290,8 @@ def get_statistical_data(activity: str):
return viral_load_in_sputum, breathing_er, speaking_er, shouting_er
def present_vl_er_histograms(activity: str):
viral_load_in_sputum, breathing_er, speaking_er, shouting_er = get_statistical_data(activity)
def present_vl_er_histograms(activity: str, mask: str):
viral_load_in_sputum, breathing_er, speaking_er, shouting_er = get_statistical_data(activity, mask)
fig, axs = plt.subplots(1, 2, sharex=False, sharey=False)
fig.set_figheight(5)