From 41117084e219cd623352a051cde29b8082cde012 Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Fri, 5 Oct 2018 20:24:14 +0200 Subject: [PATCH] better default values for tolerance and max iterations --- src/main.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 545e29c..473d53f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,18 +20,9 @@ fn cli() -> Result> { let verbose: bool = matches.is_present("verbose"); let temperature: f32 = matches.value_of("temperature").unwrap().parse()?; - let tolerance: f32; - if matches.is_present("tolerance") { - tolerance = matches.value_of("tolerance").unwrap().parse()?; - } else { - tolerance = std::f32::MIN_POSITIVE; - } - let max_iterations: usize; - if matches.is_present("iterations") { - max_iterations = matches.value_of("iterations").unwrap().parse()?; - } else { - max_iterations = std::usize::MAX; - } + let tolerance: f32 = matches.value_of("tolerance").unwrap_or("0.000001").parse()?; + let max_iterations: usize = matches.value_of("iterations").unwrap_or("100000").parse()?; + Ok(wham::Config{metadata_file, hist_min, hist_max, num_bins, verbose, tolerance, max_iterations, temperature}) }