Skip to content
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

problems printing out results and plotting from fooof group object #334

Closed
maboudewyn opened this issue Sep 9, 2024 · 2 comments
Closed

Comments

@maboudewyn
Copy link

Hello,
I am working on fitting a group of power spectra using the tutorial here: https://fooof-tools.github.io/fooof/auto_tutorials/plot_06-FOOOFGroup.html

I was able to initialize a fooof group object and fit the group of spectra using the .fit() method. However, when I try to plot a summary of the model using fg.plot(), only the aperiodic fit and error plots populate; the center frequencies portion of the plot remains empty and the console returns the following error:

Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
File "", line 1, in
File "/Library/Python/3.9/site-packages/fooof/objs/group.py", line 403, in plot
plot_fg(self, save_fig, file_name, file_path)
File "/Library/Python/3.9/site-packages/fooof/core/modutils.py", line 180, in wrapped_func
func(*args, **kwargs)
File "/Library/Python/3.9/site-packages/fooof/plts/fg.py", line 57, in plot_fg
plot_fg_peak_cens(fg, ax2)
File "/Library/Python/3.9/site-packages/fooof/core/modutils.py", line 180, in wrapped_func
func(*args, **kwargs)
File "/Library/Python/3.9/site-packages/fooof/plts/fg.py", line 114, in plot_fg_peak_cens
plot_hist(fg.get_params('peak_params', 0)[:, 0], 'Center Frequency',
File "/Library/Python/3.9/site-packages/fooof/objs/group.py", line 378, in get_params
out = np.array([np.insert(getattr(data, name), 3, index, axis=1)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (25,) + inhomogeneous part.

This same error comes up when I try the following with the fooof group object:
fooof.objs.average_fg()
get_band_peak_fg()
fg.print_results()

Interestingly, the following DOES work:
print(fg.group_results[0:])

  • the below works when any of the 25 fits = ind
    fm = fg.get_fooof(ind=4, regenerate=True)
    fm.plot()

I have also checked the organization of the data:
print(freqs.shape)
print(spectra.shape)
Out:
(204,)
(25, 204)

I am sure I am doing something wrong, but I'm not sure what!

Thanks

@TomDonoghue
Copy link
Member

Hey @maboudewyn - I think this is the same issue as #313, if you check and make sure your versions of fooof and numpy are up date, that should fix it!

@maboudewyn
Copy link
Author

That worked, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants