Example #1
0
POLICY_PARAMS = [3.5096096195, -0.80157278249, 0.23164372] # [5,-1,0.25] # [5.0096096195,-1.0157278249,0.0033164372]
WTPS = np.linspace(0.5e5, 1.5e5, 9)  # [min, max, number of points]
SCALE = (WTPS[0] + WTPS[-1])/2


WTP_DELTA = (WTPS[-1] - WTPS[0])/2
R_EFF_MIN_DELTA = [0, 1]
MAX_R_OFF = 4.01
MAX_R_ON = 2.01

# ------------------

# change the current working directory
os.chdir('../..')

policy = P.PolicyRt(policy_params=POLICY_PARAMS, scale=SCALE, wtps=WTPS)
policy.write_to_csv(file_name='Policies.csv',
                    directory='covid19/csv_files')

fig, axes = plt.subplots(1, 2, figsize=(7.2, 3.5))

# policy when off
policy.add_policy_figure_when_relaxed(ax=axes[0], max_r=MAX_R_OFF, delta_wtp=WTP_DELTA)

# policy when on
policy.add_policy_figure_when_tightened(ax=axes[1], max_r=MAX_R_ON, delta_wtp=WTP_DELTA)

fig.tight_layout()
fig.savefig('covid19/figures/Policy.png', dpi=300, bbox_inches='tight')
fig.show()
Example #2
0
import numpy as np
import matplotlib.pyplot as plt
import covid19.PolicyClasses as P
import os

# ---- settings ----
POLICY_PARAMS = [7, -1, 7, -1]# not bad: [7, -1, 7, -1]
# good option: [3.5, -0.5, 0.25, 500, -0.5, 0.5] for WTPS = np.linspace(1e5, 3e5, 9)
WTPS = np.linspace(0.25, 1.25, 9)  # [min, max, number of points]

# change the current working directory
os.chdir('../..')

policy = P.PolicyExponential(policy_params=POLICY_PARAMS, wtps=WTPS)
policy.write_to_csv(file_name='ThresholdsI.csv',
                    directory='covid19/csv_files')
import numpy as np
import matplotlib.pyplot as plt
import covid19.PolicyClasses as P
import os

# ---- settings ----
POLICY_PARAMS = [2.06, -0.37, 0.21, 7.96, -1.28, 0.49]#
# good option: [3.5, -0.5, 0.25, 500, -0.5, 0.5] for WTPS = np.linspace(1e5, 3e5, 9)
WTPS = np.linspace(1e5, 3e5, 9)  # [min, max, number of points]

# change the current working directory
os.chdir('../..')

policy = P.PolicyRtI(policy_params=POLICY_PARAMS, wtps=WTPS)
policy.write_to_csv(file_name='ThresholdsRtI.csv',
                    directory='covid19/csv_files')
Example #4
0
IF_WITH_OUTCOMES = True
WTP_RANGE = [0.01, 0.1101]
WTP_DELTA = 0.05
SHOW_DATA = False
MAX_VALUE = 125
# Y_LABEL = 'Estimated\nprevalence of infection '\
#           + r'$(I_t)$'+'\nper 100,000 population'
Y_LABEL = 'Number of COVID-19 patients\nin or waiting for ICU\n(per 100,000 population)'

# change the current working directory
os.chdir('../..')

policy = P.PolicySingleFeature(
    csv_file_name='covid19/csv_files/OptimizedThresholdsI.csv',
    wtp_range=WTP_RANGE,
    csv_file_name_proj_thresholds='covid19/csv_files/ProjOptimalThresholdsI.csv'
)

if not IF_WITH_OUTCOMES:
    fig, axes = plt.subplots(1, 2, figsize=(7.2, 3.5))

    # policy when off
    policy.add_policy_figure_when_relaxed(ax=axes[0],
                                          y_label=Y_LABEL,
                                          max_feature_value=MAX_VALUE,
                                          wtp_range=WTP_RANGE,
                                          wtp_delta=WTP_DELTA,
                                          show_data=SHOW_DATA)
    policy.add_policy_figure_when_tightened(ax=axes[1],
                                            max_feature_value=MAX_VALUE,