Commit 16567063 authored by Chris Jewell's avatar Chris Jewell
Browse files

Merge branch 'add-mean-summary' into 'master'

Added mean summary longformat

See merge request !19
parents d2f2bdff c7765fac
......@@ -10,6 +10,7 @@ from covid.model_spec import STOICHIOMETRY
SUMMARY_DAYS = np.array([1, 7, 14, 28, 35, 42, 49, 56], np.int32)
def rt(input_file, output_file):
"""Reads an array of next generation matrices and
outputs mean (ci) local Rt values.
......@@ -24,11 +25,11 @@ def rt(input_file, output_file):
rt = np.sum(ngm, axis=-2)
rt_summary = mean_and_ci(rt, name="Rt")
exceed = np.mean(rt > 1.0, axis=0)
rt_summary = pd.DataFrame(
rt_summary, index=pd.Index(ngm.coords["dest"], name="location")
)
rt_summary['Rt_exceed'] = exceed
rt_summary["Rt_exceed"] = exceed
rt_summary.to_csv(output_file)
......@@ -54,7 +55,8 @@ def infec_incidence(input_file, output_file):
idx = prediction.coords["location"]
abs_incidence = pd.DataFrame(
pred_events(prediction[..., offset:5, 2], name="cases"), index=idx
pred_events(prediction[..., offset : (offset + 1), 2], name="cases"),
index=idx,
)
for t in timepoints[1:]:
tmp = pd.DataFrame(
......@@ -66,6 +68,10 @@ def infec_incidence(input_file, output_file):
abs_incidence.to_csv(output_file)
def weekly_pred_cases_per_100k(input_files, output_file):
pass
def prevalence(input_files, output_file):
"""Reconstruct predicted prevalence from
original data and projection.
......
......@@ -102,5 +102,6 @@ def summary_longformat(input_files, output_file):
geography=df["location"],
value_date=df["time"],
value_type=df["value_name"],
value=df["value"],
quantiles={q: df[q] for q in quantiles},
).to_excel(output_file, index=False)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment