Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process_segmentwise ignore_badsignalwarning=True causes an array size mismatch #99

Open
JesseShaw opened this issue Oct 19, 2022 · 1 comment

Comments

@JesseShaw
Copy link

This works when ignore_badsignalwarning=False but the signal length shrinks by the number of bad readings in the signal.

bvp_vec = bvp_in.iloc[:,0]
filtered = hp.filter_signal(bvp_vec, [0.7, 3.5], sample_rate=bvp_smplrt, order=3, filtertype='bandpass')
wd, m = hp.process_segmentwise(filtered, sample_rate = bvp_smplrt, segment_width = 60, segment_overlap = 0, replace_outliers=True, mode='full', ignore_badsignalwarning=True)
bvp = pd.DataFrame(data=m, index=None)


ValueError Traceback (most recent call last)
in
2 #ts, filtered, onsets, heart_rate_ts, heart_rate = bvp(signal=bvp_flt, sampling_rate=bvp_smplrt, show=True)
3 wd, m = hp.process_segmentwise(filtered, sample_rate = bvp_smplrt, segment_width = 60, segment_overlap = 0, replace_outliers=True, mode='full', ignore_badsignalwarning=True)
----> 4 bvp = pd.DataFrame(data=m, index=None)

~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pandas/core/frame.py in init(self, data, index, columns, dtype, copy)
346 dtype=dtype, copy=copy)
347 elif isinstance(data, dict):
--> 348 mgr = self._init_dict(data, index, columns, dtype=dtype)
349 elif isinstance(data, ma.MaskedArray):
350 import numpy.ma.mrecords as mrecords

~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pandas/core/frame.py in _init_dict(self, data, index, columns, dtype)
457 arrays = [data[k] for k in keys]
458
--> 459 return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
460
461 def _init_ndarray(self, values, index, columns, dtype=None, copy=False):

~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pandas/core/frame.py in _arrays_to_mgr(arrays, arr_names, index, columns, dtype)
7354 # figure out the index, if necessary
7355 if index is None:
-> 7356 index = extract_index(arrays)
7357
7358 # don't force copy because getting jammed in an ndarray anyway

~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pandas/core/frame.py in extract_index(data)
7400 lengths = list(set(raw_lengths))
7401 if len(lengths) > 1:
-> 7402 raise ValueError('arrays must all be same length')
7403
7404 if have_dicts:

ValueError: arrays must all be same length

@paulvangentcom
Copy link
Owner

Can you share with me the data you're using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants