Skip to content

Commit e9162ea

Browse files
committed
initialize reporting example
1 parent af3f09c commit e9162ea

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

examples/manage/reporting.py

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
"""
2+
Reporting & Referencing
3+
=======================
4+
5+
Example of model fit failures and how to debug them.
6+
"""
7+
8+
###################################################################################################
9+
10+
# Import FOOOF model objects
11+
from fooof import FOOOF, FOOOFGroup
12+
13+
#
14+
from fooof.sim import gen_power_spectrum, gen_group_power_spectra
15+
16+
# Import utilities to print out information for reporting
17+
from fooof.utils.reports import methods_report_info, methods_report_text
18+
19+
###################################################################################################
20+
# Checking Module Version
21+
# -----------------------
22+
#
23+
# Words, words, words.
24+
#
25+
26+
###################################################################################################
27+
28+
# Check the version of the tool
29+
from fooof import __version__ as fooof_version
30+
print('Current fooof version:', fooof_version)
31+
32+
###################################################################################################
33+
# Title
34+
# -----
35+
#
36+
# Words, words, words.
37+
#
38+
39+
###################################################################################################
40+
41+
# Initialize model object
42+
fooof_obj = FOOOF()
43+
44+
###################################################################################################
45+
46+
# Print out all the methods information for reporting
47+
methods_report_info(fooof_obj)
48+
49+
###################################################################################################
50+
51+
# Generate methods text, with methods information inserted
52+
methods_report_text(fooof_obj)
53+
54+
###################################################################################################
55+
# Title
56+
# -----
57+
#
58+
# Words, words, words.
59+
#
60+
61+
###################################################################################################
62+
63+
#
64+
freqs, powers = gen_power_spectrum([1, 50], [0, 10, 1], [10, 0.25, 2], freq_res=0.25)
65+
66+
# Initialize model object
67+
fm = FOOOF(min_peak_height=0.1, peak_width_limits=[1, 6], aperiodic_mode='knee')
68+
fm.fit(freqs, powers)
69+
70+
###################################################################################################
71+
72+
# Generate methods text, with methods information inserted
73+
methods_report_info(fm)
74+
75+
###################################################################################################
76+
77+
# Generate methods text, with methods information inserted
78+
methods_report_text(fm)
79+
80+
###################################################################################################
81+
# Title
82+
# -----
83+
#
84+
# Words, words, words.
85+
#
86+
87+
###################################################################################################
88+
89+
#
90+
freqs, powers = gen_group_power_spectra(10, [1, 75], [0, 1], [10, 0.25, 2])
91+
92+
###################################################################################################
93+
94+
# Initialize and fit group model object
95+
fg = FOOOFGroup(max_n_peaks=4, peak_threshold=1.75)
96+
fg.fit(freq, powers)
97+
98+
###################################################################################################
99+
100+
# xx
101+
methods_report_info(fg)
102+
103+
###################################################################################################
104+
105+
methods_report_text(fg)
106+
107+
108+
###################################################################################################
109+
#
110+
# Words, words, words.
111+
#

0 commit comments

Comments
 (0)