fooof icon indicating copy to clipboard operation
fooof copied to clipboard

Adds more flexibility in the aperiodic/oscillatory fitting

Open metapfhor opened this issue 6 years ago • 1 comments

DESCRIPTION: I have added a keyword ap_range to the FOOOF.fit() function.

When ap_range is specified, the already existing freq_range keyword is used to determine the frequencies for the oscillatory fits while the ap_range keyword is used for the aperiodic fit. When it is not specified, everything proceeds as before.

This allows the two parts FO and OOF to be more-or-less independent of one another if so-desired.

Furthermore, the ap_range keyword may also be a set of indices in order to allow for a very simple implementation of exclusion zones.

Update: I have added support for these keyword options in the FOOOFGroup.fit() function.

TESTING: Tested on ~100 different EEG files, no errors unless inputs are the wrong size. Screenshot_2019-08-22_16-22-46 Screenshot_2019-08-22_16-05-29

metapfhor avatar Aug 22 '19 20:08 metapfhor

Hey @metapfhor: Sorry for such a belated response to this! Thanks a lot for the suggestion / update - I do think this is a very interesting idea.

I've recently come back around to a series of code updates, and been thinking about this a bit more. I think there would be a couple things I would want to check before this would be ready to merge in:

  • there are some criteria we use to deal with peaks at the edges, and it might be worth double checking how these are applied given the different frequency ranges
  • freq_range is used a bunch, including through saving & loading, to regenerate data and models, and I would want to check through nothing goes weird here, with the update
  • I would want to think about recommendations for when to do this, as typically I think it's often important to fit both components together
  • Note that related to simple exclusion zones, I've added an interpolation function to remove things like line noise peaks (https://github.com/fooof-tools/fooof/issues/20)

By the way, I'm not asking for you to jump into any doing / checking of these, just logging some notes on it! We've moved development questions and coordination to a new repo (linked below). My current thought is to leave this until after we do the release of the current 1.0 candidate, and then hopefully I'll have time to come back around and work through this properly.

Related development issue: https://github.com/fooof-tools/Development/issues/8

TomDonoghue avatar Mar 25 '20 17:03 TomDonoghue