Commit 1b9c90c
Benjamin Moody
rdrecord: handle smooth_frames when maximum spf is 1.
rdrecord can return signal data in any of four formats:
- by resampling all signals to a uniform rate ("smoothing"), and
setting d_signal to a two-dimensional array, where d_signal[t,s] is
sample t of signal s
- by resampling to a uniform rate, and setting p_signal to a
two-dimensional array, where p_signal[t,s] is sample t of signal s
converted into physical units
- by setting e_d_signal to a list of one-dimensional arrays, where
e_d_signal[s][t] is sample t of signal s
- by setting e_p_signal to a list of one-dimensional arrays, where
e_p_signal[s][t] is sample t of signal s converted into physical
units
If the selected signals contain multiple samples per frame, the
behavior of rdrecord is consistent:
- If smooth_frames is True, the selected signals are resampled to the
frame rate and stored as d_signal or p_signal.
- If smooth_frames is False, the selected signals are stored in their
original form as e_d_signal or e_p_signal.
However, if each of the selected signals contains only one sample per
frame, rdrecord would previously behave inconsistently:
- If all signals in the record contain only one sample per frame, and
smooth_frames is False and physical is True, the selected signals
would be stored as p_signal (not e_p_signal as the caller would
expect.)
- If all signals in the record contain only one sample per frame, and
smooth_frames is False and physical is False, rdrecord would crash
with a TypeError in convert_dtype.
- If some signals in the record contain multiple samples per frame
(but the selected signals don't), rdrecord would crash with an
AttributeError in _arrange_fields.
Change this behavior so that if smooth_frames is false, rdrecord will
always store the signals as e_d_signal or e_p_signal, regardless of
the underlying number of samples per frame.1 parent 3e84119 commit 1b9c90c
1 file changed
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3363 | 3363 | | |
3364 | 3364 | | |
3365 | 3365 | | |
3366 | | - | |
3367 | | - | |
3368 | | - | |
3369 | | - | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
3370 | 3369 | | |
3371 | 3370 | | |
3372 | 3371 | | |
| |||
3535 | 3534 | | |
3536 | 3535 | | |
3537 | 3536 | | |
3538 | | - | |
| 3537 | + | |
3539 | 3538 | | |
3540 | 3539 | | |
3541 | 3540 | | |
| |||
0 commit comments