import os import pandas as pd import numpy as np import sys import seaborn as sns import matplotlib.pyplot as plt sys.path.append('../') from load_paths import load_box_paths datapath, projectpath, wdir, exe_dir, git_dir = load_box_paths() from processing_helpers import * """ df = pd.read_csv(os.path.join(datapath, 'covid_IDPH', 'Corona virus reports', 'il_cdc_thru_0811.csv'),low_memory=False) print(df) """ """Read in only relevant columns """ column_list = [ 'icu_length', 'hosp_length', 'age_group', 'res_county', 'res_state', 'hosp_yn', 'icu_yn', 'death_yn' ] df = pd.read_csv(os.path.join(datapath, 'covid_IDPH', 'Corona virus reports', 'il_cdc_thru_0811.csv'), usecols=column_list) print(df) """Remove Missings and Unknowns """ df = df.dropna(subset=["hosp_length"]) df = df.dropna(subset=["age_group"]) df = df.dropna(subset=["death_yn"]) df = df[df['age_group'] != 'Unknown'] df = df[df['icu_yn'] != 'Unknown']
logging.basicConfig(level="DEBUG") logging.getLogger("matplotlib").setLevel( "INFO") # Matplotlib has noisy debugs args = parse_args() emodl_template = args.emodl_template model = args.model scenario = args.scenario if args.running_location is None: if os.name == "posix": args.running_location = "NUCLUSTER" else: args.running_location = "Local" _, _, wdir, exe_dir, git_dir = load_box_paths( Location=args.running_location) Location = os.getenv("LOCATION") or args.running_location if not Location: raise ValueError("Please provide a running location via environment " "variable or CLI parameter.") # Only needed on non-Windows, non-Quest platforms docker_image = os.getenv("DOCKER_IMAGE") emodl_dir = os.path.join(git_dir, 'emodl') cfg_dir = os.path.join(git_dir, 'cfg') yaml_dir = os.path.join(git_dir, 'experiment_configs') log.debug(f"Running in Location = {Location}") if sys.platform not in ['win32', 'cygwin']: log.debug(f"Running in a non-Windows environment; "
region_label=region_label, first_day=first_day, last_day=last_day, plot_path=plot_path) if __name__ == '__main__': args = parse_args() stem = args.stem Location = args.Location first_plot_day = pd.Timestamp('2020-02-13') last_plot_day = pd.Timestamp.today() + pd.Timedelta(15, 'days') datapath, projectpath, wdir, exe_dir, git_dir = load_box_paths( Location=Location) exp_names = [ x for x in os.listdir(os.path.join(wdir, 'simulation_output')) if stem in x ] for exp_name in exp_names: sim_output_path = os.path.join(wdir, 'simulation_output', exp_name) plot_path = os.path.join(sim_output_path, '_plots') """Get group names""" grp_list, grp_suffix, grp_numbers = get_group_names( exp_path=sim_output_path) for grp_nr in grp_numbers: print("Start processing region " + str(grp_nr)) compare_ems(exp_name, ems_nr=int(grp_nr),
import shutil import stat import sys import numpy as np import pandas as pd import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sns mpl.rcParams['pdf.fonttype'] = 42 from processing_helpers import CI_50, CI_25, CI_75, CI_2pt5, CI_97pt5 from load_paths import load_box_paths datapath, projectpath, WDIR, EXE_DIR, GIT_DIR = load_box_paths() log = logging.getLogger(__name__) def DateToTimestep(date, startdate): datediff = date - startdate timestep = datediff.days return timestep def TimestepToDate(timesteps, startdate): dates = startdate + pd.Timedelta(timesteps, 'days') return dates