fooof-tools / DevelopmentalDemo

Tutorial for developmental data with spectral parameterization.
MIT License
7 stars 2 forks source link

Error running fg.fit and fg.save_report #12

Open caroline-kelsey opened 4 months ago

caroline-kelsey commented 4 months ago

Hello! I hope this finds you well. Thank you so much for creating an R based tutorial for specparam. I am more than happy to provide any additional details needed to recreate this code. For reference, I am running R (version 4.3) on a PC computer. Thank you so much for your help.

I am running through the example and am getting stuck at fg.save_report

Here is the line: fg.save_report('EOP_demo', file_path = 'C:/Users/carol/Desktop/EEG/Infancy_Foof/Output')

Here is the error message:

Traceback (most recent call last): File "", line 1, in File "C:\Users\carol\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\fooof\objs\group.py", line 409, in save_report save_report_fg(self, file_name, file_path) File "C:\Users\carol\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\fooof\core\modutils.py", line 180, in wrapped_func func(*args, **kwargs) File "C:\Users\carol\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\fooof\core\reports.py", line 88, in save_report_fg results_str = gen_results_fg_str(fg) File "C:\Users\carol\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\fooof\core\strings.py", line 352, in gen_results_fg_str n_peaks = len(fg.get_params('peak_params')) File "C:\Users\carol\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\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 (60,) + inhomogeneous part.

TomDonoghue commented 4 months ago

Hey @caroline-kelsey - do you know what version of fooof you have installed? I think that error relates to a change in numpy that has now been addressed in a new version of fooof - so if you are on version 1.0.0 (or older), I think you just need to update to 1.1.0

Can you try updating fooof, by running the following in terminal: pip install -U fooof

Hopefully that fixes it - let me know if not!