Skip to content

Commit 14b1fbc

Browse files
committed
more flexible for header regexp
1 parent 32265d6 commit 14b1fbc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

wfdb/_headers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ def wrheaderfile(self, writefields):
376376
[
377377
"(?P<filename>[\w]*\.?[\w]*~?)[ \t]+(?P<fmt>\d+)x?"
378378
"(?P<sampsperframe>\d*):?(?P<skew>\d*)\+?(?P<byteoffset>\d*)[ \t]*",
379-
"(?P<adcgain>-?\d*\.?\d*e?[\+-]?\d*)\(?(?P<baseline>-?\d*)\)?/?(?P<units>[\w\^/-]*)[ \t]*",
379+
"(?P<adcgain>-?\d*\.?\d*e?[\+-]?\d*)\(?(?P<baseline>-?\d*)\)?/?(?P<units>[\w\^/-\?%]*)[ \t]*",
380380
"(?P<adcres>\d*)[ \t]*(?P<adczero>-?\d*)[ \t]*(?P<initvalue>-?\d*)[ \t]*",
381-
"(?P<checksum>-?\d*)[ \t]*(?P<blocksize>\d*)[ \t]*(?P<signame>[\S]*)"]))
381+
"(?P<checksum>-?\d*)[ \t]*(?P<blocksize>\d*)[ \t]*(?P<signame>[\S]?[^\t\n\r\f\v]*)"]))
382382

383383
# Segment Line Fields
384384
rxSEGMENT = re.compile('(?P<segname>\w*~?)[ \t]+(?P<seglen>\d+)')
@@ -585,12 +585,14 @@ def __init__(self, allowedtypes, delimiter, dependency, write_req, read_def, wri
585585
# For storing WFDB Signal definitions.
586586

587587
# SignalType class with all its parameters
588-
class SignalType():
588+
class SignalType(object):
589589
def __init__(self, description, measurement=None, default_display=None, signalnames=None):
590590
self.description = description
591591
self.unitscale = unitscale
592+
592593
# Tuple pair (a, b). The plot displays range a, of unit b.
593-
self.default_display = default_display
594+
#self.default_display = default_display
595+
594596
self.signalnames = signalnames
595597

596598
unitscale = {
@@ -601,7 +603,7 @@ def __init__(self, description, measurement=None, default_display=None, signalna
601603

602604
# All signal types
603605
signaltypes = {
604-
'BP': SignalType('Blood Pressure', 'Pressure'),
606+
'BP': SignalType('Blood Pressure', 'Pressure',None, []),
605607
'CO2': SignalType('Carbon Dioxide'),
606608
'CO': SignalType('Carbon Monoxide'),
607609
'ECG': SignalType('Electrocardiogram'),

0 commit comments

Comments
 (0)