Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def process_data(filename):
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
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']
def process_data(filename):
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
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']
def process_data(filename):
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