-
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
[WIP] Flexible dtype results class #194
base: main
Are you sure you want to change the base?
Conversation
@TomDonoghue, do you think this is a good idea to pursue further? |
This has been extended so
This maintains backwards compatibility so |
d28a992
to
a4a02a2
Compare
Thanks for working on these ideas here @ryanhammonds - and sorry I'm slow to respond here. I have a feeling that this approach might not be the best way to go. In part, tests currently fail because the fit functions need to flexible in the number of params they take (including zero for periodic fit), and so pulling the labels from the functions is an issue (also: peak params aren't quite the same quantities as the gaussian fit, for example). Also, I think we need to focus on how this works at the group level - as that's the main use case (exporting a DF for a single model isn't that likely). At the group level, the param are stored a bit differently. Also, this is where the complication arises, since there needs to be some organization of peak parameters (what to do if model 0 has 1 peak, and model 1 has 2 peaks, etc). I think what probably makes the most sense is a helper function that converts a FOOOFResults object to a pandas Series (one row of a DF), with options to control the peak parameters), and then at the group level this can be done for each model results and concatenated together. EDIT: I've played around with a possible alternative approach in #196 |
The tests can be fixed. I was working up to the group level and that was the next step here. This idea would have worked fine at the individual and group level. |
This addresses #192 and a point in #193. This would allow the datatype of
fm.peak_params_
to be converted to different datatypes (OrderedDict and pd.DataFrame), similar to howdf.to_dict()
works in pandas (note: this only returns the new datatype and doesn't change the results class datatype). I have only implemented the results class object, but this design would eventually allowfm.peak_params_.to_dict()
orfm.peak_params_.to_pandas()
to work. Here is an example usage of the current changes: