Skip to content

units are not parsed correctly #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maksteel opened this issue Jun 9, 2020 · 0 comments · Fixed by #232
Closed

units are not parsed correctly #231

maksteel opened this issue Jun 9, 2020 · 0 comments · Fixed by #232
Labels

Comments

@maksteel
Copy link

maksteel commented Jun 9, 2020

If the units contains a slash '/' they are not parsed correctly.

Bug in the regex:

"/?(?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
maksteel pushed a commit to maksteel/wfdb-python that referenced this issue Jun 9, 2020
@Lucas-Mc Lucas-Mc added the bug label Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants