eegdash.io.fif module#
Read the complete part of a FIF file (or EEGLAB .fdt) cut before the end its header declares.
MNE opens such a file (read_raw_fif scans the tags when the directory at the
end is missing, with the warning “FIF tag directory missing at the end of the
file … possibly corrupted file”) and counts every buffer it found, including
the cut one. Reading that buffer then fails (cannot reshape array of size ...
or buffer size must be a multiple of element size), so the recording was
refused. Seen in deposits where the stored object itself is short (sizes equal
OpenNeuro’s and the NEMAR annex key’s): on004012 sub-19 stim04 and sub-22 stim02,
on004346 sub-01 run-01, each losing its last 1 s.
Only MNE’s public API is used: get_data to find the last sample that reads,
and Raw.crop to drop the rest. Nothing is padded or made up; the recording
comes back shorter than its header says, with a warning that gives the loss.
An EEGLAB .fdt shorter than its .set (ds006554 sub-11/16/29/43: 70-87 % of
pnts, cut inside a sample) fails the same way on its last sample, and the
same crop keeps its complete samples.
- eegdash.io.fif.crop_unreadable_tail(raw)[source]
Crop a FIF or EEGLAB
.fdtraw(preload=False) to the samples it can read.Returns the cropped raw, or
Nonewhenrawreads neither, when its first sample does not read either, or when its last sample reads (nothing to do here: the failure is elsewhere).