Crop-like option for TFR with `fmin` and `fmax`
See original GitHub issueI’ve found out during classes where I teach mne that .crop
-like operations are usually much more intuitive for students than having to dive into the data array and index it. With tfr they usually want to, for example selecte a time range and frequency range and then average (or not) and use in further computations/visualisations. If you agree it would be useful, there are two options:
adding fmin
and fmax
to TFR.crop()
This would allow for example for
tfr.crop(tmin=0.2, tmax=0.4, fmin=5, fmax=7)
@larsoner mentioned that he does not like this solution very much because .crop()
sounds more time-related and it would stay to mean “crop in time” if we instead add another method for freq-cropping (Eric, please correct me if I misrepresent). I actually like putting it all into .crop()
since I much prefer using kwargs anyway for clarity. Also crop sounds to me equally well suited for time, space or frequency (like trim, for example, but I’m not a native so my argument is weaker here 😃 ). I also think it would be easier for new mne users (like my students) to digest - one method for selection instead of multiple methods depending on the dimension type.
adding another method for frequency cropping
Another method that would work like .crop()
but for frequency dimension. I don’t have a good idea for the method name in this case but just assuming it would be called .frop()
the example from previous section would be:
tfr.crop(tmin=0.2, tmax=0.4).frop(fmin=5, fmax=7)
obviously I’m not suggesting to actually call it .frop()
😃
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
Yes we should just override it in the TFR classes.
Thinking about it more, I’m fine with
crop
. If we think of a “crop” operation as “trimming the current raw / average / epoch / source data for all channels/sources”, then you can crop in freq just as easily as time, and it’s different from other forms of subselection we have, such as trimming the set of epochs withepochs[10:20]
, subselecting source vertices withstc.in_label
, or the set of channels withepochs.pick_types
, etc.