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

get_params not working due to inhomogeneities in FOOOFGroup #313

Closed
maschpall opened this issue Feb 12, 2024 · 10 comments
Closed

get_params not working due to inhomogeneities in FOOOFGroup #313

maschpall opened this issue Feb 12, 2024 · 10 comments
Labels

Comments

@maschpall
Copy link

I am using version 1.0.0 and when fitting with FOOOFGroup, when using fg.get_params('peak_params') I get an error:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (1165,) + inhomogeneous part.

It appears to have an issue if each PSD has a different number of peaks. I have checked all tutorials and examples and having a variable number of fitted peaks should not be a problem, so any help in that matter would be really helpfull.

Thanks!

@Camilo-Castelblanco
Copy link

I am experiencing the same issue! First, I tried using my data, and that yielded the error. Then, using the example code and data, I observed the same issue. The aperiodic and goodness of fit are estimated with my data, but the peak centers are not.
image

Thank you!

Full Error:
image

@TomDonoghue
Copy link
Member

@maschpall and/or @Camilo-Castelblanco - could you check what version of fooof and numpy you are running, and let me know? I have a feeling this is a change in how numpy handles certain arrays, and you will likely have to update fooof and/or downgrade numpy to avoid this error. If you are not already on fooof 1.1, try updating to that - I have a feeling I fixed this at some point, though I don't remember / can't quickly find exactly when / where.

@maschpall
Copy link
Author

Hi @TomDonoghue and thanks for the answer! I did try with both fooof 1.0 and 1.1.0 and had the same result. The version of numpy I am using is 1.24.4

@TomDonoghue
Copy link
Member

TomDonoghue commented Feb 15, 2024

@maschpall - ahh, okay, it's still an issue up until 1.1, I'll have to check if I changed anything relevant in the development version, and/or if it's still an issue everywhere, and then see what I can do to update and fix, and backport this is fix to 1.1.

In the meantime, from some quick checks, I think this changed in numpy as of 1.24 (which you are on), so I believe if you drop your numpy version to be prior to 1.24 (so <= 1.23), I think this should work. This should be the quickest way to get things moving (and unless you need anything in particular from the newest numpy for other stuff, shouldn't change things otherwise), so this should get things up and running until it gets fixed more generally.

@TomDonoghue
Copy link
Member

Also, @maschpall - do you have a minimal example of some data that leads to this problem for you? I'm not immediately replicating this error with newer numpy - so I'm not sure if there is some particular details of the pattern(s) of peaks across models that leads to this issue

@maschpall
Copy link
Author

I double checked and it seems I did not update correctly to 1.1. Now when I redid it, it works correctly! I'm sorry for the inconvenience and thanks a lot for your time and help!

@TomDonoghue
Copy link
Member

@maschpall - no worries, that's actually great news, as it means this is already fixed hahaha! It sounded familiar - I must not have looked far back enough to find the change for this - I'll keep a note on this so that we can have a clearer recommendation for addressing this, as more people might encounter it if they update numpy without also updating fooof.

@Camilo-Castelblanco - if you see this, could you also check and confirm that everything works if you update to fooof v1.1? If so, we should be all good on this!

@Camilo-Castelblanco
Copy link

Thank you for the info! Indeed, I have fooof 1.0.0.
Probably, I am making a silly mistake when trying to upload fooof. I tried following the website and also conda install fooof=1.1.0 (from the link). However, it is not updating for me. I will keep working on this. I appreciate your help!

@TomDonoghue
Copy link
Member

hey @Camilo-Castelblanco - I just realized version 1.1 doesn't seem to have been updated on conda-forge yet, so you won't be able to update through conda just yet - i've opened an issue at #315 to get check in on getting this updated, so hopefully this will be fixed soon.

In the meantime, you should still be able to update using pip (in your conda environment) if you want to try that.

@TomDonoghue
Copy link
Member

As far as I can tell - everything here is fixed in the 1.1 release, so I'm going to close this now!

For anyone finding this issue - if you see a similar error on 1.0, try updating to 1.1! If that doesn't fix it, please add a comment and/or add a new issue!

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

No branches or pull requests

3 participants