WIP FIX Deprecate use_rounding=False default in time_as_index [circle full]#13848
WIP FIX Deprecate use_rounding=False default in time_as_index [circle full]#13848mathias-sm wants to merge 5 commits intomne-tools:mainfrom
Conversation
`time_as_index` defaulted to truncation (`use_rounding=False`), causing `get_data(tmin=...)` to return different samples from `crop(tmin=...).get_data()` at certain times due to floating-point truncation. Change the default to `None` and rounding. Emits a `FutureWarning` prompting callers to pass `True` or `False` explicitly. The goal of this commit is to estiate the impact of this change; follow-up commit should internally update all use of `time_as_index` to explicitely set a desired default.
|
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴 |
|
I had not realized that so many tests would fail because of the warning and not because of resulting discrepancies in the computation of Thanks |
The goal here is to measure the impact of changing the default value of `use_rounding=False` in time_as_index`, with a FutureWarning deprectation step to warn users. Unfortunately the tests fail hard on seeing said warning so most tests fail but it's not because the underlying behavior has changed, it's because of the warning. This commit removes the warning to see where is the change in behavior surfacing actuall problems.
for more information, see https://pre-commit.ci
|
I went ahead and removed the warning for the time being, so that we can see the impact without having to make changes all over the codebase. It also seems like some CircleCI runs require approval from a maintainer? I could not figure out if there was something I could do on my own. I see this is currently discussed in #13837 -> if it helps I can report that despite linking CirclCI to my github account, I do not see a way around |
|
Update about |
|
As far as I can tell there is only one test failure, in I can see two fixes: either explicitely pass This suggest that there are In the meantime, to see if this is indeed the only place that relied on the truncation behavior in the script, I am going to commit the use of |
Again, in order to check the impact of changing the default value of `use_rounding` in `time_as_index` from False to True, I am providing a (possibly temporary) fix to `mne/io/egi/tests/test_egi.py::test_egi_mff_pause` so that it passes and we can see if there are other downstream issues.
for more information, see https://pre-commit.ci
Reference issue (if any)
Implements the changes suggested in #13634 to estimate the impact of defaulting to truncation to defaulting to rounding when converting time to indices.
What does this implement/fix?
time_as_indexdefaulted to truncation (use_rounding=False), causingget_data(tmin=...)to return different samples fromcrop(tmin=...).get_data()at certain times due to floating-point truncation. Change the default toNoneand rounding. Emits aFutureWarningprompting callers to passTrueorFalseexplicitly. The goal of this commit is to estiate the impact of this change; follow-up commit should internally update all use oftime_as_indexto explicitely set a desired default.Additional information
I have not yet updated all of the internal use of
time_as_index, some of which explicitely use eitheruse_rounding=Falseoruse_rounding=False. Internall calls that do not pass a value foruse_roundingwill emit warnings. This is not ready for merging and is submitted as WIP / as a draft PR to trigger all tests and estimate the impact of this change.