From 1caf7f6c63d8b961155526112c2f3b779d531c17 Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Sat, 6 Oct 2018 11:30:13 +0200 Subject: [PATCH] fix data read --- src/io.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/io.rs b/src/io.rs index c1a6b08..6b002fc 100644 --- a/src/io.rs +++ b/src/io.rs @@ -121,12 +121,15 @@ fn read_window_file(window_file: &str, cfg: &Config) -> Option { } } - if max_bin == min_bin { + println!("{}", global_hist.len()); + if (max_bin == min_bin && global_hist[max_bin] == 0.0) || max_bin < min_bin { None // zero length histogram } else { + println!("{}/{}, {:?}", min_bin, max_bin, global_hist); // trim global hist to save memory global_hist.truncate(max_bin+1); global_hist.drain(..min_bin); + println!("{}/{} ->{:?}", min_bin, max_bin, &global_hist); let num_points: f32 = global_hist.iter().sum(); Some(Histogram::new(min_bin, max_bin, num_points as u32, global_hist))