Error in wfdb_to_wav
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 853
- Forks
- 322
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi everyone,
this is my first time writing an issue as well as using wfdb so, excuse me in advance for the mistakes I'll surely make :)
I'm trying to obtain some .wav from the data stored in VOICED database with the following piece of code:
import wfdb.io.convert.wav
import os
path = 'my_path'
wfdb.io.convert.wav.wfdb_to_wav('voice001', pn_dir='voiced',
output_filename=os.path.join(path, 'aaab.wav'))
Thus, I obtain the following error:
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem wfdb_to_wav-Einstiegspunkt in wfdb/io/convert/wav.py etwa bei Zeile 121 und untersuchen Sie anschließend die adc-Methode in wfdb/io/_signal.py etwa bei Zeile 578. Reproduzieren Sie das dokumentierte wfdb_to_wav('100', pn_dir='pwave')-Beispiel und vergleichen Sie dessen Eingabetypen mit dem fehlschlagenden Pfad; als erledigt gilt die Aufgabe, wenn die Beispiele ohne den gemeldeten TypeError erfolgreich konvertiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- numpy, python
- Bereich
- data
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100