You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FIX: Make brainvision overrides robust to missing header keys; cover all spec-required keys
The override branches called cfg.get(..., key) purely to log the original
header value before announcing the override; that lookup raised
NoOptionError exactly in the case the override was meant to recover from.
Wrap the log-only lookups (DataFile, MarkerFile, NumberOfChannels) and the
required SamplingInterval lookup in _aux_hdr_info so the override actually
takes effect when the header lacks the key.
Extend overrides to every spec-required header key with three new options:
data_orientation ([Common Infos] DataOrientation), data_format ([Common
Infos] DataFormat), and binary_format ([Binary Infos] BinaryFormat).
Treat a missing or empty MarkerFile= entry as "no markers" (per the BV
Core Data Format spec, MarkerFile= is optional).
Collapse the six per-key override+log+fallback blocks behind one _hdr_get
helper, and refactor _validate_overrides into three dispatch tables
(type / range / enum) plus the two genuinely irregular cases
(marker_fname=False sentinel, ch_names per-element + uniqueness).
Tests: parametrize test_overrides_recover_missing_header_keys across all
seven file-/header-key keys; add validation cases for the three new enum
keys; add test_empty_marker_file_means_no_markers for the spec-compliant
empty-MarkerFile= path.
Add ``overrides`` parameter to :func:`mne.io.read_raw_brainvision` for reading non-spec-compliant ``.vhdr`` files where the header contradicts the actual layout (e.g. renamed BIDS siblings, missing ``MarkerFile=``, truncated ``[Channel Infos]``). Accepts a dict with keys ``data_fname``, ``marker_fname``, ``n_channels``, ``sfreq``, ``ch_names``, and ``units_fallback``; see the function docstring for details, by `Bruno Aristimunha`_.
1
+
Add ``overrides`` parameter to :func:`mne.io.read_raw_brainvision` for reading non-spec-compliant ``.vhdr`` files where the header contradicts the actual layout (e.g. renamed BIDS siblings, missing ``MarkerFile=``, truncated ``[Channel Infos]``). Accepts a dict with keys ``data_fname``, ``marker_fname``, ``n_channels``, ``sfreq``, ``ch_names``, ``units_fallback``, ``data_orientation``, ``data_format``, and ``binary_format``; see the function docstring for details. Missing or empty ``MarkerFile=`` is now also tolerated natively (per the BV Core Data Format spec) by `Bruno Aristimunha`_.
0 commit comments