Skip to content

rdrecord(smooth_frames=False) fails if max(spf) == 1 #312

@bemoody

Description

@bemoody

If rdrecord is invoked with:

  • smooth_frames=True and physical=True (default), it should set rec.p_signal to a two-dimensional floating-point array.
  • smooth_frames=True and physical=False, it should set rec.d_signal to a two-dimensional integer array.
  • smooth_frames=False and physical=True, it should set rec.e_p_signal to a list of floating-point arrays.
  • smooth_frames=False and physical=False, it should set rec.e_d_signal to a list of integer arrays.

For example:

>>> type(wfdb.rdrecord('sample-data/03700181', smooth_frames=True, physical=True).p_signal)
<class 'numpy.ndarray'>
>>> type(wfdb.rdrecord('sample-data/03700181', smooth_frames=True, physical=False).d_signal)
<class 'numpy.ndarray'>
>>> type(wfdb.rdrecord('sample-data/03700181', smooth_frames=False, physical=True).e_p_signal)
<class 'list'>
>>> type(wfdb.rdrecord('sample-data/03700181', smooth_frames=False, physical=False).e_d_signal)
<class 'list'>

However, if every signal in the record has exactly one sample per frame, this doesn't work:

>>> type(wfdb.rdrecord('sample-data/100', smooth_frames=True, physical=True).p_signal)
<class 'numpy.ndarray'>
>>> type(wfdb.rdrecord('sample-data/100', smooth_frames=True, physical=False).d_signal)
<class 'numpy.ndarray'>
>>> type(wfdb.rdrecord('sample-data/100', smooth_frames=False, physical=True).e_p_signal)
<class 'NoneType'>
>>> type(wfdb.rdrecord('sample-data/100', smooth_frames=False, physical=False).e_d_signal)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/benjamin/wfdb-python/wfdb/io/record.py", line 3637, in rdrecord
    record.convert_dtype(physical, return_res, smooth_frames)
  File "/home/benjamin/wfdb-python/wfdb/io/_signal.py", line 726, in convert_dtype
    current_dtype = self.e_d_signal[ch].dtype
TypeError: 'NoneType' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions