add pi to min/max

This commit is contained in:
Daniel Bauer
2020-03-08 11:42:47 +01:00
parent cd7bea063f
commit 936cbe1c58
11 changed files with 10352 additions and 10306 deletions

View File

@@ -31,14 +31,14 @@ args:
takes_value: true
required: true
allow_hyphen_values: true
help: Histogram minima (comma separated for multiple dimensions).
help: Histogram minima (comma separated for multiple dimensions). Also accepts "pi".
- max_hist:
long: max
value_name: HIST_MAX
takes_value: true
required: true
allow_hyphen_values: true
help: Histogram maxima (comma separated)
help: Histogram maxima (comma separated). Also accepts "pi".
- bins:
short: b
long: bins

View File

@@ -23,9 +23,25 @@ fn cli() -> Result<Config> {
let cyclic: bool = matches.is_present("cyclic");
let hist_min: Vec<f64> = matches.value_of("min_hist").unwrap()
.split(',').map(|x| { x.parse().unwrap() }).collect();
.split(',').map(|x| {
if x.to_ascii_lowercase() == "pi" {
std::f64::consts::PI
} else if x.to_ascii_lowercase() == "-pi" {
-std::f64::consts::PI
} else {
x.parse().unwrap()
}
}).collect();
let hist_max: Vec<f64> = matches.value_of("max_hist").unwrap()
.split(',').map(|x| { x.parse().unwrap() }).collect();
.split(',').map(|x| {
if x.to_ascii_lowercase() == "pi" {
std::f64::consts::PI
} else if x.to_ascii_lowercase() == "-pi" {
-std::f64::consts::PI
} else {
x.parse().unwrap()
}
}).collect();
let num_bins: Vec<usize> = matches.value_of("bins").unwrap()
.split(',').map(|x| { x.parse().unwrap() }).collect();
let bootstrap: usize = matches.value_of("bootstrap").unwrap_or("0").parse()