Repository navigation
Commit c2b9ca1
[FIX] ASR: init clean_windows rejection masks before one-sided zthresholds
mask1 and mask2 in clean_windows were only assigned inside their
respective `if np.max(zthresholds) > 0` / `if np.min(zthresholds) < 0`
branches, but combined unconditionally via
`np.logical_or.reduce((mask1, mask2, mask3))`. Since zthresholds is a
documented, user-facing parameter, passing a one-sided value (e.g.
[1, 2] or [-5, -1]) skips one branch and raises UnboundLocalError. The
default [-3.5, 5] straddles 0 so both branches run, keeping the bug
latent.
Fix: initialize both masks to all-False (matching the EEGLAB/BCILAB
reference behavior of flagging no windows by default) before the
conditionals, so each criterion that isn't evaluated simply rejects no
windows instead of being undefined.
Added a regression test exercising clean_windows with both one-sided
directions of zthresholds on the eeg_raw.npy fixture.1 parent 6b107c9 commit c2b9ca1
2 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
364 | 366 | | |
365 | 367 | | |
366 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
192 | 215 | | |
193 | 216 | | |
194 | 217 | | |
| |||
0 commit comments