Skip to content

Commit 408ad93

Browse files
authored
Merge pull request #318 from MIT-LCP/optimize-non-smooth
Optimize smooth_frames=False
2 parents 5bb2e3c + 76a03b3 commit 408ad93

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

wfdb/io/_signal.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,13 @@ def _rd_dat_signals(file_name, dir_name, pn_dir, fmt, n_sig, sig_len,
11931193
# List of 1d numpy arrays
11941194
signal = []
11951195
# Transfer over samples
1196+
sig_frames = sig_data.reshape(-1, tsamps_per_frame)
1197+
ch_start = 0
11961198
for ch in range(n_sig):
1197-
# Indices of the flat signal that belong to the channel
1198-
ch_indices = np.concatenate([np.array(range(samps_per_frame[ch]))
1199-
+ sum([0] + samps_per_frame[:ch])
1200-
+ tsamps_per_frame * framenum for framenum in range(int(len(sig_data)/tsamps_per_frame))])
1201-
signal.append(sig_data[ch_indices])
1199+
ch_end = ch_start + samps_per_frame[ch]
1200+
ch_signal = sig_frames[:, ch_start:ch_end].reshape(-1)
1201+
signal.append(ch_signal)
1202+
ch_start = ch_end
12021203
# Skew the signal
12031204
signal = _skew_sig(signal, skew, n_sig, read_len, fmt, nan_replace, samps_per_frame)
12041205

0 commit comments

Comments
 (0)