Repository navigation
Commit 6b107c9
[MAINT] ASR: fit_eeg_distribution docstring fixes + asr_calibrate input guards (#121)
A small bundle of documentation and defensive-hardening fixes:
- **`fit_eeg_distribution` docstring:** the `min_clean_fraction` /
`max_dropout_fraction` default values were transposed relative to the
signature (`0.25` / `0.1`); corrected. Also `X` was described as a 2-D
`(n_channels, n_samples)` array, but the function operates on a **1-D**
vector of amplitude values (it does `np.sort(X); n=len(X)`) —
description fixed.
- **`asr_calibrate` non-finite guard:** a `NaN`/`Inf` in the calibration
data previously propagated silently through the filter into `M`/`T` (an
all-`NaN` threshold, no error). Non-finite samples are now zeroed before
filtering so calibration degrades gracefully.
- **`asr_calibrate` insufficient-data guards:** raise a clear
`ValueError` when the calibration data is too short to form one analysis
window, or yields fewer than two threshold-estimation windows — instead
of an obscure downstream error.
### Testing
Adds tests that non-finite calibration input yields finite `M`/`T`, and
that too-short calibration raises a clear `ValueError`. Full
`tests/test_asr.py` + `tests/test_cov.py` pass; `ruff` clean.
---
**Note:** includes the `nonlinear_eigenspace` reproducibility fix from
#118 so the riemann CI test is stable regardless of what this PR
changes. Once #118 merges first, that commit drops out on rebase.
Co-authored-by: Nicolas Barascud <10333715+nbara@users.noreply.github.com>1 parent d2f4494 commit 6b107c9
3 files changed
Lines changed: 40 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
493 | 496 | | |
494 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
495 | 502 | | |
496 | 503 | | |
497 | 504 | | |
| |||
510 | 517 | | |
511 | 518 | | |
512 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
513 | 525 | | |
514 | 526 | | |
515 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
279 | 302 | | |
280 | 303 | | |
281 | 304 | | |
| |||
0 commit comments