specparam.modes.Mode

class specparam.modes.Mode(name, component, description, formula, func, jacobian, params, ndim, freq_space, powers_space)[source]

Defines a fit mode.

Parameters:
namestr

Name of the mode.

component{‘aperiodic’, ‘periodic’},

Which component the mode relates to.

descriptionstr

Description of the mode.

formulastr

Formula of the fit mode.

funccallable

Function that defines the fit function for the mode.

jacobiancallable, optional

Function for computing Jacobian matrix corresponding to func.

paramsdict or ParamDefinition

Parameter definition.

ndim{1, 2}

Dimensionality of the parameters. This reflects whether they require a 1d or 2d array to store.

freq_space{‘linear’, ‘log10’}

Required spacing of the frequency values for this mode.

powers_space{‘linear’, ‘log10’}

Required spacing of the power values for this mode.

__init__(name, component, description, formula, func, jacobian, params, ndim, freq_space, powers_space)[source]

Initialize a mode.

Methods

__init__(name, component, description, ...)

Initialize a mode.

generate(freqs, *params)

Generate component values from component function.

print([info, description, concise])

Print out current mode.

Attributes

n_params

Define property attribute to access the number of parameters.

generate(freqs, *params)[source]

Generate component values from component function.

Parameters:
freqs1d array

Frequency values to generate component for.

*params

Parameters for the fit mode to generate with.

Returns:
1d array

Generated component values.

property n_params

Define property attribute to access the number of parameters.

print(info='all', description=False, concise=False)[source]

Print out current mode.

Parameters:
info{‘all’, ‘mode’, ‘params’}
Which information to print:

‘all’: print all information on the mode ‘mode’: print information on the mode ‘params’: print information on the parameters of the mode

descriptionbool, optional, default: False

Whether to print out a description with current mode.

concisebool, optional, default: False

Whether to print a concise version of the report.

Examples using specparam.modes.Mode

Plot Model Components

Plot Model Components

Custom Modes

Custom Modes

Model Sub-Objects

Model Sub-Objects

Developmental Data Demo

Developmental Data Demo

03: Fitting Algorithm

03: Fitting Algorithm