buffer-proto5: auto-measure the extrema for M/H

also, introduce a `Time` abstraction and allow for more precisely
simulating just a specific time range.

the Sim-related traits still need updating to better integrate this.
This commit is contained in:
2022-01-11 18:23:07 -08:00
parent 8bda52d973
commit ce39c1f50b
5 changed files with 123 additions and 11 deletions

View File

@@ -646,6 +646,17 @@ impl CsvRenderer {
state: Mutex::new(Some(CsvState::Reading(reader))),
}
}
pub fn read_column(self, header: &str) -> Vec<String> {
let mut rd = match self.state.into_inner().unwrap() {
Some(CsvState::Reading(rd)) => rd,
_ => panic!("not reading!"),
};
let colno = rd.headers().unwrap().iter().position(|it| it == header).unwrap();
rd.into_records().map(|items| items.unwrap().get(colno).unwrap().to_owned()).collect()
}
pub fn read_column_as_f32(self, header: &str) -> Vec<f32> {
self.read_column(header).into_iter().map(|s| s.parse().unwrap()).collect()
}
}
impl<S: SampleableSim> Renderer<S> for CsvRenderer {