@@ -597,12 +597,21 @@ def get_int_to_double_conversion_ratio(self):
597
597
def output_percentile_distribution (self ,
598
598
out_file ,
599
599
output_value_unit_scaling_ratio ,
600
- ticks_per_half_distance = 5 ):
601
- out_file .write (b'%12s %14s %10s %14s\n \n ' %
602
- (b'Value' , b'Percentile' , b'TotalCount' , b'1/(1-Percentile)' ))
600
+ ticks_per_half_distance = 5 ,
601
+ use_csv = False ):
602
+ if use_csv :
603
+ out_file .write (b'"Value","Percentile","TotalCount","1/(1-Percentile)"\n ' )
604
+ else :
605
+ out_file .write (b'%12s %14s %10s %14s\n \n ' %
606
+ (b'Value' , b'Percentile' , b'TotalCount' , b'1/(1-Percentile)' ))
607
+
608
+ if use_csv :
609
+ percentile_format = '%.{}f,%.12f,%d,%.2f\n ' .format (self .significant_figures )
610
+ last_line_percentile_format = '%.{}f,%.12f,%d,Infinity\n ' .format (self .significant_figures )
611
+ else :
612
+ percentile_format = '%12.{}f %2.12f %10d %14.2f\n ' .format (self .significant_figures )
613
+ last_line_percentile_format = '%12.{}f %2.12f %10d\n ' .format (self .significant_figures )
603
614
604
- percentile_format = '%12.{}f %2.12f %10d %14.2f\n ' .format (self .significant_figures )
605
- last_line_percentile_format = '%12.{}f %2.12f %10d\n ' .format (self .significant_figures )
606
615
for iter_value in self .get_percentile_iterator (ticks_per_half_distance ):
607
616
value = iter_value .value_iterated_to / output_value_unit_scaling_ratio
608
617
percentile = iter_value .percentile_level_iterated_to / 100
@@ -616,6 +625,9 @@ def output_percentile_distribution(self,
616
625
percentile ,
617
626
total_count ))
618
627
628
+ if use_csv :
629
+ return
630
+
619
631
mean = self .get_mean_value () / output_value_unit_scaling_ratio
620
632
stddev = self .get_stddev ()
621
633
out_file .write ('#[Mean = %12.{0}f, StdDeviation = %12.{0}f]\n ' .
0 commit comments