|
27 | 27 |
|
28 | 28 | # ruff: noqa: E402 |
29 | 29 | import mne |
30 | | -from mne import Epochs, pick_types, read_events |
| 30 | +from mne import Epochs, create_info, make_fixed_length_epochs, pick_types, read_events |
| 31 | +from mne._fiff.constants import FIFF |
31 | 32 | from mne.channels import read_layout |
32 | 33 | from mne.coreg import create_default_subject |
33 | 34 | from mne.datasets import testing |
34 | 35 | from mne.fixes import _compare_version, has_numba |
35 | | -from mne.io import read_raw_ctf, read_raw_fif, read_raw_nirx, read_raw_snirf |
| 36 | +from mne.io import RawArray, read_raw_ctf, read_raw_fif, read_raw_nirx, read_raw_snirf |
36 | 37 | from mne.stats import cluster_level |
37 | 38 | from mne.utils import ( |
38 | 39 | Bunch, |
@@ -546,6 +547,47 @@ def _bias_params(evoked, noise_cov, fwd): |
546 | 547 | return evoked, fwd, noise_cov, data_cov, want |
547 | 548 |
|
548 | 549 |
|
| 550 | +@pytest.fixture |
| 551 | +def triaxial_raw(): |
| 552 | + """Create a small triaxial OPM raw for regression tests.""" |
| 553 | + ch_names = ["OPM001", "OPM002", "OPM003", "OPM004", "OPM005", "OPM006"] |
| 554 | + info = create_info(ch_names, 1000.0, ch_types="mag") |
| 555 | + positions = np.array( |
| 556 | + [ |
| 557 | + [0.03, 0.00, 0.05], |
| 558 | + [0.03, 0.00, 0.05], |
| 559 | + [0.03, 0.00, 0.05], |
| 560 | + [-0.03, 0.00, 0.05], |
| 561 | + [-0.03, 0.00, 0.05], |
| 562 | + [-0.03, 0.00, 0.05], |
| 563 | + ] |
| 564 | + ) |
| 565 | + orientations = np.array( |
| 566 | + [ |
| 567 | + [0.5145, 0.0000, 0.8575], |
| 568 | + [0.0000, 1.0000, 0.0000], |
| 569 | + [0.0000, 0.0000, 1.0000], |
| 570 | + [-0.5145, 0.0000, 0.8575], |
| 571 | + [0.0000, 1.0000, 0.0000], |
| 572 | + [0.0000, 0.0000, 1.0000], |
| 573 | + ] |
| 574 | + ) |
| 575 | + with info._unlock(): |
| 576 | + for idx, ch in enumerate(info["chs"]): |
| 577 | + ch["coil_type"] = FIFF.FIFFV_COIL_FIELDLINE_OPM_MAG_GEN1 |
| 578 | + ch["loc"][:3] = positions[idx] |
| 579 | + ch["loc"][9:12] = orientations[idx] |
| 580 | + rng = np.random.default_rng(0) |
| 581 | + data = rng.standard_normal((len(ch_names), 2000)) |
| 582 | + return RawArray(data, info, verbose="error") |
| 583 | + |
| 584 | + |
| 585 | +@pytest.fixture |
| 586 | +def triaxial_evoked(triaxial_raw): |
| 587 | + """Create a small triaxial OPM evoked for regression tests.""" |
| 588 | + return make_fixed_length_epochs(triaxial_raw).average() |
| 589 | + |
| 590 | + |
549 | 591 | @pytest.fixture |
550 | 592 | def garbage_collect(): |
551 | 593 | """Garbage collect on exit.""" |
|
0 commit comments