MIT-LCP / MIT-LCP/wfdb-python

Error in wfdb_to_wav

Aperta
#410 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Jupyter Notebook
Stelle
853
Fork
322
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso wfdb_to_wav in wfdb/io/convert/wav.py intorno alla riga 121, quindi esamina il metodo adc in wfdb/io/_signal.py intorno alla riga 578. Riproduci l’esempio documentato wfdb_to_wav('100', pn_dir='pwave') e confronta i relativi tipi di input con il percorso che fallisce; il lavoro è completato quando gli esempi vengono convertiti correttamente senza il TypeError segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
numpy, python
Ambito
data
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.