Repository navigation
Expand file tree
/
Copy pathdata.py
More file actions
80 lines (65 loc) · 3 KB
/
Copy pathdata.py
File metadata and controls
80 lines (65 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<
8000
div data-line-number="50" class="react-line-number react-code-text" style="padding-right:16px">5051
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""Data objects for FOOOF."""
from collections import namedtuple
###################################################################################################
###################################################################################################
FOOOFSettings = namedtuple('FOOOFSettings', ['peak_width_limits', 'max_n_peaks',
'min_peak_height', 'peak_threshold',
'aperiodic_mode'])
FOOOFSettings.__doc__ = """\
The user defined settings for a FOOOF object.
Attributes
----------
peak_width_limits : tuple of (float, float), optional, default: (0.5, 12.0)
Limits on possible peak width, as (lower_bound, upper_bound).
max_n_peaks : int, optional, default: inf
Maximum number of gaussians to be fit in a single spectrum.
min_peak_height : float, optional, default: 0
Absolute threshold for detecting peaks, in units of the input data.
peak_threshold : float, optional, default: 2.0
Relative threshold for detecting peaks, in units of standard deviation of the input data.
aperiodic_mode : {'fixed', 'knee'}
Which approach to take for fitting the aperiodic component.
"""
FOOOFDataInfo = namedtuple('FOOOFDataInfo', ['freq_range', 'freq_res'])
FOOOFDataInfo.__doc__ = """\
Data related information for a FOOOF object.
Attributes
----------
freq_range : list of [float, float]
Frequency range of the power spectrum, as [lowest_freq, highest_freq].
freq_res : float
Frequency resolution of the power spectrum.
"""
FOOOFResults = namedtuple('FOOOFResults', ['aperiodic_params', 'peak_params',
'r_squared', 'error', 'gaussian_params'])
FOOOFResults.__doc__ = """\
The resulting parameters and associated data of a FOOOF model fit.
Attributes
----------
aperiodic_params : 1d array
Parameters that define the aperiodic fit. As [Offset, (Knee), Exponent].
The knee parameter is only included if aperiodic is fit with knee.
peak_params : 2d array
Fitted parameter values for the peaks. Each row is a peak, as [CF, PW, BW].
r_squared : float
R-squared of the fit between the input power spectrum and the full model fit.
error : float
Root mean squared error of the full model fit.
gaussian_params : 2d array
Parameters that define the gaussian fit(s).
Each row is a gaussian, as [mean, height, standard deviation].
"""
SynParams = namedtuple('SynParams', ['aperiodic_params', 'gaussian_params', 'nlv'])
SynParams.__doc__ = """\
Stores parameters used to synthesize a single power spectra.
Attributes
----------
aperiodic_params : list, len 2 or 3
Parameters that define the aperiodic fit. As [Offset, (Knee), Exponent].
The knee parameter is only included if aperiodic is fit with knee. Otherwise, length is 2.
gaussian_params : list or list of lists
Fitted parameter values for the peaks.
Each list is a peak, with a gaussian definition of [mean, height, standard deviation].
nlv : float
Noise level added to the generated power spectrum.
"""