eegdash.header_check module#

Consistency checks on the EDF/BDF channel headers of a BIDS dataset.

Only headers are read: from local files, or as byte ranges of NEMAR objects, so a whole dataset is checked without downloading its signals. The checks:

  • unit: a channel’s header unit differs across recordings;

  • sidecar: a header unit is another quantity than channels.tsv says;

  • range: a channel reads at an implausible scale for its quantity;

  • prefix (minor): header and channels.tsv differ by an SI prefix only.

MNE scales samples by the header unit and ignores channels.tsv, so the first three flag channels that a reader gets at the wrong scale. Run:

python -m eegdash.header_check nm000281 [--local ROOT] [--max-per-subject N]
class eegdash.header_check.Channel(name: 'str', unit: 'str', physical_min: 'float', physical_max: 'float')[source]

Bases: object

name: str
physical_max: float
physical_min: float
unit: str
class eegdash.header_check.Finding(check: 'str', channel: 'str', message: 'str', files: 'tuple[str, ...]')[source]

Bases: object

channel: str
check: str
files: tuple[str, ...]
message: str
eegdash.header_check.check(recordings: dict[str, tuple[list[Channel], dict[str, str]]]) → list[Finding][source]

Findings over path -> (header channels, channels.tsv units).

eegdash.header_check.header_size(main: bytes) → int[source]

Bytes of the full header, from the 256-byte main header.

eegdash.header_check.main(argv=None)[source]
eegdash.header_check.nemar_files(dataset_id: str) → list[str][source]

Every file path of a NEMAR dataset, one subtree at a time when GitHub truncates the recursive listing (large datasets).

eegdash.header_check.parse_header(buf: bytes) → list[Channel][source]

Channels of an EDF/BDF header (main and signal headers).

eegdash.header_check.read_local(root: Path, max_per_subject: int | None = None)[source]

path -> (channels, sidecar units) for the EDF/BDF files under root.

eegdash.header_check.read_nemar(dataset_id: str, max_per_subject: int | None = None, workers: int = 32)[source]

Same as read_local() for a NEMAR dataset, from header byte ranges.

eegdash.header_check.sidecar_units(tsv: str) → dict[str, str][source]

name -> units from a channels.tsv.

eegdash.header_check.summarize(findings: list[Finding]) → str[source]

One line per (check, message), with how many channels and files share it.