Skip to content

Commit a7d583b

Browse files
committed
Update all references to amp/amplitude to height or power
1 parent 4b6e497 commit a7d583b

File tree

12 files changed

+98
-92
lines changed

12 files changed

+98
-92
lines changed

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
----------

fooof/analysis.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ def get_band_peak_group(peak_params, band_def, n_fits):
1313
peak_params : 2d array
1414
Peak parameters, for a group fit, from FOOOF, with shape of [n_peaks, 4].
1515
band_def : [float, float]
16-
Defines the band of interest, as [lower_frequency_bound, upper_frequency_bound].
16+
Defines the band of interest, as [lower_frequency_bound, upper_frequency_bound], in Hz.
1717
n_fits : int
1818
The number of model fits in the FOOOFGroup data.
1919
2020
Returns
2121
-------
2222
band_peaks : 2d array
23-
Peak data. Each row is a peak, as [CF, Amp, BW].
23+
Peak data. Each row is a peak, as [CF, PW, BW].
2424
2525
Notes
2626
-----
@@ -59,12 +59,12 @@ def get_band_peak(peak_params, band_def, ret_one=True):
5959
Defines the band of interest, as [lower_frequency_bound, upper_frequency_bound].
6060
ret_one : bool, optional, default: True
6161
Whether to return single peak (if True) or all peaks within the range found (if False).
62-
If True, returns the highest amplitude peak within the search range.
62+
If True, returns the highest peak within the search range.
6363
6464
Returns
6565
-------
6666
band_peaks : 1d or 2d array
67-
Peak data. Each row is a peak, as [CF, Amp, BW]
67+
Peak data. Each row is a peak, as [CF, PW, BW]
6868
"""
6969

7070
# Return nan array if empty input
@@ -82,17 +82,17 @@ def get_band_peak(peak_params, band_def, ret_one=True):
8282

8383
band_peaks = peak_params[peak_inds, :]
8484

85-
# If results > 1 and ret_one, then we return the highest amplitude peak
85+
# If results > 1 and ret_one, then we return the highest peak
8686
# Call a sub-function to select highest power peak in band
8787
if n_peaks > 1 and ret_one:
88-
band_peaks = get_highest_amp_peak(band_peaks)
88+
band_peaks = get_highest_peak(band_peaks)
8989

9090
# If results == 1, return peak - [cen, power, bw]
9191
return np.squeeze(band_peaks)
9292

9393

94-
def get_highest_amp_peak(band_peaks):
95-
"""Searches for the highest amplitude peak.
94+
def get_highest_peak(band_peaks):
95+
"""Searches for the highest peak.
9696
9797
Parameters
9898
----------
@@ -102,7 +102,7 @@ def get_highest_amp_peak(band_peaks):
102102
Returns
103103
-------
104104
band_peaks : array
105-
Peak data. Each row is a peak, as [CF, Amp, BW].
105+
Peak data. Each row is a peak, as [CF, PW, BW].
106106
"""
107107

108108
# 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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 4 additions & 4 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_height' : '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_height),
84+
'Minimum Peak Height : {}'.format(f_obj.min_peak_height),
8585
'{}'.format(desc['min_peak_height']),
86-
'Amplitude Threshold: {}'.format(f_obj.peak_threshold),
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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
max_n_peaks : int, optional, default: inf
1919
Maximum number of gaussians to be fit in a single spectrum.
2020
min_peak_height : float, optional, default: 0
21-
Minimum amplitude threshold for a peak to be modeled.
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)