@@ -109,59 +109,3 @@ def save_report_fg(fg, file_name, file_path=None):
109109 # Save out the report
110110 plt .savefig (fpath (file_path , fname (file_name , SAVE_FORMAT )))
111111 plt .close ()
112-
113-
114- def save_report_fg_i (fg , i_model , file_name , file_path = None , plot_peaks = None ,
115- plot_aperiodic = True , plt_log = True , add_legend = True , data_kwargs = None ,
116- model_kwargs = None , aperiodic_kwargs = None , peak_kwargs = None ):
117- """Generate and save out a PDF report for a single model fit within a FOOOFGroup object.
118-
119- Parameters
120- ----------
121- fg : FOOOFGroup
122- Object with results from fitting a group of power spectra.
123- i_model : int
124- Index of the model for which to generate a report.
125- file_name : str
126- Name to give the saved out file.
127- file_path : str, optional
128- Path to directory to save to. If None, saves to current directory.
129- plot_peaks : None or {'shade', 'dot', 'outline', 'line'}, optional
130- What kind of approach to take to plot peaks. If None, peaks are not specifically plotted.
131- Can also be a combination of approaches, separated by '-', for example: 'shade-line'.
132- plot_aperiodic : boolean, optional, default: True
133- Whether to plot the aperiodic component of the model fit.
134- plt_log : bool, optional, default: False
135- Whether or not to plot the frequency axis in log space.
136- add_legend : boolean, optional, default: False
137- Whether to add a legend describing the plot components.
138- data_kwargs, model_kwargs, aperiodic_kwargs, peak_kwargs : None or dict, optional
139- Keyword arguments to pass into the plot call for each plot element.
140- """
141-
142- # imports
143- import numpy as np
144- from fooof import FOOOF
145- from fooof .sim .gen import gen_aperiodic , gen_periodic
146-
147- # create fooof object and add settings
148- fm = FOOOF ()
149- fm .add_settings (fg .get_settings ())
150-
151- # Copy results for model of interest and additional data needed for plotting
152- fm .add_results (fg [i_model ])
153- fm .power_spectrum = fg .power_spectra [i_model ]
154- fm .freq_range = fg .freq_range
155- fm .freq_res = fg .freq_res
156- fm .freqs = fg .freqs
157-
158- # generate and perioidc/aperiodic fits from parameters
159- fm ._ap_fit = gen_aperiodic (fg .freqs , fg [i_model ].aperiodic_params )
160- fm ._peak_fit = gen_periodic (fg .freqs , np .ndarray .flatten (fg [i_model ].gaussian_params ))
161- fm .fooofed_spectrum_ = fm ._ap_fit + fm ._peak_fit
162-
163- # save report
164- save_report_fm (fm , file_name , file_path = file_path , plot_peaks = plot_peaks ,
165- plot_aperiodic = plot_aperiodic , plt_log = plt_log , add_legend = add_legend ,
166- data_kwargs = data_kwargs , model_kwargs = model_kwargs ,
167- aperiodic_kwargs = aperiodic_kwargs , peak_kwargs = peak_kwargs )
0 commit comments