def save_report_fg(fg, file_name, file_path=None): """Generate and save out as a PDF a report for a FOOOFGroup object. Parameters ---------- fg : FOOOFGroup() object FOOOFGroup object, containing results from fitting a group of power spectra. file_name : str Name to give the saved out file. file_path : str, optional Path to directory in which to save. If not provided, saves to current directory. """ font = _report_settings() # Initialize figure fig = plt.figure(figsize=(16, 20)) gs = gridspec.GridSpec(3, 2, wspace=0.35, hspace=0.25, height_ratios=[0.8, 1.0, 1.0]) # First / top: text results ax0 = plt.subplot(gs[0, :]) results_str = gen_results_fg_str(fg) ax0.text(0.5, 0.7, results_str, font, ha='center', va='center') ax0.set_frame_on(False) ax0.set_xticks([]) ax0.set_yticks([]) # Aperiodic parameters plot ax1 = plt.subplot(gs[1, 0]) plot_fg_ap(fg, ax1) # Goodness of fit plot ax2 = plt.subplot(gs[1, 1]) plot_fg_gf(fg, ax2) # Peak center frequencies plot ax3 = plt.subplot(gs[2, :]) plot_fg_peak_cens(fg, ax3) # Save out the report plt.savefig(fpath(file_path, fname(file_name, 'pdf'))) plt.close()
def save_report_fg(fg, file_name, file_path=None): """Generate and save out a PDF report for a group of power spectrum models. Parameters ---------- fg : FOOOFGroup Object with results from fitting a group of power spectra. file_name : str Name to give the saved out file. file_path : str, optional Path to directory to save to. If None, saves to current directory. """ # Initialize figure _ = plt.figure(figsize=REPORT_FIGSIZE) grid = gridspec.GridSpec(3, 2, wspace=0.4, hspace=0.25, height_ratios=[0.8, 1.0, 1.0]) # First / top: text results ax0 = plt.subplot(grid[0, :]) results_str = gen_results_fg_str(fg) ax0.text(0.5, 0.7, results_str, REPORT_FONT, ha='center', va='center') ax0.set_frame_on(False) ax0.set_xticks([]) ax0.set_yticks([]) # Aperiodic parameters plot ax1 = plt.subplot(grid[1, 0]) plot_fg_ap(fg, ax1) # Goodness of fit plot ax2 = plt.subplot(grid[1, 1]) plot_fg_gf(fg, ax2) # Peak center frequencies plot ax3 = plt.subplot(grid[2, :]) plot_fg_peak_cens(fg, ax3) # Save out the report plt.savefig(fpath(file_path, fname(file_name, SAVE_FORMAT))) plt.close()