当前位置: 首页>>代码示例>>Python>>正文


Python wfdb.rdrecord方法代码示例

本文整理汇总了Python中wfdb.rdrecord方法的典型用法代码示例。如果您正苦于以下问题:Python wfdb.rdrecord方法的具体用法?Python wfdb.rdrecord怎么用?Python wfdb.rdrecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wfdb的用法示例。


在下文中一共展示了wfdb.rdrecord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_data

# 需要导入模块: import wfdb [as 别名]
# 或者: from wfdb import rdrecord [as 别名]
def process_data(filename):
    import wfdb
    ecg_list = listdir(filename)
    sample_list = [ecg[:-4] for ecg in ecg_list]
    clean_sample_list = [ecg for ecg in sample_list if
                         ecg not in ['102-0', 'ANNOTA', 'REC', 'SHA256SUMS', 'mitd', 'x_m']]
    all_samples = np.zeros((len(clean_sample_list), 650000, 2))
    for idx, ecg in enumerate(clean_sample_list):
        record = wfdb.rdrecord(filename + ecg)
        all_samples[idx] = record.p_signal

    return all_samples 
开发者ID:philipperemy,项目名称:n-beats,代码行数:14,代码来源:data.py

示例2: _get_sections

# 需要导入模块: import wfdb [as 别名]
# 或者: from wfdb import rdrecord [as 别名]
def _get_sections(self):
        """Collect continuous normal sinus rhythm sections."""
        # Empty dictionary for NSR sections
        sections = list()

        # Loop through recordings
        for record_id in self.record_ids:

            # Import recording
            record = wfdb.rdrecord(os.path.join(self.raw_path, record_id))

            # Import annotations
            annotation = wfdb.rdann(os.path.join(self.raw_path, record_id), 'atr')

            # Get sample frequency
            fs = record.__dict__['fs']

            # Get waveform
            waveform = record.__dict__['p_signal']

            # labels
            labels = np.array(annotation.__dict__['symbol'])

            # Samples
            sample = annotation.__dict__['sample']

            # Section counter
            section_id = 0

            # Loop through labels
            for start, stop in self._contiguous_regions(labels == 'N'):

                if stop - start >= self.min_labels:
                    sections.append({'label': 'N', 'section': section_id, 'record': record_id, 'fs': fs, 'channel': 1,
                                     'db': self.db_name, 'waveform': waveform[sample[start]:sample[stop - 1], 0]})
                    sections.append({'label': 'N', 'section': section_id, 'record': record_id, 'fs': fs, 'channel': 2,
                                     'db': self.db_name, 'waveform': waveform[sample[start]:sample[stop - 1], 1]})
                    section_id += 1

        return sections 
开发者ID:Seb-Good,项目名称:deepecg,代码行数:42,代码来源:nsrdb.py

示例3: _get_sections

# 需要导入模块: import wfdb [as 别名]
# 或者: from wfdb import rdrecord [as 别名]
def _get_sections(self):
        """Collect continuous arrhythmia sections."""
        # Empty dictionary for arrhythmia sections
        sections = list()

        # Loop through records
        for record_id in self.record_ids:

            # Import recording
            record = wfdb.rdrecord(os.path.join(self.raw_path, record_id))

            # Import annotations
            annotation = wfdb.rdann(os.path.join(self.raw_path, record_id), 'atr')

            # Get sample frequency
            fs = record.__dict__['fs']

            # Get waveform
            waveform = record.__dict__['p_signal']

            # labels
            labels = [label[1:] for label in annotation.__dict__['aux_note']]

            # Samples
            sample = annotation.__dict__['sample']

            # Loop through labels and collect sections
            for idx, label in enumerate(labels):

                if any(label in val for val in list(self.label_dict.keys())):

                    if idx != len(labels) - 1:
                        sections.append({'label': label, 'section': idx, 'record': record_id, 'fs': fs, 'channel': 0,
                                         'db': self.db_name, 'waveform': waveform[sample[idx]:sample[idx + 1], 0]})
                        sections.append({'label': label, 'section': idx, 'record': record_id, 'fs': fs, 'channel': 1,
                                         'db': self.db_name, 'waveform': waveform[sample[idx]:sample[idx + 1], 1]})

                    elif idx == len(labels) - 1:
                        sections.append({'label': label, 'section': idx, 'record': record_id, 'fs': fs, 'channel': 0,
                                         'db': self.db_name, 'waveform': waveform[sample[idx]:, 0]})
                        sections.append({'label': label, 'section': idx, 'record': record_id, 'fs': fs, 'channel': 1,
                                         'db': self.db_name, 'waveform': waveform[sample[idx]:, 1]})

        return sections 
开发者ID:Seb-Good,项目名称:deepecg,代码行数:46,代码来源:afdb.py


注:本文中的wfdb.rdrecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。