-
Notifications
You must be signed in to change notification settings - Fork 312
Closed
Labels
Description
If the units
contains a slash '/' they are not parsed correctly.
Bug in the regex:
wfdb-python/wfdb/io/_header.py
Line 110 in c616cb6
"/?(?P<units>[\w\^\-\?%]*)[ \t]*(?P<adc_res>\d*)[ \t]*", |
Example:
Traces.hea
file
Traces 8 1 31210 20:00:00 21/03/2020
Traces.dat 16x100 10.8692551374(1)/uV 15 0 0 24244 0 Chin
Traces.dat 16x100 10.8692551374(1)/uV 15 0 0 22989 0 Left Leg
Traces.dat 16x100 10.8692551374(1)/uV 15 0 0 -22154 0 Right Leg
Traces.dat 16x200 223.15372252(1)/mcmH2O 15 0 0 -24985 0 CPAP Pressure
Traces.dat 16x200 5948.85369237(1)/l/min 15 0 0 -22447 0 CPAP Flow
Traces.dat 16x200 505.31578574(1)/l/min 15 0 0 10563 0 CPAP Leak
Traces.dat 16x5 45.467096819(1)/m 15 0 0 17314 0 Light_BU
Traces.dat 16x10 4507.25807894(1)/mV/s 15 0 0 -12675 0 XFlow_DR
python
code that fails
sig = wfdb.rdheader('Traces')
df = pd.DataFrame({'sig_name':sig.sig_name, 'units':sig.units,\
'adc_res':sig.adc_res, 'init_value':sig.init_value,\
'checksum':sig.checksum, 'block_size':sig.block_size})
print(df.to_string())
output contains NaN
sig_name units adc_res init_value checksum block_size
0 Chin uV 15.0 0.0 24244.0 0.0
1 Left Leg uV 15.0 0.0 22989.0 0.0
2 Right Leg uV 15.0 0.0 -22154.0 0.0
3 CPAP Pressure mcmH2O 15.0 0.0 -24985.0 0.0
4 /min 15 0 0 -22447 0 CPAP Flow l NaN NaN NaN NaN
5 /min 15 0 0 10563 0 CPAP Leak l NaN NaN NaN NaN
6 Light_BU m 15.0 0.0 17314.0 0.0
7 /s 15 0 0 -12675 0 XFlow_DR mV NaN NaN NaN NaN