BEL-Public / mffpy

Reader and Writer for Philips' MFF file format.
Other
10 stars 7 forks source link

Fix(rawbinFile): error when reading from incomplete block #96

Closed jusjusjus closed 2 years ago

jusjusjus commented 2 years ago

The file that i'm analyzing is "SWS_Pilot_001_20190126_220736.mff". At the end of the file are blocks have too few bytes, which causes a ValueError. This PR fixes the problem. On the downside, mffpy is now silent when reading from broken files, and the data that one requests might not be consistent with the data that is returned.

jusjusjus commented 2 years ago

I think this is a good way to handle incomplete blocks. I wasn't able to replicate the original error with SWS_Pilot_001_20190126_220736.mff. @jusjusjus, are you sure you are using the source data for this recording?

I don't know. it's what I downloaded a few years back. Appended, you'll find the checksums:

SWS_Pilot_001_20190126_220736.mff$ md5sum *
md5sum: Contents: Is a directory
b4196bed5e374e71e586132384222c19  coordinates.xml
md5sum: @eaDir: Is a directory
d5c8ffd8d51ea320a027a41e66098a6c  epochs.xml
632e5c65865de9d02871501439488e40  Events_User Markup.xml
34652178f66366982cb2e7b3effc9a35  info1.xml
0ea985eed638420eb9e040dea2668905  info.xml
5d0196405810d28689d9dbaf281f7578  lastSettings.xml
d41d8cd98f00b204e9800998ecf8427e  _launchMFF.lch
44bd056966b65559c3139d44fdd0a438  log_001_20190126_220736.txt
2f196763103907277d3e2dd0003de46a  recordingSettings.xml
d39dd047252ca1bc8c9095758779d0e6  sensorLayout.xml
ea94bd37d7f8fb83aa46137fa3f03f2c  signal1.bin
ephathaway commented 2 years ago

I don't know. it's what I downloaded a few years back. Appended, you'll find the checksums:

Ooh, yeah that is different than what I get for the source data file:

evanh@Minerva:/volume1/BEL_Studies/Slow_Wave_Sleep/Pilot_1/EEG_Source/SWS_Pilot_001_20190126_220736.mff$ md5sum signal1.bin 
7737f9d140af1996b0c5479cc9d12d8c  signal1.bin

I wonder if it got corrupted during download. I think it's safe to say that any MFF with incomplete blocks is broken. I've never encountered any like that.