@@ -136,8 +136,10 @@ def draw_cdf_ci(axis, dataset, confidence=0.95, **kwargs):
136136 quantile_buckets = {q :[] for q in y }
137137
138138 # we should have one empirical value for each simulation (ie data) for each quantile
139+ total_num_items = 0
139140 for data in dataset :
140141 num_items = len (data )
142+ total_num_items += num_items
141143 if num_items == 0 :
142144 continue
143145
@@ -147,9 +149,13 @@ def draw_cdf_ci(axis, dataset, confidence=0.95, **kwargs):
147149 val_at_q = data [int ((num_items - 1 ) * q )]
148150 quantile_buckets [q ].append (val_at_q )
149151
150- # compute the confidence intervals for each quantile
151- bucket_list = [quantile_buckets [q ] for _ , q in enumerate (y )]
152- x , x_min , x_max = __compute_sample_mean_and_error (bucket_list , confidence )
152+ if total_num_items == 0 :
153+ # No data; avoid divide-by-zero in __compute_sample_mean_and_error
154+ x , y , x_min , x_max = [], [], [], []
155+ else :
156+ # compute the confidence intervals for each quantile
157+ bucket_list = [quantile_buckets [q ] for _ , q in enumerate (y )]
158+ x , x_min , x_max = __compute_sample_mean_and_error (bucket_list , confidence )
153159
154160 # for debugging
155161 #axis.plot(x_min, y, label=f"k={k}", color=colors[l%len(colors)], linestyle=linestyle)
0 commit comments