|
18 | 18 | from . import _signal
|
19 | 19 | from . import download
|
20 | 20 |
|
21 |
| - |
| 21 | +import pdb |
22 | 22 | class BaseRecord(object):
|
23 | 23 | # The base WFDB class extended by the Record and MultiRecord classes.
|
24 | 24 | def __init__(self, record_name=None, n_sig=None,
|
@@ -569,7 +569,7 @@ def checksegmentcohesion(self):
|
569 | 569 | def required_segments(self, sampfrom, sampto, channels):
|
570 | 570 |
|
571 | 571 | # The starting segment with actual samples
|
572 |
| - if self.layout == 'Fixed': |
| 572 | + if self.layout == 'fixed': |
573 | 573 | startseg = 0
|
574 | 574 | else:
|
575 | 575 | startseg = 1
|
@@ -612,7 +612,7 @@ def required_segments(self, sampfrom, sampto, channels):
|
612 | 612 | def required_signal(self, readsegs, channels, dirname, pb_dir):
|
613 | 613 |
|
614 | 614 | # Fixed layout. All channels are the same.
|
615 |
| - if self.layout == 'Fixed': |
| 615 | + if self.layout == 'fixed': |
616 | 616 | # Should we bother here with skipping empty segments?
|
617 | 617 | # They won't be read anyway.
|
618 | 618 | readsigs = [channels]*len(readsegs)
|
@@ -649,7 +649,7 @@ def arrange_fields(self, readsegs, segranges, channels):
|
649 | 649 |
|
650 | 650 | # Get rid of the segments and segment line parameters
|
651 | 651 | # outside the desired segment range
|
652 |
| - if self.layout == 'Fixed': |
| 652 | + if self.layout == 'fixed': |
653 | 653 | self.segments = self.segments[readsegs[0]:readsegs[-1]+1]
|
654 | 654 | self.seg_name = self.seg_name[readsegs[0]:readsegs[-1]+1]
|
655 | 655 | self.seg_len = self.seg_len[readsegs[0]:readsegs[-1]+1]
|
@@ -703,7 +703,7 @@ def multi_to_single(self, return_res=64):
|
703 | 703 | startsamps = [0] + list(np.cumsum(self.seg_len)[0:-1])
|
704 | 704 | endsamps = list(np.cumsum(self.seg_len))
|
705 | 705 |
|
706 |
| - if self.layout == 'Fixed': |
| 706 | + if self.layout == 'fixed': |
707 | 707 | # Get the signal names and units from the first segment
|
708 | 708 | fields['sig_name'] = self.segments[0].sig_name
|
709 | 709 | fields['units'] = self.segments[0].units
|
@@ -834,9 +834,9 @@ def rdheader(record_name, pb_dir=None, rd_segments=False):
|
834 | 834 | setattr(record, field, d_rec[field])
|
835 | 835 | # Determine whether the record is fixed or variable
|
836 | 836 | if record.seg_len[0] == 0:
|
837 |
| - record.layout = 'Variable' |
| 837 | + record.layout = 'variable' |
838 | 838 | else:
|
839 |
| - record.layout = 'Fixed' |
| 839 | + record.layout = 'fixed' |
840 | 840 |
|
841 | 841 | # If specified, read the segment headers
|
842 | 842 | if rd_segments:
|
@@ -1000,14 +1000,9 @@ def rdrecord(record_name, sampfrom=0, sampto='end', channels='all',
|
1000 | 1000 |
|
1001 | 1001 | record.segments = [None]*record.n_seg
|
1002 | 1002 |
|
1003 |
| - # Variable layout |
1004 |
| - if record.seg_len[0] == 0: |
1005 |
| - record.layout = 'Variable' |
1006 |
| - # Read the layout specification header |
| 1003 | + # Variable layout, read the layout specification header |
| 1004 | + if record.layout == 'variable': |
1007 | 1005 | record.segments[0] = rdheader(os.path.join(dirname, record.seg_name[0]), pb_dir=pb_dir)
|
1008 |
| - # Fixed layout |
1009 |
| - else: |
1010 |
| - record.layout = 'Fixed' |
1011 | 1006 |
|
1012 | 1007 | # The segment numbers and samples within each segment to read.
|
1013 | 1008 | readsegs, segranges = record.required_segments(sampfrom, sampto, channels)
|
|
0 commit comments