Skip to content
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Overview

The power spectrum model conceives of a model of the power spectrum as a combination of two distinct functional processes:

- An aperiodic component, reflecting 1/f like characteristics, with
- An aperiodic component, with power across all frequencies (e.g. 1/f-like characteristics), with
- A variable number of periodic components (putative oscillations), as peaks rising above the aperiodic component

This model driven approach can be used to measure periodic and aperiodic properties of electrophysiological data,
Expand Down
40 changes: 23 additions & 17 deletions specparam/modes/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,58 @@

from specparam.modes.mode import Mode
from specparam.modes.params import ParamDefinition
from specparam.modes.funcs import (expo_function, expo_nk_function, double_expo_function,
from specparam.modes.funcs import (powerlaw_function, lorentzian_function, double_expo_function,
gaussian_function, skewed_gaussian_function, cauchy_function)
from specparam.modes.jacobians import jacobian_gauss
from specparam.utils.checks import check_selection

###################################################################################################
## APERIODIC MODES

## AP - Fixed Mode
## AP - Powerlaw (1/f) Mode ('fixed')

params_fixed = ParamDefinition(OrderedDict({
params_powerlaw = ParamDefinition(OrderedDict({
'offset' : 'Offset of the aperiodic component.',
'exponent' : 'Exponent of the aperiodic component.',
}))

ap_fixed = Mode(
ap_powerlaw = Mode(
name='fixed',
component='aperiodic',
description='Fit an exponential, with no knee.',
func=expo_nk_function,
description='One-over-f (powerlaw) function.',
formula=r'A(F) = 10^b * \frac{1}{F^\chi}',
func=powerlaw_function,
jacobian=None,
params=params_fixed,
params=params_powerlaw,
ndim=1,
freq_space='linear',
powers_space='log10',
)


## AP - Knee Mode
## AP - Lorentzian Mode ('knee')

params_knee = ParamDefinition(OrderedDict({
params_lorentzian = ParamDefinition(OrderedDict({
'offset' : 'Offset of the aperiodic component.',
'knee' : 'Knee of the aperiodic component.',
'exponent' : 'Exponent of the aperiodic component.',
}))

ap_knee = Mode(
ap_lorentzian = Mode(
name='knee',
component='aperiodic',
description='Fit an exponential, with a knee.',
func=expo_function,
description='Lorentzian function, with a powerlaw exponent and a knee.',
formula=r'A(F) = 10^b * \frac{1}{(k + F^\chi)}',
func=lorentzian_function,
jacobian=None,
params=params_knee,
params=params_lorentzian,
ndim=1,
freq_space='linear',
powers_space='log10',
)


## AP - Double Exponent Mode
## AP - Double Exponent Mode ('doublexp')

params_doublexp = ParamDefinition(OrderedDict({
'offset' : 'Offset of the aperiodic component.',
Expand All @@ -66,7 +68,8 @@
ap_doublexp = Mode(
name='doublexp',
component='aperiodic',
description='Fit an function with 2 exponents and a knee.',
description='Multi-fractal powerlaw function with 2 exponents and a knee.',
formula=r'A(F) = 10^b * \frac{1}{F^{\chi_{0}} * (k + F^{\chi_{1}})}',
func=double_expo_function,
jacobian=None,
params=params_doublexp,
Expand All @@ -78,8 +81,8 @@

# Collect available aperiodic modes
AP_MODES = {
'fixed' : ap_fixed,
'knee' : ap_knee,
'fixed' : ap_powerlaw,
'knee' : ap_lorentzian,
'doublexp' : ap_doublexp,
}

Expand All @@ -98,6 +101,7 @@
name='gaussian',
component='periodic',
description='Gaussian peak fit function.',
formula=r'P(F)_n = a * exp (\frac{- (F - c)^2}{2 * w^2})',
func=gaussian_function,
jacobian=jacobian_gauss,
params=params_gauss,
Expand All @@ -120,6 +124,7 @@
name='skewed_gaussian',
component='periodic',
description='Skewed Gaussian peak fit function.',
formula=r'P(F)_n = \frac{2}{w\sqrt{2\pi}} e^{\frac{(F - \epsilon)^2} {2w^2}}',
func=skewed_gaussian_function,
jacobian=None,
params=params_skewed_gaussian,
Expand All @@ -141,6 +146,7 @@
name='cauchy',
component='periodic',
description='Cauchy peak fit function.',
formula=r'P(F)_n = a * \frac {w^2} {(F - c)^2 + w^2}',
func=cauchy_function,
jacobian=None,
params=params_cauchy,
Expand Down
Loading
Loading