Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG+1, ENH: Allow creating DigMontage for standard montages #6714

Merged
merged 46 commits into from
Sep 13, 2019

Conversation

massich
Copy link
Contributor

@massich massich commented Aug 27, 2019

This works on #6461, It finds a way to create DigMontages from standard montage kind.

def read_standard_montage(kind: str) -> DigMontage

This could either be a new read_standard_montage or reuse read_montage.

@lgtm-com
Copy link

lgtm-com bot commented Aug 27, 2019

This pull request introduces 2 alerts when merging f9e1c2a into 3e60a9a - view on LGTM.com

new alerts:

  • 2 for Unused import

@codecov
Copy link

codecov bot commented Aug 28, 2019

Codecov Report

Merging #6714 into master will decrease coverage by 0.11%.
The diff coverage is 91.85%.

@@            Coverage Diff             @@
##           master    #6714      +/-   ##
==========================================
- Coverage   89.59%   89.47%   -0.12%     
==========================================
  Files         419      421       +2     
  Lines       75892    75987      +95     
  Branches    12430    12444      +14     
==========================================
- Hits        67994    67992       -2     
- Misses       5102     5176      +74     
- Partials     2796     2819      +23

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2019

This pull request introduces 2 alerts when merging 525ae9d into 751347d - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2019

This pull request introduces 2 alerts when merging dc938e6 into 751347d - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2019

This pull request introduces 5 alerts when merging 59c703c into 17fe113 - view on LGTM.com

new alerts:

  • 3 for Unhashable object hashed
  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2019

This pull request introduces 5 alerts when merging 36b184d into 80471f1 - view on LGTM.com

new alerts:

  • 3 for Unhashable object hashed
  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2019

This pull request introduces 3 alerts when merging 20d1c6f into 80471f1 - view on LGTM.com

new alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 10, 2019

This pull request introduces 3 alerts when merging 2a873ec into 80471f1 - view on LGTM.com

new alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 10, 2019

This pull request introduces 3 alerts when merging 6d14613 into dbed4f6 - view on LGTM.com

new alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Sep 10, 2019

This pull request introduces 4 alerts when merging e858120 into dbed4f6 - view on LGTM.com

new alerts:

  • 3 for Unused import
  • 1 for Variable defined multiple times

@massich
Copy link
Contributor Author

massich commented Sep 11, 2019

I think that make_standard_montage or load_standard_montage is a better name than read_standard_montage.

I like make_standard_montage (just for coorence with make_dig_montage, make_dig_ponints whatever... despite the fact that its actually a loader)

@agramfort
Copy link
Member

agramfort commented Sep 11, 2019 via email

@lgtm-com
Copy link

lgtm-com bot commented Sep 11, 2019

This pull request introduces 1 alert when merging 938fe3e into 13c8e69 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@massich
Copy link
Contributor Author

massich commented Sep 11, 2019

This is the rendered example in the current stage. Only montages without fiducials should be rendered properly. But this is not the case. standards and mghs do render properly which means that those points are already in 'head'. easycap is wierdly off, and HydroCell and biosemi are behaving as expected.

Fixing all this.

@agramfort
Copy link
Member

agramfort commented Sep 11, 2019 via email

@lgtm-com
Copy link

lgtm-com bot commented Sep 11, 2019

This pull request introduces 1 alert when merging 0024040 into 13c8e69 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@massich
Copy link
Contributor Author

massich commented Sep 11, 2019

There is something really funky that I don't understand.

Even for something that is montage.plot() works i.e 'mgh60' the points had not been making sense to me. In the following (from 1e41d1c) I'm plotting several things. The points read from the montage (in unk coord), in blue the transform version of the montage, and in white some points in 0.085 sphere 'cos the sphere uses scale rather than radious and is not calibrated in the plot. (but is useful to see where 0 origin is) in green the transformation.

image

@lgtm-com
Copy link

lgtm-com bot commented Sep 11, 2019

This pull request introduces 1 alert when merging 1e41d1c into 13c8e69 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request introduces 4 alerts when merging bbb7c08 into e16d112 - view on LGTM.com

new alerts:

  • 3 for Unhashable object hashed
  • 1 for Module-level cyclic import

@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request fixes 3 alerts when merging 3cd7ca0 into 8cc11b5 - view on LGTM.com

fixed alerts:

  • 3 for Unhashable object hashed

@massich
Copy link
Contributor Author

massich commented Sep 12, 2019

let's see if I can clear my thoughts,

Despite the fact that plot_montage.py renders properly [missing-link], The channel locations are not proper because transforming something that is already in head, leads to points that are no longer in the sphere. Check the following (as before original montage is in red, and transformed montage in blue):

for kind in [
    'GSN-HydroCel-128',
    'biosemi128',
    'mgh60',
    'standard_1005',
]:

    montage = make_standard_montage(kind)
    trf_montage = transform_to_head(montage)

    _plot_dig_transformation(trf_montage, montage, title=kind)

image

@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request introduces 1 alert and fixes 3 when merging 0252dd3 into 8cc11b5 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

fixed alerts:

  • 3 for Unhashable object hashed

@massich
Copy link
Contributor Author

massich commented Sep 12, 2019

Another way of seeing it (head on the left, unk on the right):
image

image

@massich massich mentioned this pull request Sep 12, 2019
@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request introduces 1 alert and fixes 3 when merging 31405e8 into 8cc11b5 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

fixed alerts:

  • 3 for Unhashable object hashed

@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request introduces 1 alert when merging c71ebf3 into 8cc11b5 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@lgtm-com
Copy link

lgtm-com bot commented Sep 12, 2019

This pull request introduces 1 alert when merging 52ad108 into 812f8c4 - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@agramfort agramfort marked this pull request as ready for review September 13, 2019 08:37
@@ -959,14 +949,38 @@ def test_set_montage():
raw = read_raw_fif(fif_fname)
orig_pos = np.array([ch['loc'][:3] for ch in raw.info['chs']
if ch['ch_name'].startswith('EEG')])
raw.set_montage('mgh60') # test loading with string argument
with pytest.deprecated_call():
raw.set_montage('mgh60') # test loading with string argument
Copy link
Member

Choose a reason for hiding this comment

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

this should still work but via the DigMontage route

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@massich
Copy link
Contributor Author

massich commented Sep 13, 2019

Here is the rendered version of the example. Maybe we want to add couple words of why the points look a bit off some times. But this can be done later.

https://15297-1301584-gh.circle-artifacts.com/0/dev/auto_examples/visualization/plot_montage.html#sphx-glr-auto-examples-visualization-plot-montage-py

massich added a commit to massich/mne-python that referenced this pull request Sep 13, 2019
@massich massich changed the title ENH: Allow creating DigMontage for standard montages MRG+1, ENH: Allow creating DigMontage for standard montages Sep 13, 2019
@massich
Copy link
Contributor Author

massich commented Sep 13, 2019

@agramfort suggested IRL to merge this one. There #6764 #6765 should follow this one, and maybe allow to register the standard montages.

@massich massich merged commit e99226e into mne-tools:master Sep 13, 2019
@massich massich deleted the deprecate_montage branch September 13, 2019 13:52
alexrockhill pushed a commit to alexrockhill/mne-python that referenced this pull request Oct 1, 2019
…s#6714)

Adds `make_standard_montage(kind: str) -> DigMontage`; note: `'kind'` has to be valid builtin standard montage and `DigMontage` is in `'head'`
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.

2 participants