DOC: Fix apply_function shape description for Epochs (#13118)#13891
DOC: Fix apply_function shape description for Epochs (#13118)#13891bkowshik wants to merge 4 commits into
Conversation
tsbinns
left a comment
There was a problem hiding this comment.
Thanks for opening this PR @bkowshik! I have only a very minor comment.
Please have a look at the instructions for documenting these changes in our contributing guide, so that you can be credited.
For a small documentation change like this, the other change type fits best.
| " if ``channel_wise=True`` and ``(len(picks), n_times)`` otherwise" | ||
| ) | ||
| docdict["fun_applyfun_epochs"] = applyfun_fun_base.format( | ||
| " if ``channel_wise=True`` and ``(n_epochs, n_channels, n_times)`` otherwise" |
There was a problem hiding this comment.
| " if ``channel_wise=True`` and ``(n_epochs, n_channels, n_times)`` otherwise" | |
| " if ``channel_wise=True`` (because it will apply to 1-D slices along the times axis) and ``(n_epochs, len(picks), n_times)`` otherwise" |
- Suggest changing
n_channelstolen(picks)for consistency with the docstring ofRaw.apply_function(). - Suggest explaining why
n_epochsisn't included as a dimension whenchannel_wise=True(np.apply_along_axisis used to apply the function to 1-D slices along the times axis).
There was a problem hiding this comment.
You would need to fix the line length of this suggestion afterwards if applying directly.
There was a problem hiding this comment.
The fun parameter docstring for mne.Epochs.apply_function incorrectly stated that the array passed to the user's function when channel_wise=False has shape (len(picks), n_times). The actual shape is (n_epochs, n_channels, n_times). Adds a new fun_applyfun_epochs docdict entry alongside fun_applyfun_evoked and fun_applyfun_stc, leaving the Raw docstring (where (len(picks), n_times) is correct) untouched. Per scott-huberty's review suggestion on mne-tools#13136. Fixes mne-tools#13118
93fc229 to
5abd7b1
Compare
Apply @tsbinns review suggestion (n_channels -> len(picks); explain channel_wise=True shape).
Add 13891.other.rst (other type) and Bhargav Kowshik to names.inc as new contributor.
|
Thank you so much for the review, feedback and the PR fixing the issue! 👏
Made the change in this commit: 3f3793c |

Reference issue (if any)
What does this implement/fix?
The
funparameter docstring formne.Epochs.apply_functionincorrectly stated that the array passed to the user's function whenchannel_wise=Falsehas shape(len(picks), n_times). The actual shape is(n_epochs, n_channels, n_times). Adds a newfun_applyfun_epochsdocdict entry alongsidefun_applyfun_evokedandfun_applyfun_stc, leaving the Raw docstring (where(len(picks), n_times)is correct) untouched.Documentation post the fix looks like below:
cd doc make html-noplot make showAdditional information
Have used Claude Code to understand the issue, identify the location of fix, commands to build locally for testing.