create present_qR_values

This commit is contained in:
Andrejh 2021-03-19 11:31:54 +01:00
parent 418305d50a
commit 9f6e500618
2 changed files with 40 additions and 1 deletions

View file

@ -1,3 +1,31 @@
from cara import models
from cara.montecarlo import *
######### Standard exposure models ###########
exposure_models = [MCExposureModel(
concentration_model=MCConcentrationModel(
room=models.Room(volume=45),
ventilation=models.SlidingWindow(
active=models.PeriodicInterval(period=120, duration=120),
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
outside_temp=models.PiecewiseConstant((0, 24), (283,)),
window_height=1.6, opening_length=0.2,
),
infected=MCInfectedPopulation(
number=1,
presence=models.SpecificInterval(((0, 4), (5, 9))),
masked=False,
virus=MCVirus(halflife=1.1, qID=100),
expiratory_activity=a,
samples=2000000,
breathing_category=3,
expiratory_activity_weights=(0.7, 0.3, 0)
)
),
exposed=models.Population(
number=2,
presence=models.SpecificInterval(((0, 4), (5, 9))),
activity=models.Activity.types['Seated'],
mask=models.Mask.types['Type I']
)
) for a in (1, 2, 3)]

View file

@ -426,11 +426,22 @@ def print_qr_info(log_qr: np.ndarray) -> None:
print(f"MEAN of log_10(qR) = {np.mean(log_qr)}\n"
f"SD of log_10(qR) = {np.std(log_qr)}\n"
f"MEAN of qR = {np.mean(qr_values)}\n"
f"SD of qR = {np.std(qr_values)}\n")
f"SD of qR = {np.std(qr_values)}\n"
f"Median of qR = {np.quantile(qr_values, 0.5)}\n")
for quantile in (0.01, 0.05, 0.25, 0.50, 0.75, 0.95, 0.99):
print(f"qR_{quantile} = {np.quantile(qr_values, quantile)}")
def present_qR_values(model: MCConcentrationModel) -> None:
"""
Displays a handful of key parameters and results of qR from a given MCConcentrationModel
:param model: The MCConcentrationModel representing the scenario to be presented
:return: Nothing, parameters are printed
"""
qRs = (np.log10(model.infected.emission_rate_when_present()))
print_qr_info(np.asarray(qRs))
def present_model(model: MCConcentrationModel, bins: int = 200,
title: str = 'Summary of $qR$ model parameters') -> None: