-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] - Add support for converting model results, including to DFs #196
Conversation
👍 !! |
Hello, Thanks for making FOOOF available, great tool!! I'm trying to use this dataframe conversion utility and I can't seem to get it to work. When I run the example usage code exactly as above I get the following error.: I also can't seem to import or access documentation for fooof.data.conversions. Are there some simple import steps or documentation I am missing? |
@matteuler the branch containing the code for a data frame conversion is not merged yet into |
@matteuler, you may get this feature early via cloning, checking out the |
@danieltomasz @ryanhammonds Thanks very much for these responses! I was able to use "get_params' to get the aperiodic and fit info directly (ignoring peaks for the time being) which made converting to a dataframe easy via pandas utilities. |
@matteuler you may really easily join peaks into dataframe with aperiodic and periodic parameters, 'temp_df` is the dataframe with aperiodic parameters temp_df.insert(0, 'ID', temp_df.index)
peaks = fg.get_params('peak_params') # prepare peaks dataframe
peaks_df = pd.DataFrame(peaks)
peaks_df.columns = ['CF', 'PW', 'BW', 'ID']
peaks_df['ID'] = peaks_df['ID'].astype(int)
peaks_df = peaks_df.join(temp_df.set_index('ID'), on='ID') |
Adds
fooof.data.conversions
that allows for converting model results into alternate forms, including DataFrames.A key component for doing this is to is to organize how to to organize peaks. Currently, this implementation supports organizing a set number of peaks, or using band definitions.
Note that this is an alternate approach to some other ideas explored in #194
Example usage: