<jupyter_start><jupyter_text>Run pre-reopen and post-reopen simulations<jupyter_code>dfs_pre_reopen = run_multiple_trajectories(pre_reopen_params, ntrajectories=100, time_horizon=150)
dfs_reopen = run_multiple_trajectories(reopen_params, ntrajectories=100, time_horizon=150)<jupyter_output><empty_output><jupyter_text>Plot pre-reopen simulation results<jupyter_code>plot_aip_vs_t(dfs_pre_reopen, figsize=(15,6))
plot_cip_vs_t(dfs_pre_reopen, figsize=(15,6), color='green')<jupyter_output><empty_output><jupyter_text>Plot post-reopen simulation results<jupyter_code>plot_aip_vs_t(dfs_reopen, figsize=(15,6))
plot_cip_vs_t(dfs_reopen, figsize=(15,6), color='green')<jupyter_output><empty_output><jupyter_text>How does the distribution of cumulative infections change from pre-reopen to post-reopen?<jupyter_code>cip_pre_reopen = extract_cips(dfs_pre_reopen)
cip_post_reopen = extract_cips(dfs_reopen)
import matplotlib.pyplot as plt
plt.figure(figsize=(10,8))
plt.hist([100 * min(x, 0.1) for x in cip_pre_reopen], normed=True, alpha=0.5, label="Pre-Reopen")
plt.hist([100 * min(x, 0.1) for x in cip_post_reopen], normed=True, alpha=0.5, label="Post-Reopen")
plt.legend(loc='best')
plt.xlabel("Percent of Population Infected After 150 Days")
plt.show()<jupyter_output><empty_output><jupyter_text>Run sims to understand sensitivity of 'contact_tracing_constant'<jupyter_code>ctc_range = [0.1 * x for x in range(11)]
dfs_ctc_pre_reopen = run_sensitivity_sims(pre_reopen_params, param_to_vary='contact_tracing_constant',
                                     param_values = ctc_range, trajectories_per_config=50, time_horizon=100)
dfs_ctc_post_reopen = run_sensitivity_sims(reopen_params, param_to_vary='contact_tracing_constant',
                                     param_values = ctc_range, trajectories_per_config=50, time_horizon=100)
def plot_many_dfs_threshold(dfs_dict, threshold=0.1, xlabel="", title="", figsize=(10,6)):
    plt.figure(figsize=figsize)
    for df_label, dfs_varied in dfs_dict.items():
        p_thresholds = []
        xs = sorted(list(dfs_varied.keys()))
        for x in xs:
            cips = extract_cips(dfs_varied[x])
            cip_exceed_thresh = [cip for cip in cips if cip >= threshold]
            p_thresholds.append(len(cip_exceed_thresh) / len(cips) * 100)
        plt.plot(xs, p_thresholds, marker='o', label=df_label)
    plt.xlabel(xlabel)
    plt.ylabel("Probability(greater than {:.1f}% infected)".format(threshold * 100))
    plt.title(title)
    plt.legend(loc='best')
    plt.show()

title = """Outbreak Likelihood vs. Contact Tracing Effectiveness"""
plot_many_dfs_threshold({'Pre-Reopen (Population-size 1500, Contacts/day 7.5)': dfs_ctc_pre_reopen, 
                         'Post-Reopen (Population-size 2500, Contacts/day 10)': dfs_ctc_post_reopen}, 
                        xlabel="Contact Tracing Effectiveness",
                       title=title)<jupyter_output><empty_output><jupyter_text>Run sensitivity sims to understand effect of contacts per day<jupyter_code>reopen_params['perform_contact_tracing']
reopen_params['contact_tracing_constant']
contacts_per_day_range = list(range(5,16))

dfs_cpd = run_sensitivity_sims(reopen_params, param_to_vary='expected_contacts_per_day',
                                           param_values = contacts_per_day_range, trajectories_per_config = 50, 
                                           time_horizon = 100)

pessimistic_reopen_params = reopen_params.copy()
pessimistic_reopen_params['contact_tracing_constant'] = 0.4

dfs_cpd_pessimistic = run_sensitivity_sims(pessimistic_reopen_params, 
                                                        param_to_vary='expected_contacts_per_day',
                                           param_values = contacts_per_day_range, trajectories_per_config = 50, 
                                           time_horizon = 100)


plot_many_dfs_threshold({'Effective Contact Tracing (Contact Trace Effectiveness 70%)': dfs_cpd, 
                         'Moderate Contact Tracing (Contact Trace Effectiveness 40%)': dfs_cpd_pessimistic}, 
                        xlabel="Expected Contacts per Day",
                       title="Outbreak Likelihood vs. Expected Contacts per Day")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09981167608286252, 'fraction_numerical': 0.0237758945386064, 'mean_word_length': 3.9235225955967556, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '639945', 'license': 'MIT', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1406, 'n_words': 230, 'path': 'boqn/group_testing/notebooks/cornell_reopen_analysis_sensitivity_sims.ipynb', 'repo_name': 'RaulAstudillo06/BOQN', 'size': '4248'}