Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions specparam/modes/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
name='fixed',
component='aperiodic',
description='Fit an exponential, with no knee.',
formula=None,
func=expo_nk_function,
jacobian=None,
params=params_fixed,
Expand All @@ -45,6 +46,7 @@
name='knee',
component='aperiodic',
description='Fit an exponential, with a knee.',
formula=None,
func=expo_function,
jacobian=None,
params=params_knee,
Expand All @@ -67,6 +69,7 @@
name='doublexp',
component='aperiodic',
description='Fit an function with 2 exponents and a knee.',
formula=None,
func=double_expo_function,
jacobian=None,
params=params_doublexp,
Expand Down Expand Up @@ -98,6 +101,7 @@
name='gaussian',
component='periodic',
description='Gaussian peak fit function.',
formula=None,
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=None,
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=None,
func=cauchy_function,
jacobian=None,
params=params_cauchy,
Expand Down
7 changes: 5 additions & 2 deletions specparam/modes/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Mode():
Which component the mode relates to.
description : str
Description of the mode.
formula : str
Formula of the fit mode.
func : callable
Function that defines the fit function for the mode.
jacobian : callable, optional
Expand All @@ -37,13 +39,14 @@ class Mode():
Required spacing of the power values for this mode.
"""

def __init__(self, name, component, description, func, jacobian,
params, ndim, freq_space, powers_space):
def __init__(self, name, component, description, formula, func,
jacobian, params, ndim, freq_space, powers_space):
"""Initialize a mode."""

self.name = name
self.component = check_input_options(component, VALID_COMPONENTS, 'component')
self.description = description
self.formula = formula

self.func = func
self.jacobian = jacobian
Expand Down
8 changes: 4 additions & 4 deletions specparam/tests/modes/test_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def tfit(xs, *params):
}))

tmode = Mode(name='tmode', component='periodic', description='test_desc',
func=tfit, jacobian=None, params=params, ndim=1,
freq_space='linear', powers_space='linear')
formula='tformula', func=tfit, jacobian=None, params=params,
ndim=1, freq_space='linear', powers_space='linear')
assert tmode
assert tmode.n_params == params.n_params
tmode.check_params()
Expand All @@ -37,7 +37,7 @@ def tfit2(xs, *params):
}

tmode = Mode(name='tmode', component='aperiodic', description='test_desc2',
func=tfit2, jacobian=None, params=params, ndim=2,
freq_space='linear', powers_space='linear')
formula='tformula', func=tfit2, jacobian=None, params=params,
ndim=2, freq_space='linear', powers_space='linear')
assert tmode
assert isinstance(tmode.params, ParamDefinition)