@@ -37,30 +37,63 @@ def validate(string):
3737
3838def parse_args ():
3939 """Parse args."""
40- parser = ArgumentParser (description = ' CHIME' )
40+ parser = ArgumentParser (description = " CHIME" )
4141
42- parser .add_argument (' --file' , type = open , action = FromFile )
42+ parser .add_argument (" --file" , type = open , action = FromFile )
4343 parser .add_argument (
44- '--prefix' ,
45- type = str ,
46- default = datetime .now ().strftime ("%Y.%m.%d.%H.%M." ),
44+ "--prefix" , type = str , default = datetime .now ().strftime ("%Y.%m.%d.%H.%M." ),
4745 )
4846
4947 for arg , cast , min_value , max_value , help in (
50- ('--current-hospitalized' , int , 0 , None , "Currently Hospitalized COVID-19 Patients (>= 0)" ),
51- ('--doubling-time' , float , 0.0 , None , "Doubling time before social distancing (days)" ),
52- ('--hospitalized-los' , int , 0 , None , "Hospitalized Length of Stay (days)" ),
53- ('--hospitalized-rate' , float , 0.00001 , 1.0 , "Hospitalized Rate: 0.00001 - 1.0" ),
54- ('--icu-los' , int , 0 , None , "ICU Length of Stay (days)" ),
55- ('--icu-rate' , float , 0.0 , 1.0 , "ICU Rate: 0.0 - 1.0" ),
56- ('--known-infected' , int , 0 , None ,
57- "Currently Known Regional Infections (>=0) (only used to compute detection rate - does not change projections)" ),
58- ('--market_share' , float , 0.00001 , 1.0 , "Hospital Market Share (0.00001 - 1.0)" ),
59- ('--n-days' , int , 0 , None , "Nuber of days to project >= 0" ),
60- ('--relative-contact-rate' , float , 0.0 , 1.0 , "Social Distancing Reduction Rate: 0.0 - 1.0" ),
61- ('--susceptible' , int , 1 , None , "Regional Population >= 1" ),
62- ('--ventilated-los' , int , 0 , None , "Hospitalized Length of Stay (days)" ),
63- ('--ventilated-rate' , float , 0.0 , 1.0 , "Ventilated Rate: 0.0 - 1.0" ),
48+ (
49+ "--current-hospitalized" ,
50+ int ,
51+ 0 ,
52+ None ,
53+ "Currently Hospitalized COVID-19 Patients (>= 0)" ,
54+ ),
55+ (
56+ "--doubling-time" ,
57+ float ,
58+ 0.0 ,
59+ None ,
60+ "Doubling time before social distancing (days)" ,
61+ ),
62+ ("--hospitalized-los" , int , 0 , None , "Hospitalized Length of Stay (days)" ),
63+ (
64+ "--hospitalized-rate" ,
65+ float ,
66+ 0.00001 ,
67+ 1.0 ,
68+ "Hospitalized Rate: 0.00001 - 1.0" ,
69+ ),
70+ ("--icu-los" , int , 0 , None , "ICU Length of Stay (days)" ),
71+ ("--icu-rate" , float , 0.0 , 1.0 , "ICU Rate: 0.0 - 1.0" ),
72+ (
73+ "--known-infected" ,
74+ int ,
75+ 0 ,
76+ None ,
77+ "Currently Known Regional Infections (>=0) (only used to compute detection rate - does not change projections)" ,
78+ ),
79+ (
80+ "--market_share" ,
81+ float ,
82+ 0.00001 ,
83+ 1.0 ,
84+ "Hospital Market Share (0.00001 - 1.0)" ,
85+ ),
86+ ("--n-days" , int , 0 , None , "Nuber of days to project >= 0" ),
87+ (
88+ "--relative-contact-rate" ,
89+ float ,
90+ 0.0 ,
91+ 1.0 ,
92+ "Social Distancing Reduction Rate: 0.0 - 1.0" ,
93+ ),
94+ ("--susceptible" , int , 1 , None , "Regional Population >= 1" ),
95+ ("--ventilated-los" , int , 0 , None , "Hospitalized Length of Stay (days)" ),
96+ ("--ventilated-rate" , float , 0.0 , 1.0 , "Ventilated Rate: 0.0 - 1.0" ),
6497 ):
6598 parser .add_argument (arg , type = validator (cast , min_value , max_value ))
6699 return parser .parse_args ()
@@ -83,22 +116,24 @@ def main():
83116 ventilated = RateLos (a .ventilated_rate , a .ventilated_los ),
84117 )
85118
86- raw_df = DataFrame ({
87- "Susceptible" : p .susceptible_v ,
88- "Infected" : p .infected_v ,
89- "Recovered" : p .recovered_v ,
90- })
119+ raw_df = DataFrame (
120+ {
121+ "Susceptible" : p .susceptible_v ,
122+ "Infected" : p .infected_v ,
123+ "Recovered" : p .recovered_v ,
124+ }
125+ )
91126 admits_df = build_admissions_df (p .n_days , * p .dispositions )
92127 census_df = build_census_df (admits_df , * p .lengths_of_stay )
93128
94129 prefix = a .prefix
95130 for df , name in (
96- (raw_df , ' raw' ),
97- (admits_df , ' admits' ),
98- (census_df , ' census' ),
131+ (raw_df , " raw" ),
132+ (admits_df , " admits" ),
133+ (census_df , " census" ),
99134 ):
100- df .to_csv (prefix + name + ' .csv' )
135+ df .to_csv (prefix + name + " .csv" )
101136
102137
103- if __name__ == ' __main__' :
138+ if __name__ == " __main__" :
104139 main ()
0 commit comments