Skip to content

Plot image public - #6078

Closed
jona-sassenhagen wants to merge 5 commits into
mne-tools:mainfrom
jona-sassenhagen:plot_image_public
Closed

jona-sassenhagen wants to merge 5 commits into
mne-tools:mainfrom
jona-sassenhagen:plot_image_public

Conversation

@jona-sassenhagen

@jona-sassenhagen jona-sassenhagen commented Mar 23, 2019 •

Copy link
Copy Markdown
Contributor

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

Keynote coding!

@codecov

codecov Bot commented Mar 24, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #6078 into master will decrease coverage by 1.63%.
The diff coverage is 40%.

@@            Coverage Diff             @@
##           master    #6078      +/-   ##
==========================================
- Coverage   88.98%   87.35%   -1.64%     
==========================================
  Files         402      402              
  Lines       73171    73182      +11     
  Branches    12156    12159       +3     
==========================================
- Hits        65112    63925    -1187     
- Misses       5184     6411    +1227     
+ Partials     2875     2846      -29

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

An issue I came across here (and what makes the tests fail) is that we currently allow images with only one row (i.e., single-channel). Which is better:

  • error on one-row images
  • add a special case for one-row images

@agramfort

Copy link
Copy Markdown
Member

Personally I prefer to advertise matplotlib here. We cannot reinvent everything.

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

The motivation is that good masked and/or contoured images require non-trivial code, see

@agramfort

agramfort commented Mar 25, 2019 via email

Copy link
Copy Markdown
Member

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

No, it only somewhat simplifies the example.

We could use it for an example where we threshold a GAT matrix by statistical significance though, which would become much easier with this. I can draft something like this - maybe as a tutorial under the stats section.

Comment thread mne/viz/utils.py
# imshow for linear because the y ticks are nicer
# and the masked areas look better
extent = [times[0], times[-1], yvals[0], yvals[-1] + 1]
top_bound = yvals[-1] + (yvals[-1] - yvals[-2])

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.

This will break if there are not at least two entries in yvals (and same below for times), the old code would not.

Granted, the old code would throw a mpl warning about not being able to set the bounds properly (or at least set_xlim and set_ylim do), but this code will throw an error, and it probably shouldn't. It should be acceptable to show an image with a single row (or col).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, sure.

@agramfort

agramfort commented Mar 26, 2019 via email

Copy link
Copy Markdown
Member

@SageBoettcher

Copy link
Copy Markdown

As an MNE user who usually bugs @jona-sassenhagen with lots of questions Id really like to see this implemented. I've bee using the GAT functions a lot recently and have been looking for an easy way of masking significance

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

I honestly think the np.kron thing we do here (either @cbrnr or @mmagnuski did this IIRC? or maybe Chris) is hard to figure out by yourself. Everyone can ax.imshow, but the contour and masking and ... is harder!

@mmagnuski

Copy link
Copy Markdown
Member

IIRC you added the np.kron Jona! :) I actually use my old "cluster-crawler" for contours (overly complicated code here).

@cbrnr

cbrnr commented Mar 27, 2019

Copy link
Copy Markdown
Contributor

I just had to google np.kron so it definitely wasn't me 😄. Anyway, I don't really understand the problem here, if we include this in our public API then people are still not forced to use it. The only thing this adds is maintenance and commitment, which would not be the case if we leave it private. I'm +-0 on it.

@agramfort

Copy link
Copy Markdown
Member

ok let's say I am +0 to make this function public. Where do you expose this to users in the doc?

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

ok let's say I am +0 to make this function public. Where do you expose this to users in the doc?

One option would be to add a section on statistics for GAT.

@agramfort

agramfort commented Apr 2, 2019 via email

Copy link
Copy Markdown
Member

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

Yes, maybe on the KWord dataset with its 960 epochs ... Actually, do we really not have any inference on decoding?

@agramfort

agramfort commented Apr 3, 2019 via email

Copy link
Copy Markdown
Member

Base automatically changed from master to main January 23, 2021 18:26
@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

Yeah probably not gonna implement this after all unless there is demand :)

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.

Make _plot_image public

6 participants