Skip to content

Process_segmentwise ignore_badsignalwarning=True causes an array size mismatch #99

@JesseShaw

Description

@JesseShaw

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions