Use unweighted binning as default

This commit is contained in:
Dominik Werder
2021-09-08 21:27:34 +02:00
parent 75abb4140a
commit c455c01d24
10 changed files with 53 additions and 22 deletions

View File

@@ -7,7 +7,6 @@ use crate::{
WithLen, WithTimestamps,
};
use err::Error;
use netpod::log::*;
use netpod::timeunits::*;
use netpod::NanoRange;
use serde::{Deserialize, Serialize};
@@ -365,7 +364,6 @@ where
self.last_ts = ts;
self.last_val = Some(val);
} else if ts >= self.range.end {
info!("event after {}", ts / MS);
return;
} else {
self.count += 1;

View File

@@ -180,8 +180,8 @@ where
type Output = MinMaxAvgBins<NTY>;
type Aggregator = MinMaxAvgBinsAggregator<NTY>;
fn aggregator(range: NanoRange, _x_bin_count: usize, _do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range)
fn aggregator(range: NanoRange, _x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range, do_time_weight)
}
}
@@ -331,7 +331,7 @@ pub struct MinMaxAvgBinsAggregator<NTY> {
}
impl<NTY> MinMaxAvgBinsAggregator<NTY> {
pub fn new(range: NanoRange) -> Self {
pub fn new(range: NanoRange, _do_time_weight: bool) -> Self {
Self {
range,
count: 0,
@@ -357,9 +357,7 @@ where
fn ingest(&mut self, item: &Self::Input) {
for i1 in 0..item.ts1s.len() {
if item.ts2s[i1] <= self.range.beg {
continue;
} else if item.ts1s[i1] >= self.range.end {
continue;
} else {
self.min = match self.min {
None => item.mins[i1],

View File

@@ -181,8 +181,8 @@ where
type Output = MinMaxAvgDim1Bins<NTY>;
type Aggregator = MinMaxAvgDim1BinsAggregator<NTY>;
fn aggregator(range: NanoRange, x_bin_count: usize, _do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range, x_bin_count)
fn aggregator(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range, x_bin_count, do_time_weight)
}
}
@@ -325,7 +325,10 @@ pub struct MinMaxAvgDim1BinsAggregator<NTY> {
}
impl<NTY> MinMaxAvgDim1BinsAggregator<NTY> {
pub fn new(range: NanoRange, _x_bin_count: usize) -> Self {
pub fn new(range: NanoRange, _x_bin_count: usize, do_time_weight: bool) -> Self {
if do_time_weight {
err::todo();
}
Self {
range,
count: 0,

View File

@@ -179,8 +179,8 @@ where
type Output = MinMaxAvgWaveBins<NTY>;
type Aggregator = MinMaxAvgWaveBinsAggregator<NTY>;
fn aggregator(range: NanoRange, x_bin_count: usize, _do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range, x_bin_count)
fn aggregator(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
Self::Aggregator::new(range, x_bin_count, do_time_weight)
}
}
@@ -332,7 +332,10 @@ impl<NTY> MinMaxAvgWaveBinsAggregator<NTY>
where
NTY: NumOps,
{
pub fn new(range: NanoRange, x_bin_count: usize) -> Self {
pub fn new(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self {
if do_time_weight {
err::todo();
}
Self {
range,
count: 0,

View File

@@ -171,7 +171,10 @@ impl<NTY> WaveEventsAggregator<NTY>
where
NTY: NumOps,
{
pub fn new(range: NanoRange, _x_bin_count: usize, _do_time_weight: bool) -> Self {
pub fn new(range: NanoRange, _x_bin_count: usize, do_time_weight: bool) -> Self {
if do_time_weight {
err::todo();
}
Self {
range,
count: 0,

View File

@@ -178,7 +178,10 @@ impl<NTY> XBinnedWaveEventsAggregator<NTY>
where
NTY: NumOps,
{
pub fn new(range: NanoRange, bin_count: usize, _do_time_weight: bool) -> Self {
pub fn new(range: NanoRange, bin_count: usize, do_time_weight: bool) -> Self {
if do_time_weight {
err::todo();
}
if bin_count == 0 {
panic!("bin_count == 0");
}