Skip to content

Add BIDS-aware EDF loader with metadata checks - #4

Open
mnoergaard wants to merge 1 commit into
legacy_pipelinefrom
codex/add-mne-python-edf-loading-script
Open

Add BIDS-aware EDF loader with metadata checks#4
mnoergaard wants to merge 1 commit into
legacy_pipelinefrom
codex/add-mne-python-edf-loading-script

Conversation

@mnoergaard

Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a reusable helper to load EDF files together with BIDS sidecars and ensure channel metadata is harmonized before preprocessing.
  • Avoid depending on pandas in the test/runtime path by using the stdlib csv reader for _channels.tsv parsing.

Description

  • Add eegprep/workflows/eeg/load.py implementing load_edf_with_bids_metadata which reads the JSON sidecar, reads the channels TSV, loads the EDF via mne, enforces channel count and in-order renaming, maps BIDS type to MNE channel types, checks sampling-rate consistency, assigns a standard montage, and returns (raw, meta, channels).
  • Add tests/test_load.py that verifies successful name/type harmonization and that a mismatch in channel counts raises a ValueError using monkeypatch to stub mne.io.read_raw_edf.
  • Replace an earlier pandas-based TSV read in tests and loader with csv.DictReader to avoid requiring pandas at test/runtime.

Testing

  • Ran pytest -q tests/test_load.py tests/test_preprocess.py which executed the new tests but both were skipped in this environment because mne is not available, resulting in 2 skipped.
  • An earlier test run failed due to missing pandas, which prompted switching TSV handling to the stdlib csv and resolving the collection error.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant