Skip to content

Commit b85138f

Browse files
committed
use new docstring functionality to reduce copied text in FOOOFGroup (gets copied over)
1 parent c55046d commit b85138f

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

fooof/objs/group.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
from fooof.core.reports import save_report_fg
2121
from fooof.core.strings import gen_results_fg_str
2222
from fooof.core.io import save_fg, load_jsonlines
23-
from fooof.core.modutils import copy_doc_func_to_method, safe_import
23+
from fooof.core.modutils import (copy_doc_func_to_method, safe_import,
24+
docs_get_section, replace_docstring_sections)
2425
from fooof.data.conversions import group_to_dataframe
2526

2627
###################################################################################################
2728
###################################################################################################
2829

30+
@replace_docstring_sections([docs_get_section(FOOOF.__doc__, 'Parameters'),
31+
docs_get_section(FOOOF.__doc__, 'Notes')])
2932
class FOOOFGroup(FOOOF):
3033
"""Model a group of power spectra as a combination of aperiodic and periodic components.
3134
@@ -36,18 +39,7 @@ class FOOOFGroup(FOOOF):
3639
3740
Parameters
3841
----------
39-
peak_width_limits : tuple of (float, float), optional, default: (0.5, 12.0)
40-
Limits on possible peak width, as (lower_bound, upper_bound).
41-
max_n_peaks : int, optional, default: inf
42-
Maximum number of gaussians to be fit in a single spectrum.
43-
min_peak_height : float, optional, default: 0
44-
Absolute threshold for detecting peaks, in units of the input data.
45-
peak_threshold : float, optional, default: 2.0
46-
Relative threshold for detecting peaks, in units of standard deviation of the input data.
47-
aperiodic_mode : {'fixed', 'knee'}
48-
Which approach to take for fitting the aperiodic component.
49-
verbose : bool, optional, default: True
50-
Verbosity mode. If True, prints out warnings and general status updates.
42+
%copied in from FOOOF object
5143
5244
Attributes
5345
----------
@@ -75,18 +67,7 @@ class FOOOFGroup(FOOOF):
7567
7668
Notes
7769
-----
78-
- Commonly used abbreviations used in this module include:
79-
CF: center frequency, PW: power, BW: Bandwidth, AP: aperiodic
80-
- Input power spectra must be provided in linear scale.
81-
Internally they are stored in log10 scale, as this is what the model operates upon.
82-
- Input power spectra should be smooth, as overly noisy power spectra may lead to bad fits.
83-
For example, raw FFT inputs are not appropriate. Where possible and appropriate, use
84-
longer time segments for power spectrum calculation to get smoother power spectra,
85-
as this will give better model fits.
86-
- The gaussian params are those that define the gaussian of the fit, where as the peak
87-
params are a modified version, in which the CF of the peak is the mean of the gaussian,
88-
the PW of the peak is the height of the gaussian over and above the aperiodic component,
89-
and the BW of the peak, is 2*std of the gaussian (as 'two sided' bandwidth).
70+
%copied in from FOOOF object
9071
- The FOOOFGroup object inherits from the FOOOF object. As such it also has data
9172
attributes (`power_spectrum` & `fooofed_spectrum_`), and parameter attributes
9273
(`aperiodic_params_`, `peak_params_`, `gaussian_params_`, `r_squared_`, `error_`)

fooof/tests/core/test_modutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_docs_get_section(tdocstring):
7676
def test_docs_add_section(tdocstring):
7777

7878
tdocstring = tdocstring + \
79-
"""\nNotes\n-----\n % copied in at runtime"""
79+
"""\nNotes\n-----\n % copied in"""
8080

8181
new_section = \
8282
"""Notes\n-----\n \nThis is a new note."""
@@ -131,7 +131,7 @@ def tfunc():
131131
132132
Parameters
133133
----------
134-
% copied in at runtime
134+
% copied in
135135
"""
136136
pass
137137

0 commit comments

Comments
 (0)