Skip to content

Commit

Permalink
Merge branch 'main' into deno
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff authored Sep 20, 2024
2 parents 51064f3 + 1cbcfdd commit a039428
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ jobs:
- name: Install BIDS validator (stable)
if: matrix.bids-validator-version == 'validator-stable'
# XXX: Remove pin once this is solved: https://github.com/bids-standard/bids-validator/issues/2124
run: |
npm install -g bids-validator
npm install -g bids-validator@1.14.10
- name: Install BIDS validator (main-schema)
if: matrix.bids-validator-version == 'validator-main-schema'
Expand Down Expand Up @@ -305,6 +306,8 @@ jobs:
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

build_docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.6.5
hooks:
- id: ruff
name: ruff mne_bids/
Expand Down
21 changes: 12 additions & 9 deletions mne_bids/tests/test_dig.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,30 @@ def test_dig_template(tmp_path):
for datatype in ("eeg", "ieeg"):
(bids_root / "sub-01" / "ses-01" / datatype).mkdir(parents=True)

raw = _load_raw()
raw.pick(["eeg"])
montage = raw.get_montage()
pos = montage.get_positions()

for datatype in ("eeg", "ieeg"):
bids_path = _bids_path.copy().update(root=bids_root, datatype=datatype)
for coord_frame in BIDS_STANDARD_TEMPLATE_COORDINATE_SYSTEMS:
raw = _load_raw()
raw.pick(["eeg"])
bids_path.update(space=coord_frame)
montage = raw.get_montage()
pos = montage.get_positions()
raw.set_montage(None)
_montage = montage.copy()
mne_coord_frame = BIDS_TO_MNE_FRAMES.get(coord_frame, None)
if mne_coord_frame is None:
montage.apply_trans(mne.transforms.Transform("head", "unknown"))
_montage.apply_trans(mne.transforms.Transform("head", "unknown"))
else:
montage.apply_trans(mne.transforms.Transform("head", mne_coord_frame))
_write_dig_bids(bids_path, raw, montage, acpc_aligned=True)
_montage.apply_trans(mne.transforms.Transform("head", mne_coord_frame))
_write_dig_bids(bids_path, raw, _montage, acpc_aligned=True)
electrodes_path = bids_path.copy().update(
task=None, run=None, suffix="electrodes", extension=".tsv"
)
coordsystem_path = bids_path.copy().update(
task=None, run=None, suffix="coordsystem", extension=".json"
)
# _read_dig_bids updates raw inplace
if mne_coord_frame is None:
with pytest.warns(
RuntimeWarning, match="not an MNE-Python coordinate frame"
Expand All @@ -172,8 +176,7 @@ def test_dig_template(tmp_path):
electrodes_path.update(space="fsaverage")
coordsystem_path.update(space="fsaverage")
_read_dig_bids(electrodes_path, coordsystem_path, datatype, raw)
montage2 = raw.get_montage()
pos2 = montage2.get_positions()
pos2 = raw.get_montage().get_positions()
np.testing.assert_array_almost_equal(
np.array(list(pos["ch_pos"].values())),
np.array(list(pos2["ch_pos"].values())),
Expand Down

0 comments on commit a039428

Please sign in to comment.