Repository navigation
MRG: Add copy param to iter_evoked - #7164
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7164 +/- ##
==========================================
- Coverage 89.76% 89.75% -0.01%
==========================================
Files 444 444
Lines 79352 79353 +1
Branches 12683 12683
==========================================
- Hits 71228 71227 -1
- Misses 5342 5344 +2
Partials 2782 2782 |
|
I think this could be set to Line 547 in 1325c1a |
|
I am sure you've thought about this, but the iteration over the data array returns views, correct - and if the evoked objects' data are modified in-place, the original data does not change, right? |
It will change. So if |
| info = self.info | ||
| if copy: | ||
| info = deepcopy(self.info) | ||
| data = data.copy() |
There was a problem hiding this comment.
@larsoner are you sure there was not a copy already before? This now may change old behavior so could be an API change
There was a problem hiding this comment.
Arguably then it’d be a bugfix
There was a problem hiding this comment.
The data was not copied before, it was a view. So on master data is not copied, but info is copied. This is inconsistent and should be fixed. The current version of this PR fixes it so either info and data are copied, or neither are.
My vote would be to have copy=False as the default, since that was closest to what was being done before in terms of the data, which is probably what most users think about. But I doubt the number of people doing in-place modifications with an iter_evoked is quite small.
|
maybe :)
|
05d08d5 to
f6ef572
Compare
|
well it was only a view if you have preloaded data :(
I just switch default to copy=False and we're good?
… |
|
Yeah I think so |
|
thx @larsoner @jona-sassenhagen for the reviews ! |
* add copy param to iter_evoked. fix mne-tools#6250 * fix * FIX: Flake and data copy * update latest.inc * change default Co-authored-by: Eric Larson <[email protected]>
* add copy param to iter_evoked. fix mne-tools#6250 * fix * FIX: Flake and data copy * update latest.inc * change default Co-authored-by: Eric Larson <[email protected]>
closes #6250
cc @jona-sassenhagen