Skip to content

Commit 9ed8073

Browse files
committed
Refactor run.py to use smoothing util
1 parent 8878749 commit 9ed8073

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

jhu/delphi_jhu/run.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,17 @@
66
"""
77
from datetime import datetime
88
from itertools import product
9-
from functools import partial
109
from os.path import join
1110

1211
import numpy as np
1312
import pandas as pd
14-
from delphi_utils import read_params, create_export_csv
13+
from delphi_utils import read_params, create_export_csv, Smoother
1514

1615
from .geo import geo_map
1716
from .pull import pull_jhu_data
18-
from .smooth import (
19-
identity,
20-
kday_moving_average,
21-
)
2217

2318

2419
# global constants
25-
seven_day_moving_average = partial(kday_moving_average, k=7)
2620
METRICS = [
2721
"confirmed",
2822
"deaths",
@@ -44,8 +38,8 @@
4438
"cumulative_prop": ("cumulative_prop", False),
4539
}
4640
SMOOTHERS_MAP = {
47-
"unsmoothed": (identity, ''),
48-
"seven_day_average": (seven_day_moving_average, '7dav_'),
41+
"unsmoothed": (Smoother("identity").smooth, ''),
42+
"seven_day_average": (Smoother("moving_average", window_length=7).smooth, '7dav_'),
4943
}
5044
GEO_RESOLUTIONS = [
5145
"county",

0 commit comments

Comments
 (0)