Closed gael-vanderlee closed 3 months ago
Do you get a warning from MNE about padding? If so, this should be fixed with https://github.com/mne-tools/mne-python/pull/12676. Until this is released, you can manually set physical_range
in MNE's export function.
I can do a little bit more explanation here. Like @hofaflo mentioned if you see a padding warning like this:
EDF format requires equal-length data blocks, so XX seconds of zeros were appended to all channels when writing the final block.
it's a bug from MNE rather than edfio. The error is there because your data length is not a multiple of the sampling rate, and MNE tries to pad zeroes to the end. However your original data range ([0.003053998779296875, 0.04780600390625]) does not include zero, thus triggering the error.
The dev version of MNE no longer pads data with zero but the edge values (i.e. the last available number) so the padded data is always within the original range.
A temporary workaround is to manually specify the physical range when using mne.export.export_raw
physical_range = [0, raw.get_data(units='uV').max()]
raw.export(fname, physical_range=physical_range)
Ah yes I did have those warnings, which I suppressed because MNE gives me warnings for everything lol. I understand the issue now, thank you for taking the time to explain it. Your solution worked. I'm closing the issue.
Hello, I'm a bit lost here as this used to run fine. I have a script that converts raw EEG recordings to BIDS format using MNE python. Recently it asked me to install edfio to write my files as edf, fine. I install this but now on export I get the following error:
ValueError: Signal range [0.0, 0.026120599609374996] out of physical range: [0.003053998779296875, 0.04780600390625]
It exported fine before, I thought it was a unit problem (I believe my data is in uV instead of V). I converted the data to V and still get this error. I don't really understand what it means and what I can do about it. Any pointers ?
Thanks