You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "path_of_my_script", line 18, in
wfdb.io.convert.wav.wfdb_to_wav('voice001', pn_dir='voiced',
File "C:[...]\AppData\Local\Programs\Python\Python310\lib\site-packages\wfdb\io\convert\wav.py", line 121, in wfdb_to_wav
np.left_shift(np.subtract(record.adc(), offset), shift)
File "C:[...]\AppData\Local\Programs\Python\Python310\lib\site-packages\wfdb\io_signal.py", line 578, in adc
nanlocs = np.isnan(self.p_signal)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
At first I thought that I was messing it up and went to the documentation page. I ended up realizing that if I try to run the example piece of code that appears for wfdb_to_wav:
wfdb_to_wav('100', pn_dir='pwave')
I obtain the same error as my code's. I did some research and some people has the same 'TypeError: ufunc 'isnan' not supported...' in other context, they managed to fix it using pandas instead of numpy, but it doesn't work for me. Any idea of why is this happening?
This is a bug in wfdb_to_wav; it calls rdrecord with
smooth_frames=False when what it wants is smooth_frames=True. Thanks
for pointing this out! We ought to include a test case for
wfdb_to_wav in the test suite.
Looks like this bug has been there since wfdb_to_wav (then called
mit2wav) was first written, though prior to v4.0.0 the bug would only
have occurred with multi-frequency input records.
Activity
bemoody commentedon Jul 22, 2022
dmerinodel commentedon Jul 25, 2022
I tried with smooth_frames=True and my code runs, but the .wav that generates doesn't make any sound. I guess it's not that easy :) thanks!
Fix wfdb_to_wav failing for every record
Fix wfdb_to_wav failing for every record (#632)
tompollard commentedon Nov 23, 2026
Fixed:
wfdb_to_wavnow reads the record withsmooth_frames=True. Please reopen if you still see the error.