Determining which channel apply_function() is currently working on


I am using apply_function() to perform Principle Component Analysis (Optimal Basis Sets) on EEG data to remove cardiac artefact noise and it is working fine with no issues.

However, I’m wondering if there is a way to access the channel this method is currently working on when using the njobs parameter to implement parallelization. It’s convenient for debugging etc. to be able to save parameters from the run, but for these to be useful to me they must be specific to each channel and I can’t quite figure out a way to access this information!

Any information is greatly appreciated :slight_smile:

  • MNE-Python version: 0.23.4
  • operating system: Linux

Hello @bailey,

I agree that this would be a very useful addition; however, this is currently not implemented. Care to open a feature request on our GitHub issue tracker?

In the meantime, you could probably cook up something yourself by passing channel_wise=False (to pass the data for all channels) and doing the parallelization across channels inside your function. It’s a hack, but it should work!

Best wishes,

Yeah I’m going to have to do something like this it just would’ve been nice to avoid! Thanks :slight_smile:

1 Like