This update broke my working app. I was on 2.5.3 before. I also tested successfully with 2.5.4.
So after upgrading 2.5.4. -> 2.5.5 "topology" method breaks. For spurious reasons it wants to store a vector of Y.shape = (20,2)
, albeit X
is of X.shape = (20,)
. This breaks the method as it expects a 1D-vector.
# Load library
from findpeaks import findpeaks
# Data
X = [10,11,9,23,21,11,45,20,11,12]
# Initialize
fp = findpeaks(method='peakdetect', lookahead=1)
results = fp.fit(X)
# Plot
fp.plot()
fp = findpeaks(method='topology', lookahead=1)
results = fp.fit(X)
fp.plot()
fp.plot_persistence()
Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3790, in get_loc
return self._engine.get_loc(casted_key)
File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'rank'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/frame.py", line 4261, in _set_item_mgr
loc = self._info_axis.get_loc(key)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3797, in get_loc
raise KeyError(key) from err
KeyError: 'rank'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/findpeaks/findpeaks.py", line 256, in fit
results = self.peaks1d(X, x=x, method=self.method)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/findpeaks/findpeaks.py", line 348, in peaks1d
self.results, self.args = self._store1d(X, Xraw, x, result)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/findpeaks/findpeaks.py", line 375, in _store1d
dfint['rank'] = result['Xranked']
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/frame.py", line 4091, in __setitem__
self._set_item(key, value)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/frame.py", line 4314, in _set_item
self._set_item_mgr(key, value, refs)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/frame.py", line 4264, in _set_item_mgr
self._mgr.insert(len(self._info_axis), key, value, refs)
File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/pandas/core/internals/managers.py", line 1328, in insert
raise ValueError(
ValueError: Expected a 1D array, got an array with shape (148, 2)