Skip to content

Commit

Permalink
debug batchpeaktopeak
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilJl committed Jun 26, 2024
1 parent 92f01c8 commit e3935a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions batchstats/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ def update_batch(self, batch, assume_valid=False):
BatchPeakToPeak: Updated BatchPeakToPeak object.
"""
self.batchmax.update_batch(batch, assume_valid=assume_valid)
self.batchmin.update_batch(batch, assume_valid=assume_valid)
valid_batch = self._process_batch(batch=batch, assume_valid=assume_valid)
self.batchmax.update_batch(batch, assume_valid=True)
self.batchmin.update_batch(batch, assume_valid=True)
return self

def __call__(self) -> np.ndarray:
Expand Down
10 changes: 5 additions & 5 deletions tests/test_merge.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import numpy as np
import pytest

from batchstats import BatchCov, BatchMax, BatchMean, BatchMin, BatchStd, BatchSum, BatchVar
from batchstats import BatchCov, BatchMax, BatchMean, BatchMin, BatchPeakToPeak, BatchStd, BatchSum, BatchVar


@pytest.fixture
def data():
m, n = 25_000, 50
return np.random.randn(m, n), np.random.randn(m, n)
return np.random.randn(m, n), np.random.randn(2*m, n)


def test_merge(data):
data1, data2 = data
for stat in (BatchCov, BatchMax, BatchMean, BatchMin, BatchStd, BatchSum, BatchVar):
print(stat)
s0 = stat().update_batch(np.concatenate([data1, data2]))
data0 = np.concatenate([data1, data2])
for stat in (BatchCov, BatchMax, BatchMean, BatchMin, BatchPeakToPeak, BatchStd, BatchSum, BatchVar):
s0 = stat().update_batch(data0)
s1 = stat().update_batch(data1)
s2 = stat().update_batch(data2)
s3 = s1 + s2
Expand Down

0 comments on commit e3935a8

Please sign in to comment.