Skip to content

MRG: Actually do projection - #2734

Merged
larsoner merged 6 commits into
mne-tools:masterfrom
larsoner:epochs-fix
Dec 22, 2015
Merged

larsoner merged 6 commits into
mne-tools:masterfrom
larsoner:epochs-fix

Conversation

@larsoner

Copy link
Copy Markdown
Member

@agramfort it's probably good to take a look at this one now, esp. how test_epochs.py had to be changed. Writing out EpochsArray and reading it back by default will have avg ref added and applied.

The least intrusive change might actually be to have add_eeg_ref=False in read_epochs. If people have been using FIF, they've presumably already added the ref by that stage (during Epochs construction), and it avoids breaking people's EpochsArray use.

Comment thread mne/epochs.py

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were silently always adding an EEG ref before but not applying it (whoops). So we could consider this a bug fix...?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we clearly document it in the what's new fine with me.

@larsoner
larsoner force-pushed the epochs-fix branch 3 times, most recently from 4e492f3 to 00df286 Compare December 21, 2015 20:13
Comment thread mne/source_space.py Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for deprecated use of indices in ravel, can split into a different PR if necessary, but both are needed for 0.11

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh never mind I'll move it...

@larsoner larsoner added this to the 0.11 milestone Dec 21, 2015
@larsoner larsoner changed the title FIX: Actually do projection MRG: Actually do projection Dec 21, 2015
@larsoner

Copy link
Copy Markdown
Member Author

Ready for review/merge from my end. Once this is in, #2676 should work okay with add_eeg_ref options, whatever those may be. My vote has actually changed to not add the add_eeg_ref argument at all, since users with this PR can do epochs.add_eeg_ref() afterward if they want.

@agramfort

Copy link
Copy Markdown
Member

@jasmainak how does this look to you?

@jasmainak

Copy link
Copy Markdown
Member

Looks like we have failing tests. I check carefully tomorrow ..

@larsoner

Copy link
Copy Markdown
Member Author

Fixing now

@larsoner

Copy link
Copy Markdown
Member Author

@jasmainak let me know if this is good for you. This and your PR are the only things holding up release I think.

@jasmainak

Copy link
Copy Markdown
Member

I rebased this onto my PR and it works like a charm @Eric89GXL :)

Comment thread mne/tests/test_epochs.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, you shouldn't get an error here if preload was False?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the preload state shouldn't matter

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want me to test that case, too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah maybe, I thought projs were applied during get_data() if preload was False ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be that projs are applied during get_data() if proj=True regardless of preload state. Preload state should never change what you get from get_data, if it does there is a bug with our preloading logic. I'll add a test though to be sure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if preload=True the proj is applied a second time during get_data()? I guess it doesn't matter? You can apply the same proj as many times, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I guess you check if the proj is active before applying it ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if preload=True the proj is applied a second time during get_data()

I think now it only is done that way if add_eeg_ref=True and there wasn't one before. But yes reapplying shouldn't matter (as long as all channels are present, but that's a separate issue)

@larsoner

Copy link
Copy Markdown
Member Author

@jasmainak comments addressed, only last commit is new. Can you have one last look to make sure you're happy? If so I'll merge once the CIs come back happy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so will this throw an error if proj has not been applied but is added and the user is trying to change the channel type?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay thanks for clarifying.

LGTM +1 for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants