From f45ef1b29bb19b1aae52845e1942949b6614d511 Mon Sep 17 00:00:00 2001 From: erdogant Date: Wed, 28 Aug 2024 21:20:18 +0200 Subject: [PATCH] restrict to numpy version 1.26.4 maximum. Numpy > v2 does not result in correct output --- findpeaks/examples.py | 2 +- findpeaks/stats.py | 1 + requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/findpeaks/examples.py b/findpeaks/examples.py index 07c1080..87cdfd0 100644 --- a/findpeaks/examples.py +++ b/findpeaks/examples.py @@ -82,7 +82,7 @@ from findpeaks import findpeaks rng = np.random.default_rng(42) x = rng.normal(size=(50, 50)) -x = gaussian_filter(x, sigma=10.) +x = gaussian_filter(x, sigma=10) # peak and valley fp = findpeaks(method="topology", whitelist=['peak', 'valley'], denoise=None, verbose=3) results = fp.fit(x) diff --git a/findpeaks/stats.py b/findpeaks/stats.py index 3ad4ff3..126396d 100644 --- a/findpeaks/stats.py +++ b/findpeaks/stats.py @@ -436,6 +436,7 @@ def topology(X, limit=None, reverse=True, verbose=3): # It is important to ensure unique values because the method sorts the values and only unique values are processed. # Without adjusting duplicated values, peaks with exactly the same height will be skipped. X = _make_unique(X) + # X = np.maximum(X + ((X>0).astype(int) * np.random.rand(X.shape[0], X.shape[1])/10), 0) # Get indices orderd by value from high to low indices = [(i, j) for i in range(h) for j in range(w) if _get_indices(X, (i, j)) is not None and _get_indices(X, (i, j)) >= limit] diff --git a/requirements.txt b/requirements.txt index b2c3d88..df0c03a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ scipy matplotlib -numpy +numpy==1.26.4 pandas tqdm requests diff --git a/setup.py b/setup.py index 65c2448..99c8b52 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setuptools.setup( install_requires=['scipy', 'matplotlib', - 'numpy', + 'numpy==1.26.4', 'pandas', 'tqdm', 'requests',