16
16
population_files [vacc_folder [:- 1 ]].append (par_dir + "/population_sizes.csv" )
17
17
18
18
for sim_id , population_file_list in population_files .items ():
19
- outbreak_simulations_1 = 0
20
- outbreak_simulations_2 = 0
21
- outbreak_simulations_5 = 0
22
- outbreak_simulations_10 = 0
23
- for population_file in population_file_list :
24
- data = pd .read_csv (population_file )
25
- recovered_num = max ([data ['G9R' ][data .index [- 1 ]], data ['G10R' ][data .index [- 1 ]], data ['G11R' ][data .index [- 1 ]], data ['G12R' ][data .index [- 1 ]] ])
26
- if recovered_num > 1 :
27
- outbreak_simulations_1 += 1
28
- if recovered_num > 2 :
29
- outbreak_simulations_2 += 1
30
- if recovered_num > 5 :
31
- outbreak_simulations_5 += 1
32
- if recovered_num > 10 :
33
- outbreak_simulations_10 += 1
19
+ if len (population_file_list ) != 0 :
20
+ outbreak_simulations_1 = 0
21
+ outbreak_simulations_2 = 0
22
+ outbreak_simulations_5 = 0
23
+ outbreak_simulations_10 = 0
24
+ for population_file in population_file_list :
25
+ data = pd .read_csv (population_file )
26
+ recovered_num = max ([data ['G9R' ][data .index [- 1 ]], data ['G10R' ][data .index [- 1 ]], data ['G11R' ][data .index [- 1 ]], data ['G12R' ][data .index [- 1 ]] ])
27
+ if recovered_num > 1 :
28
+ outbreak_simulations_1 += 1
29
+ if recovered_num > 2 :
30
+ outbreak_simulations_2 += 1
31
+ if recovered_num > 5 :
32
+ outbreak_simulations_5 += 1
33
+ if recovered_num > 10 :
34
+ outbreak_simulations_10 += 1
34
35
35
- outbreak_simulations_1 /= len (population_file_list )
36
- outbreak_simulations_2 /= len (population_file_list )
37
- outbreak_simulations_5 /= len (population_file_list )
38
- outbreak_simulations_10 /= len (population_file_list )
39
- print (sim_id [4 :], outbreak_simulations_1 , outbreak_simulations_2 , outbreak_simulations_5 , outbreak_simulations_10 , sep = "," )
36
+ outbreak_simulations_1 /= len (population_file_list )
37
+ outbreak_simulations_2 /= len (population_file_list )
38
+ outbreak_simulations_5 /= len (population_file_list )
39
+ outbreak_simulations_10 /= len (population_file_list )
40
+ print (sim_id [4 :], outbreak_simulations_1 , outbreak_simulations_2 , outbreak_simulations_5 , outbreak_simulations_10 , sep = "," )
41
+ else :
42
+ print (sim_id , " is not available." )
0 commit comments