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
{{ message }}
Repository navigation
meas_date is guessed during I/O when it is None #7067
It seems that the meas_date is not saved / read in correctly. There seems to be a regression of issue #4949 with latest master. Here is the code to reproduce:
Git bisect tells me it stopped working after #5255:
1aea53a5e7b67ed82fa78c3fcf80d954bdf99a23 is the first bad commit
commit 1aea53a5e7b67ed82fa78c3fcf80d954bdf99a23
Author: Luke Bloy <[email protected]>
Date: Fri Jul 20 04:20:45 2018 -0400
[MRG+1] CTF support for ds bad channels and bad segments (#5255)* CTF support for ds bad channels and bad segments
I agree with no guessing. Note that while it was broken before, didn't we fix it in #4990? Now looking at the diff I'm not so sure if we added a test to check that or prevent a future regression. Thanks for making the PR to fix it!
# Make the most appropriate selection for the measurement id
ifmeas_info['parent_id'] isNone:
ifmeas_info['id'] isNone:
ifmeas['id'] isNone:
ifmeas['parent_id'] isNone:
info['meas_id'] =info['file_id']
else:
info['meas_id'] =meas['parent_id']
else:
info['meas_id'] =meas['id']
else:
info['meas_id'] =meas_info['id']
else:
info['meas_id'] =meas_info['parent_id']
the meas_id gets found and set to to DATE_NONE
When writing the meas_id to the meas_info fiff tree, I could set the meas_id = DATA_NONE if meas_date is None.
Do nothing. This issue indicates that meas_date and meas_id are out of sync (ie anonymized not through anonymise_info) and maybe its not surprising to get strange results?
Finally, I think that only case 1 would preserve round trip IO of both meas_date and meas_id in a situation where meas_date = NONE and meas_id != DATE_NONE. The other options will all guess one from the other in some way.
Activity
agramfort commentedon Nov 16, 2019
it was working with 0.19 ?
jasmainak commentedon Nov 16, 2019
Looks like @bloyl is the culprit :)
Git bisect tells me it stopped working after #5255:
bloyl commentedon Nov 17, 2019
To be fair the guessing
mne-python/mne/io/meas_info.py
Lines 1229 to 1233 in ef7d7c1
is from 2010. :)
All #5255 does is to ensure the
info['meas_id']round trips through io.mne-python/mne/io/meas_info.py
Lines 1300 to 1302 in ef7d7c1
So for a non anonymized info object (meas_date==None, but meas_id != DATE_NONE) the info doesn't round trip.
I think there are two reasonable fixes.
info['meas_date'] is Nonethen writeDATE_NONEmeas_datefrommeas_idjasmainak commentedon Nov 17, 2019
I agree with no guessing. Note that while it was broken before, didn't we fix it in #4990? Now looking at the diff I'm not so sure if we added a test to check that or prevent a future regression. Thanks for making the PR to fix it!
bloyl commentedon Nov 17, 2019
Potential Fixes
During Reading don't guess meas_date from meas_id. This is here.
mne-python/mne/io/meas_info.py
Lines 1229 to 1230 in ef7d7c1
I don't really know why this behavior was desirable but I'm sure it was/is for something.
Stop writing the
meas_iddirectly in themeas_infotree of the fiff. This would revert to pre [MRG+1] CTF support for ds bad channels and bad segments #5255 behavior. we'd also have to remove some of the testing that was added to [MRG+1] CTF support for ds bad channels and bad segments #5255. This would work because somewhere in here:mne-python/mne/io/meas_info.py
Lines 1211 to 1224 in ef7d7c1
the
meas_idgets found and set to toDATE_NONEWhen writing the
meas_idto the meas_info fiff tree, I could set themeas_id = DATA_NONEifmeas_date is None.Do nothing. This issue indicates that
meas_dateandmeas_idare out of sync (ie anonymized not throughanonymise_info) and maybe its not surprising to get strange results?Finally, I think that only case 1 would preserve round trip IO of both
meas_dateandmeas_idin a situation wheremeas_date = NONEandmeas_id != DATE_NONE. The other options will all guess one from the other in some way.;----
I should note that removing
mne-python/mne/io/meas_info.py
Lines 1229 to 1230 in ef7d7c1
pass IO tests.
So whatever it's original need was it isn't explicitly tested for :)