Added method to generate the BLO curve

This commit is contained in:
Luis Aleixo 2022-02-28 11:32:47 +01:00
parent 93a6913c8c
commit e4807b6b2c
2 changed files with 38 additions and 17 deletions

View file

@ -39,25 +39,25 @@ from cara.monte_carlo.data import symptomatic_vl_frequencies
# thickness = [2, 2]) # thickness = [2, 2])
# print('\n<<<<<<<<<<< Peak viral concentration with short range interactions for baseline scenarios >>>>>>>>>>>') # print('\n<<<<<<<<<<< Peak viral concentration with short range interactions for baseline scenarios >>>>>>>>>>>')
concentration_curve(models=[exposure_module_with_short_range( # concentration_curve(models=[exposure_module_with_short_range(
activity='Light activity', # activity='Light activity',
expiration={"Speaking": 1, "Breathing": 2}, # expiration={"Speaking": 1, "Breathing": 2},
mask='No mask', # mask='No mask',
sr_presence=[(10.5, 11.0)], # sr_presence=[(10.5, 11.0)],
sr_activities=['Speaking']), # sr_activities=['Speaking']),
exposure_module_without_short_range( # exposure_module_without_short_range(
activity='Light activity', # activity='Light activity',
expiration={"Speaking": 1, "Breathing": 2}, # expiration={"Speaking": 1, "Breathing": 2},
mask='No mask',) # mask='No mask',)
], # ],
labels = ['Concentration with short range interactions', 'Background (long-range) concentration'], # labels = ['Concentration with short range interactions', 'Background (long-range) concentration'],
labelsDose = ['Dose (full)', 'Dose (long-range)'], # labelsDose = ['Dose (full)', 'Dose (long-range)'],
colors = ['salmon', 'royalblue'], # colors = ['salmon', 'royalblue'],
linestyles = ['-', '--'], # linestyles = ['-', '--'],
thickness = [2, 2]) # thickness = [2, 2])
print('\n<<<<<<<<<<< Dose vs SR exposure time >>>>>>>>>>>') # print('\n<<<<<<<<<<< Dose vs SR exposure time >>>>>>>>>>>')
#Always assume 1h for the short range interactions. #Always assume 1h for the short range interactions.
#Always assume that in each model there is only ONE short range interaction. #Always assume that in each model there is only ONE short range interaction.
# plot_vD_vs_exposure_time(exp_models = [ # plot_vD_vs_exposure_time(exp_models = [
@ -80,3 +80,6 @@ print('\n<<<<<<<<<<< Dose vs SR exposure time >>>>>>>>>>>')
# time_in_minutes=True, # time_in_minutes=True,
# normalize_y_axis=True) # normalize_y_axis=True)
print('\n<<<<<<<<<<< BLO curve >>>>>>>>>>>')
generate_BLO_curve(activity='Speaking')

View file

@ -223,3 +223,21 @@ def plot_vD_vs_exposure_time(exp_models: typing.List[mc.ExposureModel], labels,
plt.ylabel('Mean cumulative dose\n(infectious virus)', fontsize=12) plt.ylabel('Mean cumulative dose\n(infectious virus)', fontsize=12)
plt.legend() plt.legend()
plt.show() plt.show()
def generate_BLO_curve(activity):
diameters = short_range_expiration_distributions[activity].diameter
BLOcurve = BLOmodel(expiration_BLO_factors[activity]).distribution(diameters
)/BLOmodel(expiration_BLO_factors[activity]).integrate(0.1,100)
# you have to divide by the integral to get the normalized distribution,
# so that you can compare with the normalized histogram
plt.xscale('log')
plt.yscale('log')
plt.plot(diameters,BLOcurve,'.',ms=5)
plt.hist(diameters,bins=100,range=(0,100),density=True)
plt.title(activity)
plt.xlabel("diameters (microns)")
plt.ylabel("Normalized distribution and histogram")
plt.show()