Repository navigation
WIP: Tfr plot joint - #4981
WIP: Tfr plot joint#4981
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4981 +/- ##
==========================================
+ Coverage 87.92% 87.92% +<.01%
==========================================
Files 356 356
Lines 63677 63863 +186
Branches 10882 10935 +53
==========================================
+ Hits 55989 56154 +165
- Misses 4923 4938 +15
- Partials 2765 2771 +6 |
|
Ready for reviews. @mmagnuski ? |
|
@jona-sassenhagen I'd be happy to review, but unfortunatelly won't have time before wednesday or tuesday. :( |
|
Errrr I fucked up something with MEG. Not yet ready for review. |
|
Here is an example: |
|
would it be possible to squares around the the TF region used for averaging?
|
|
Yes, I've thought about that. Would allow us to skip the text at the top. I'm willing to do it, but I'd prefer to finish up and merge this first, and do squares in a second PR? I tend to get lost in long PRs. |
|
ok fair enough
|
| #################### | ||
|
|
||
| # find and/or setup timefreqs | ||
| try: # There are a trillin ways for this to go wrong ... |
There was a problem hiding this comment.
@agramfort are you ok with this try/except?
There was a problem hiding this comment.
not really. You shoudl have a simple private auxilary function that does the checks on types, dims and values.
There was a problem hiding this comment.
Here is one error case I'm not sure about how to check without a try: if timefreqs is a non-iterable. There's a ton of iterables. I could do hasattr(item, '__len__'), but that does not seem perfect.
| to style the topomaps. `axes` and `show` are ignored. If `times` | ||
| is not in this dict, automatic peak detection is used. Beyond that, | ||
| if ``None``, no customizable arguments will be passed. | ||
| Defaults to ``None``. |
There was a problem hiding this comment.
note to self: fix this
| return noise_cov | ||
|
|
||
|
|
||
| def _get_channel_types(info): |
There was a problem hiding this comment.
Is this a duplicate?
|
IIRC @agramfort asked about boxes overlaid to show the averaging window, and I agree it would help. The lines indicate the center but not the extent. |
|
Yes, my suggestion was I do it in another PR, Alex said that would be ok. |
|
Btw this is quite ready for review :) |
|
can someone do a first pass of reviews? sorry I am quite busy...
|
| combine : 'mean' | 'rms' | None | ||
| Type of aggregation to perform across selected channels. If | ||
| None, plot one figure per selected channel. | ||
| exclude : None | list of str | 'bads' |
There was a problem hiding this comment.
What does None do? If it's the same as [] just use ().
larsoner
left a comment
There was a problem hiding this comment.
Other than a few minor things LGTM!
| The time-frequency point(s) for which topomaps will be plotted. | ||
| Each tuple defines a pair (time, frequency) in s and Hz on the | ||
| TFR plot. For example, to look at 10 Hz activity 1 second into | ||
| the epoch and 3 Hz activity 300 msec into the epoch, |
There was a problem hiding this comment.
end with :: to render as code instead of inline comment
There was a problem hiding this comment.
Also this is too long, move to Notes section and refer people there
|
|
||
| Notes | ||
| ----- | ||
| .. versionadded:: 0.15.0 |
|
|
||
|
|
||
| def _is_numeric(n): | ||
| return isinstance(n, (int, float)) |
There was a problem hiding this comment.
Maybe better as n = np.asarray(n); return n.dtype.kind not in 'OSU' and n.shape == ()
There was a problem hiding this comment.
What you wrote will fail for various numpy types. You can adapt what I wrote to work for them (maybe you also want to exclude complex in addition to object, string, and unicode (OSU))
There was a problem hiding this comment.
Hm. I think out of these:
https://docs.scipy.org/doc/numpy/reference/arrays.scalars.html
we want all the ints and floats, but not bool, complex, anything else. Wouldn't it be more economic to make an inclusive check than an exclusive check?
There was a problem hiding this comment.
I.e., isinstance(n, (np.integer, np.floating))
There was a problem hiding this comment.
Seems this was needed: isinstance(n, (np.integer, np.floating, int, float))
|
Comments addressed, anyone else? |
|
This one already got a lot of review love in #4134 so we might not need so much here. @mmagnuski you looked at the original one, do you have time to check this one out, too? |
|
Yes, the API is largely unchanged from there. The main point with the underlying functionality is that the vlims are independent between the image and the maps, and that the colorbar is drawn without reference to the image (only the maps). The underlying code is changed by a lot though. |
|
I can try this out tomorrow in the morning, but won't be able to give full review in a few days. But I trust you both :) |
|
@mmagnuski ? :D |
|
Oops, sorry, thanks for reminding. I'm on a limited time budget this weekend but I'll try it out today. |
|
👯♂️ |
|
Sorry, Jona to keep you waiting so long, I have an application deadline tomorrow that will set me free. :) |
3548c28 to
1b191ef
Compare
|
@larsoner can you try again, see if the lines no longer cross? |
|
(If yes, my error was also due to a brilliant piece of overengineering, specifically fixing the same problem twice.) |
|
Milestoned because it carries an API change wrt @cbrnr 's newest PR that should be merged before release. |
|
Yep, lines no longer cross on 2.1.2 |
|
All green, ready for merge. |
|
we have some rendering issues with colorbars cf. https://7444-1301584-gh.circle-artifacts.com/0/tmp/circle-artifacts.krdig2e/html/auto_tutorials/plot_visualize_evoked.html#sphx-glr-auto-tutorials-plot-visualize-evoked-py but you should do it another PR. anyone feel free to merge if you're happy. Ok for me. thanks @jona-sassenhagen for all the efforts. |
|
@hubertjb did the base! |
|
Thanks @jona-sassenhagen and @hubertjb ! |
|
Also, thanks to @nicproulx with whom I initially work on this. Thanks @jona-sassenhagen for wrapping it up! |
|
Thanks everyone! |
|
Thanks @jona-sassenhagen, @hubertjb and @nicproulx ! 🚀 |
* [MRG] Implementing plot_joint method in AverageTFR class * Created internal _plot method called by averageTFR.plot() and plot_joint() * Added aggregate (mean or rms) and exclude arguments to averageTFR.plot * Adding example of `plot_joint` inside time frequency tutorial * Adding test_joint_plot * Passing topomap_args to improve run time of tests * Removing description of interactive colorbar in AverageTFR.plot() * Adding private function for joining channel names * Moved connection_line method to viz/utils from viz/evoked and added y * argument. * Adding private function for preparing a joint plot's axes * Added automatic title option in _plot method * `exclude` and `aggregate` arguments in plot_joint * ... * init * agg->combine * api and costring fixes * code cleanup * excessive testing * tests * pep8 * pep8 * pep8 * fix test * pep8git add *git add *git add * * fix vlims * better example * ffff * title * factor out timefreqs input check * fix verbose error * fix verbose, 2 * fix timefreq test * minor cleanup * i think we are finally getting somewhere * bug * force circle rebuild * remove duplicate function * refactor * fix bug * fix bug, 2 * fix pep8 * minor cleanup * fascist pep8 * factor out preproc_tfr_inst * the incomparable pep8 again. who else. * timefreqs order * force circleci rebuild * fix sorting of timefreqs * comments * minor * move picks function, pinpoint lines * fix interactive, add colorbar helper * fix a few tests for cbar * fix more tests * fix more tests * fix pep8 * fix pep8b * adjust plot lims * add ch type to title * force circle * just a circle test * another circle test * another circle test * another circle test * show sysinfo * undo stupid line * show sysinfo * show sysinfo again * undo circle * warn for mpl 2.1.0 missing lines * add explanation of mpl bug * fix order * mask_alpha * pep8
|
@psychoxiatao Please create another issue. Did you try |
|
@mmagnuski Yeah, but it doesn't work. |
|
@psychoxiatao |


Finishing #4134 , which has been sitting in limbo cause @mmagnuski and I are lazy :)
closes #3801
Todo: