Skip to content

Commit 0e32209

Browse files
committed
address failing tests and feedback
1 parent d7b5e93 commit 0e32209

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

wfdb/io/record.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,15 +2934,15 @@ def wrsamp(
29342934
)
29352935

29362936
# If samps_per_frame is a list, check that it aligns as expected with the channels in the signal
2937-
if len(samps_per_frame) > 1:
2937+
if isinstance(samps_per_frame, list):
29382938
# Get properties of the signal being passed
2939-
non_none_signal = next(signal for signal in signal_list if signal is not None)
2940-
if isinstance(non_none_signal, np.ndarray):
2941-
num_sig_channels = non_none_signal.shape[1]
2942-
channel_samples = [non_none_signal.shape[0]] * non_none_signal.shape[1]
2943-
elif isinstance(non_none_signal, list):
2944-
num_sig_channels = len(non_none_signal)
2945-
channel_samples = [len(channel) for channel in non_none_signal]
2939+
first_valid_signal = next(signal for signal in signal_list if signal is not None)
2940+
if isinstance(first_valid_signal, np.ndarray):
2941+
num_sig_channels = first_valid_signal.shape[1]
2942+
channel_samples = [first_valid_signal.shape[0]] * first_valid_signal.shape[1]
2943+
elif isinstance(first_valid_signal, list):
2944+
num_sig_channels = len(first_valid_signal)
2945+
channel_samples = [len(channel) for channel in first_valid_signal]
29462946
else:
29472947
raise TypeError("Unsupported signal format. Must be ndarray or list of lists.")
29482948

0 commit comments

Comments
 (0)