wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

key error in rdann when reading ehgdb

Open mfedoten opened this issue 9 years ago • 1 comments

Code to reproduce:

import wfdb
wfdb.rdann('ice045_p_4of4', annotator='atr', pbdir='ehgdb')

Traceback:

KeyError Traceback (most recent call last) in () ----> 1 wfdb.rdann('ice045_p_4of4', annotator='atr', pbdir='ehgdb')

~/Documents/Code/pocs/wfdb-python/wfdb/readwrite/annotations.py in rdann(recordname, annotator, sampfrom, sampto, shiftsamps, pbdir) 675 676 # Set the annotation type to the annotation codes --> 677 anntype = [allannsyms[code] for code in anntype] 678 679 # If the fs field was not present in the file, try to read a wfdb header

~/Documents/Code/pocs/wfdb-python/wfdb/readwrite/annotations.py in (.0) 675 676 # Set the annotation type to the annotation codes --> 677 anntype = [allannsyms[code] for code in anntype] 678 679 # If the fs field was not present in the file, try to read a wfdb header

KeyError: 46

Mitdb doesn't produce the same error, e.g. wfdb.rdann('100', annotator='atr', pbdir='mitdb') loads annotations without an error. I didn't test on other databases.

It seems like the problems occurs after 9b61c1b28bc94fe87b3ad1ca508e0cb9a37ccaca .

mfedoten avatar Aug 28 '17 10:08 mfedoten

Issue should be fixed with the latest version. Thanks for spotting this.

cx1111 avatar Sep 27 '17 15:09 cx1111