mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Included bode plot measurements, including different number of points.
This commit is contained in:
10
src/plot.rs
10
src/plot.rs
@@ -3,7 +3,7 @@ use std::collections::VecDeque;
|
||||
|
||||
use egui_plot::{PlotPoint, PlotPoints};
|
||||
|
||||
use bioz_icd_rs::NumberOfPoints;
|
||||
use bioz_icd_rs::MeasurementPointSet;
|
||||
|
||||
pub struct TimeSeriesPlot {
|
||||
pub values: VecDeque<PlotPoint>,
|
||||
@@ -63,14 +63,14 @@ impl BodePlot {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_magnitudes(&mut self, magnitudes: Vec<f32>) {
|
||||
let freqs = NumberOfPoints::TwentyEight.values().to_vec();
|
||||
pub fn update_magnitudes(&mut self, points: MeasurementPointSet, magnitudes: Vec<f32>) {
|
||||
let freqs = points.values().to_vec();
|
||||
// self.magnitudes = freqs.into_iter().zip(magnitudes.into_iter()).map(|(f, m)| PlotPoint::new(f.log10(), 20.0 * m.log10() as f32)).collect();
|
||||
self.magnitudes = freqs.into_iter().zip(magnitudes.into_iter()).map(|(f, m)| PlotPoint::new(f.log10(), m as f32)).collect();
|
||||
}
|
||||
|
||||
pub fn update_phases(&mut self, phases: Vec<f32>) {
|
||||
let freqs = NumberOfPoints::TwentyEight.values().to_vec();
|
||||
pub fn update_phases(&mut self, points: MeasurementPointSet, phases: Vec<f32>) {
|
||||
let freqs = points.values().to_vec();
|
||||
self.phases = freqs.into_iter().zip(phases.into_iter()).map(|(f, p)| PlotPoint::new(f.log10(), p as f64)).collect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user