-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
38 lines (27 loc) · 1.24 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from R0_Estimation.datatype import Country, PreprocessInfo, InfoType
from R0_Estimation.estimation import get_estimate_r0_df
from R0_Estimation.io import load_links
import argparse
def get_args():
parser = argparse.ArgumentParser(description='r0_estimation')
parser.add_argument(
"--country", type=str, default='italy',
choices=['italy', 'india', 'us', 'china'],
help="Country name"
)
args = parser.parse_args()
return args
def main(args):
country = Country(args.country.upper())
link_df = load_links(country)
pre_info = PreprocessInfo(country=country, start=link_df['start_date'], end=link_df['end_date'],
increase=True, daily=True, remove_zero=True,
smoothing=True, window=5, divide=False, info_type=InfoType.PRE)
test_info = PreprocessInfo(country=country, start=link_df['start_date'], end=link_df['end_date'],
increase=False, daily=True, remove_zero=True,
smoothing=True, window=5, divide=False, info_type=InfoType.TEST)
r0_df = get_estimate_r0_df(country, pre_info, test_info)
return r0_df
if __name__ == '__main__':
args = get_args()
r0_df = main(args)