@@ -28,12 +28,44 @@ pub fn line_comparison(
2828 value_type : ValueType ,
2929 axis_scale : AxisScale ,
3030) {
31+ eprintln ! ( "[DIAG] line_comparison: title = {}" , title) ;
3132 let ( unit, series_data) = line_comparison_series_data ( formatter, all_curves) ;
3233
34+ eprintln ! (
35+ "[DIAG] line_comparison: series_data count = {}" ,
36+ series_data. len( )
37+ ) ;
38+ for ( i, ( name, xs, ys) ) in series_data. iter ( ) . enumerate ( ) {
39+ eprintln ! (
40+ "[DIAG] line_comparison: series[{}] name={:?}, xs len={}, ys len={}" ,
41+ i,
42+ name,
43+ xs. len( ) ,
44+ ys. len( )
45+ ) ;
46+ if ys. iter ( ) . any ( |y| !y. is_finite ( ) ) {
47+ eprintln ! (
48+ "[DIAG] line_comparison: WARNING - series[{}] has non-finite y values!" ,
49+ i
50+ ) ;
51+ }
52+ }
53+
3354 let x_range =
3455 plotters:: data:: fitting_range ( series_data. iter ( ) . flat_map ( |( _, xs, _) | xs. iter ( ) ) ) ;
3556 let y_range =
3657 plotters:: data:: fitting_range ( series_data. iter ( ) . flat_map ( |( _, _, ys) | ys. iter ( ) ) ) ;
58+
59+ eprintln ! (
60+ "[DIAG] line_comparison: x_range = {:?}, y_range = {:?}" ,
61+ x_range, y_range
62+ ) ;
63+ eprintln ! (
64+ "[DIAG] line_comparison: x_range.is_finite = {}, y_range.is_finite = {}" ,
65+ x_range. start. is_finite( ) && x_range. end. is_finite( ) ,
66+ y_range. start. is_finite( ) && y_range. end. is_finite( )
67+ ) ;
68+
3769 let root_area = SVGBackend :: new ( & path, SIZE )
3870 . into_drawing_area ( )
3971 . titled ( & format ! ( "{}: Comparison" , title) , ( DEFAULT_FONT , 20 ) )
@@ -118,13 +150,41 @@ fn line_comparison_series_data<'a>(
118150 formatter : & dyn ValueFormatter ,
119151 all_curves : & [ & ( & ' a BenchmarkId , Vec < f64 > ) ] ,
120152) -> ( & ' static str , Vec < ( Option < & ' a String > , Vec < f64 > , Vec < f64 > ) > ) {
121- let max = all_curves
153+ eprintln ! (
154+ "[DIAG] line_comparison_series_data: Processing {} curves" ,
155+ all_curves. len( )
156+ ) ;
157+
158+ let means: Vec < f64 > = all_curves
122159 . iter ( )
123- . map ( |& ( _, data) | Sample :: new ( data) . mean ( ) )
124- . fold ( :: std:: f64:: NAN , f64:: max) ;
160+ . enumerate ( )
161+ . map ( |( i, & ( id, data) ) | {
162+ let mean = Sample :: new ( data) . mean ( ) ;
163+ if !mean. is_finite ( ) {
164+ eprintln ! ( "[DIAG] line_comparison_series_data: Curve {} (id={}) has non-finite mean: {}, data len: {}" ,
165+ i, id. as_title( ) , mean, data. len( ) ) ;
166+ }
167+ mean
168+ } )
169+ . collect ( ) ;
170+
171+ let max = means. iter ( ) . fold ( :: std:: f64:: NAN , |acc, & x| acc. max ( x) ) ;
172+
173+ eprintln ! (
174+ "[DIAG] line_comparison_series_data: max = {}, is_finite = {}" ,
175+ max,
176+ max. is_finite( )
177+ ) ;
178+ if !max. is_finite ( ) {
179+ eprintln ! ( "[DIAG] line_comparison_series_data: All means: {:?}" , means) ;
180+ }
125181
126182 let mut dummy = [ 1.0 ] ;
127183 let unit = formatter. scale_values ( max, & mut dummy) ;
184+ eprintln ! (
185+ "[DIAG] line_comparison_series_data: unit = {}, dummy after scale = {:?}" ,
186+ unit, dummy
187+ ) ;
128188
129189 let mut series_data = vec ! [ ] ;
130190
@@ -158,14 +218,57 @@ pub fn violin(
158218 path : & Path ,
159219 axis_scale : AxisScale ,
160220) {
221+ eprintln ! (
222+ "[DIAG] violin: title = {}, processing {} curves" ,
223+ title,
224+ all_curves. len( )
225+ ) ;
161226 let all_curves_vec = all_curves. iter ( ) . rev ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
162227 let all_curves: & [ & ( & BenchmarkId , Vec < f64 > ) ] = & all_curves_vec;
163228
164229 let mut kdes = all_curves
165230 . iter ( )
166- . map ( |& & ( id, ref sample) | {
167- let ( x, mut y) = kde:: sweep ( Sample :: new ( sample) , KDE_POINTS , None ) ;
231+ . enumerate ( )
232+ . map ( |( i, & & ( id, ref sample) ) | {
233+ eprintln ! (
234+ "[DIAG] violin: Curve {} (id={}): sample len = {}" ,
235+ i,
236+ id. as_title( ) ,
237+ sample. len( )
238+ ) ;
239+ let sample_obj = Sample :: new ( sample) ;
240+ eprintln ! (
241+ "[DIAG] violin: Curve {} min={}, max={}, mean={}" ,
242+ i,
243+ sample_obj. min( ) ,
244+ sample_obj. max( ) ,
245+ sample_obj. mean( )
246+ ) ;
247+
248+ let ( x, mut y) = kde:: sweep ( sample_obj, KDE_POINTS , None ) ;
249+ eprintln ! (
250+ "[DIAG] violin: Curve {} KDE produced {} x-points and {} y-points" ,
251+ i,
252+ x. len( ) ,
253+ y. len( )
254+ ) ;
255+
168256 let y_max = Sample :: new ( & y) . max ( ) ;
257+ eprintln ! (
258+ "[DIAG] violin: Curve {} y_max = {}, is_finite = {}" ,
259+ i,
260+ y_max,
261+ y_max. is_finite( )
262+ ) ;
263+
264+ if !y_max. is_finite ( ) || y_max == 0.0 {
265+ eprintln ! (
266+ "[DIAG] violin: WARNING - Curve {} has problematic y_max! y values: {:?}" ,
267+ i,
268+ & y[ ..y. len( ) . min( 10 ) ]
269+ ) ;
270+ }
271+
169272 for y in y. iter_mut ( ) {
170273 * y /= y_max;
171274 }
@@ -189,8 +292,15 @@ pub fn violin(
189292 max = e;
190293 }
191294 }
295+ eprintln ! ( "[DIAG] violin: x min={}, max={}" , min, max) ;
296+
192297 let mut dummy = [ 1.0 ] ;
193298 let unit = formatter. scale_values ( max, & mut dummy) ;
299+ eprintln ! (
300+ "[DIAG] violin: unit={}, dummy after scale={:?}" ,
301+ unit, dummy
302+ ) ;
303+
194304 kdes. iter_mut ( ) . for_each ( |& mut ( _, ref mut xs, _) | {
195305 formatter. scale_values ( max, xs) ;
196306 } ) ;
@@ -199,6 +309,16 @@ pub fn violin(
199309 x_range. start = 0.0 ;
200310 let y_range = -0.5 ..all_curves. len ( ) as f64 - 0.5 ;
201311
312+ eprintln ! (
313+ "[DIAG] violin: x_range = {:?}, y_range = {:?}" ,
314+ x_range, y_range
315+ ) ;
316+ eprintln ! (
317+ "[DIAG] violin: x_range.is_finite = {}, y_range.is_finite = {}" ,
318+ x_range. start. is_finite( ) && x_range. end. is_finite( ) ,
319+ y_range. start. is_finite( ) && y_range. end. is_finite( )
320+ ) ;
321+
202322 let size = ( 960 , 150 + ( 18 * all_curves. len ( ) as u32 ) ) ;
203323
204324 let root_area = SVGBackend :: new ( & path, size)
0 commit comments