How to use equalize_event_counts() combined with metadata instead of event_ids

  • MNE-Python version:
  • operating system: linux

Hey! guys,

I’m wondering whether the function equalize_event_counts (event_ids , method='mintime') can be used combined with metadata instead of event_ids.
In my situation, I have metadata like this:

I hope that the numbers of epochs of each condition can be equal, is there a way to achieve this based on my metadata?

Thanks a lot!

Hello @YuZhou, this is an interesting and very valid question that recently came up in discussions with @virvw and @sophie as well. The short answer is, we currently support doing this, but it’s on our todo list. We’ll hopefully have something ready within the next two weeks, but I cannot make any promises here. I’ll open an issue on GitHub with this feature request.

Edit: The issue can be found here:

1 Like

Hi! Richard,
Thanks a lot for your reply :blush: Looking forward to the implementation of the new feature. You guys are really really cool to develop such a handy and excellent tool :+1: :+1: :+1: :+1: :+1:
By the way, if this new feature is added, will it be updated to version 0.23.dev0 or other versions?

1 Like

We’ll need to see what will need to be changed to get this to work. Typically, we’ll add new features for new releases only (in this case, this would probably be the upcoming 0.23.0); although sometimes we also backport small and important enhancements to the current “stable” tree. It really depends on how drastic the changes are, and I cannot tell you that with certainty now for this feature. Although my gut feeling is it will only land in 0.23 and not be backported to 0.22, but who knows.

And yes, once this is implemented, it will be merged into the current development tree, i.e., 0.23.dev0.


Great! :grin:Actually, that’s exactly what I’m hoping, because the version I’m using is 0.23.dev0. So if this feature is added, what I need to do is to type this in my terminal in the mne environment, right?

$ pip install --upgrade --no-deps

Yes that’s one way to update to the latest development version.

1 Like