Skip to content

Commit dcc93b1

Browse files
authored
Merge pull request #133 from fooof-tools/amp
Update reference to 'amp' & 'amplitude' -> 'height' or 'power'
2 parents 39286c2 + 8b11acf commit dcc93b1

23 files changed

+143
-130
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FOOOF conceives of a model of the power spectrum as a combination of two distinc
1717

1818
This model driven approach can be used to measure periodic and aperiodic properties of electrophysiological data, including EEG, MEG, ECoG and LFP data.
1919

20-
The benefit of using FOOOF for measuring putative oscillations, is that peaks in the power spectrum are characterized in terms of their specific center frequency, amplitude and bandwidth without requiring predefining specific bands of interest and controlling for the aperiodic component. FOOOF also gives you a measure of this aperiodic components of the signal, allowing for measuring and comparison of 1/f like components of the signal within and between subjects.
20+
The benefit of using FOOOF for measuring putative oscillations, is that peaks in the power spectrum are characterized in terms of their specific center frequency, power and bandwidth without requiring predefining specific bands of interest and controlling for the aperiodic component. FOOOF also gives you a measure of this aperiodic components of the signal, allowing for measuring and comparison of 1/f like components of the signal within and between subjects.
2121

2222
## Documentation
2323

@@ -114,13 +114,13 @@ FOOOF.report() fits the model, plots the original power spectrum with the associ
114114
FOOOF also accepts parameters for fine-tuning the fit. For example:
115115

116116
```python
117-
fm = FOOOF(peak_width_limits=[1.0, 8.0], max_n_peaks=6, min_peak_amplitude=0.1, peak_threshold=2.0)
117+
fm = FOOOF(peak_width_limits=[1.0, 8.0], max_n_peaks=6, min_peak_height=0.1, peak_threshold=2.0)
118118
```
119119

120120
* `peak_width_limits` sets the possible lower- and upper-bounds for the fitted peak widths.
121121
* `max_n_peaks` sets the maximum number of peaks to fit.
122-
* `min_peak_amp` sets an absolute limit on the minimum amplitude (above aperiodic) for any extracted peak.
123-
* `peak_threshold`, also sets a threshold above which a peak amplitude must cross to be included in the model. This parameter is in terms of standard deviation above the noise of the flattened spectrum.
122+
* `min_peak_height` sets an absolute limit on the minimum height (above aperiodic) for any extracted peak.
123+
* `peak_threshold`, also sets a threshold above which a peak height must cross to be included in the model. This parameter is in terms of standard deviation above the noise of the flattened spectrum.
124124

125125
FOOOF also has convenience methods for running the FOOOF model across matrices of multiple power spectra, as well as functionality for saving and loading results, creating reports from FOOOF outputs, and utilities to further analize FOOOF results.
126126

doc/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Analysis Functions
5252

5353
get_band_peak
5454
get_band_peak_group
55-
get_highest_amp_peak
55+
get_highest_peak
5656

5757
Synth Code
5858
----------

doc/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ symmetric function (gaussians) to what can be an asymetric peak power spectrum.
129129

130130
Because of this, it is often useful to focus on the dominant (highest power) peak within a
131131
given frequency band from a FOOOF analysis, as this peak will offer the best estimate of
132-
the putative oscillations center frequency and amplitude. If analyzing bandwidth of extracted peaks,
132+
the putative oscillations center frequency and power. If analyzing bandwidth of extracted peaks,
133133
than overlapping peaks should always be considered. FOOOF is not currently optimized for inferring
134134
whether multiple peaks within a frequency band likely reflect distinct oscillations or not.
135135

examples/plot_synthetic_power_spectra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# the example below, this is interpreted as [offset, knee, exponent] for a 'knee' spectrum.
5858
#
5959
# Power spectra can also be simulated with any number of peaks. Peaks can be listed in a flat
60-
# list with [center frequency, amplitude, bandwidth] listed for as many peaks as you would
60+
# list with [center frequency, height, bandwidth] listed for as many peaks as you would
6161
# like to add, or as a list of lists containing the same information.
6262
#
6363
# The following example shows simulating a different power spectrum with some different

fooof/analysis.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def get_band_peaks_group(peak_params, band, n_fits):
6565
Returns
6666
-------
6767
band_peaks : 2d array
68-
Peak data. Each row is a peak, as [CF, Amp, BW].
68+
Peak data. Each row is a peak, as [CF, PW, BW].
6969
7070
Notes
7171
-----
@@ -104,12 +104,12 @@ def get_band_peak(peak_params, band, ret_one=True):
104104
Defines the band of interest, as (lower_frequency_bound, upper_frequency_bound).
105105
ret_one : bool, optional, default: True
106106
Whether to return single peak (if True) or all peaks within the range found (if False).
107-
If True, returns the highest power peak within the search range.
107+
If True, returns the highest peak within the search range.
108108
109109
Returns
110110
-------
111111
band_peaks : 1d or 2d array
112-
Peak data. Each row is a peak, as [CF, Amp, BW]
112+
Peak data. Each row is a peak, as [CF, PW, BW]
113113
"""
114114

115115
# Return nan array if empty input
@@ -127,17 +127,17 @@ def get_band_peak(peak_params, band, ret_one=True):
127127

128128
band_peaks = peak_params[peak_inds, :]
129129

130-
# If results > 1 and ret_one, then we return the highest power peak
130+
# If results > 1 and ret_one, then we return the highest peak
131131
# Call a sub-function to select highest power peak in band
132132
if n_peaks > 1 and ret_one:
133-
band_peaks = get_highest_amp_peak(band_peaks)
133+
band_peaks = get_highest_peak(band_peaks)
134134

135135
# If results == 1, return single peak
136136
return np.squeeze(band_peaks)
137137

138138

139-
def get_highest_amp_peak(band_peaks):
140-
"""Searches for the highest amplitude peak.
139+
def get_highest_peak(band_peaks):
140+
"""Searches for the highest peak.
141141
142142
Parameters
143143
----------
@@ -147,7 +147,7 @@ def get_highest_amp_peak(band_peaks):
147147
Returns
148148
-------
149149
1d array
150-
Seleced peak data. Row is a peak, as [CF, Amp, BW].
150+
Peak data. Each row is a peak, as [CF, PW, BW].
151151
"""
152152

153153
# Catch & return NaN if empty

fooof/core/funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def gaussian_function(xs, *params):
3232

3333
for ii in range(0, len(params), 3):
3434

35-
ctr, amp, wid = params[ii:ii+3]
35+
ctr, hgt, wid = params[ii:ii+3]
3636

37-
ys = ys + amp * np.exp(-(xs-ctr)**2 / (2*wid**2))
37+
ys = ys + hgt * np.exp(-(xs-ctr)**2 / (2*wid**2))
3838

3939
return ys
4040

fooof/core/info.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_obj_desc():
1313
'r_squared_', 'error_',
1414
'_gaussian_params'],
1515
'settings' : ['peak_width_limits', 'max_n_peaks',
16-
'min_peak_amplitude', 'peak_threshold',
16+
'min_peak_height', 'peak_threshold',
1717
'aperiodic_mode'],
1818
'data' : ['power_spectrum', 'freq_range', 'freq_res'],
1919
'data_info' : ['freq_range', 'freq_res'],
@@ -40,12 +40,12 @@ def get_data_indices(aperiodic_mode):
4040
"""
4141

4242
indices = {
43-
'CF' : 0,
44-
'Amp' : 1,
45-
'BW' : 2,
43+
'CF' : 0,
44+
'PW' : 1,
45+
'BW' : 2,
4646
'offset' : 0,
47-
'knee' : 1 if aperiodic_mode == 'knee' else None,
48-
'exponent' : 1 if aperiodic_mode == 'fixed' else 2
47+
'knee' : 1 if aperiodic_mode == 'knee' else None,
48+
'exponent' : 1 if aperiodic_mode == 'fixed' else 2
4949
}
5050

5151
return indices

fooof/core/strings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def gen_settings_str(f_obj, description=False, concise=False):
5959
# Parameter descriptions to print out, if requested
6060
desc = {'peak_width_limits' : 'Enforced limits for peak widths, in Hz.',
6161
'max_n_peaks' : 'The maximum number of peaks that can be extracted.',
62-
'min_peak_amplitude' : 'Minimum absolute amplitude of a peak, above aperiodic component.',
62+
'min_peak_height' : 'Minimum absolute height of a peak, above the aperiodic component.',
6363
'peak_threshold' : 'Threshold at which to stop searching for peaks.',
6464
'aperiodic_mode' : 'The aproach taken to fitting the aperiodic component.'}
6565

@@ -81,9 +81,9 @@ def gen_settings_str(f_obj, description=False, concise=False):
8181
'{}'.format(desc['peak_width_limits']),
8282
'Max Number of Peaks : {}'.format(f_obj.max_n_peaks),
8383
'{}'.format(desc['max_n_peaks']),
84-
'Minimum Amplitude : {}'.format(f_obj.min_peak_amplitude),
85-
'{}'.format(desc['min_peak_amplitude']),
86-
'Amplitude Threshold: {}'.format(f_obj.peak_threshold),
84+
'Minimum Peak Height : {}'.format(f_obj.min_peak_height),
85+
'{}'.format(desc['min_peak_height']),
86+
'Peak Threshold: {}'.format(f_obj.peak_threshold),
8787
'{}'.format(desc['peak_threshold']),
8888
'Aperiodic Mode : {}'.format(f_obj.aperiodic_mode),
8989
'{}'.format(desc['aperiodic_mode'])] if el != ''],
@@ -143,7 +143,7 @@ def gen_results_str_fm(fm, concise=False):
143143
# Peak parameters
144144
'{} peaks were found:'.format(
145145
len(fm.peak_params_)),
146-
*['CF: {:6.2f}, Amp: {:6.3f}, BW: {:5.2f}'.format(op[0], op[1], op[2]) \
146+
*['CF: {:6.2f}, PW: {:6.3f}, BW: {:5.2f}'.format(op[0], op[1], op[2]) \
147147
for op in fm.peak_params_],
148148
'',
149149

fooof/data.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
###################################################################################################
77

88
FOOOFSettings = namedtuple('FOOOFSettings', ['peak_width_limits', 'max_n_peaks',
9-
'min_peak_amplitude', 'peak_threshold',
9+
'min_peak_height', 'peak_threshold',
1010
'aperiodic_mode'])
1111
FOOOFSettings.__doc__ = """\
1212
The user defined settings for a FOOOF object.
@@ -17,10 +17,10 @@
1717
Limits on possible peak width, as (lower_bound, upper_bound).
1818
max_n_peaks : int, optional, default: inf
1919
Maximum number of gaussians to be fit in a single spectrum.
20-
min_peak_amplitude : float, optional, default: 0
21-
Minimum amplitude threshold for a peak to be modeled.
20+
min_peak_height : float, optional, default: 0
21+
Absolute threshold for detecting peaks, in units of the input data.
2222
peak_threshold : float, optional, default: 2.0
23-
Threshold for detecting peaks, units of standard deviation.
23+
Relative threshold for detecting peaks, in units of standard deviation of the input data.
2424
aperiodic_mode : {'fixed', 'knee'}
2525
Which approach to take for fitting the aperiodic component.
2626
"""
@@ -51,13 +51,14 @@
5151
Parameters that define the aperiodic fit. As [Offset, (Knee), Exponent].
5252
The knee parameter is only included if aperiodic is fit with knee.
5353
peak_params : 2d array
54-
Fitted parameter values for the peaks. Each row is a peak, as [CF, Amp, BW].
54+
Fitted parameter values for the peaks. Each row is a peak, as [CF, PW, BW].
5555
r_squared : float
5656
R-squared of the fit between the input power spectrum and the full model fit.
5757
error : float
5858
Root mean squared error of the full model fit.
5959
gaussian_params : 2d array
60-
Parameters that define the gaussian fit(s). Each row is a gaussian, as [mean, amp, std].
60+
Parameters that define the gaussian fit(s).
61+
Each row is a gaussian, as [mean, height, standard deviation].
6162
"""
6263

6364

@@ -70,9 +71,10 @@
7071
----------
7172
aperiodic_params : list, len 2 or 3
7273
Parameters that define the aperiodic fit. As [Offset, (Knee), Exponent].
73-
The knee parameter is only included if aperiodic is fit with knee. Otherwise, length is 2.
74+
The knee parameter is only included if aperiodic is fit with knee. Otherwise, length is 2.
7475
gaussian_params : list or list of lists
75-
Fitted parameter values for the peaks. Each list is a peak, as [CF, Amp, BW].
76+
Fitted parameter values for the peaks.
77+
Each list is a peak, with a gaussian definition of [mean, height, standard deviation].
7678
nlv : float
7779
Noise level added to the generated power spectrum.
7880
"""

0 commit comments

Comments
 (0)