neurodsp.sim.params.SimParams

class neurodsp.sim.params.SimParams(n_seconds=None, fs=None)[source]

Object for managing simulation parameters.

Parameters:
n_secondsfloat

Simulation time, in seconds.

fsfloat

Sampling rate of simulated signal, in Hz.

Attributes:
basedict

Get the base parameters, common across all simulations.

paramsdict

Get the set of currently defined simulation parameters.

__init__(n_seconds=None, fs=None)[source]

Initialize SimParams object.

Methods

__init__([n_seconds, fs])

Initialize SimParams object.

clear([clear_base])

"Clear parameter definitions.

copy()

Return a copy of the current object.

make_params([params])

Make a simulation parameter definition from given parameters.

register(label[, params])

Register a new simulation parameter definition.

register_group(group[, clear])

Register multiple simulation parameter definitions.

to_iters()

Convert to a SimIters object.

to_samplers([n_samples])

Convert to a SimSamplers object.

update_base([n_seconds, fs])

Update base parameters.

update_param(label, attribute, new_value)

Update a simulation parameter definition.

Attributes

base

Get the base parameters, common across all simulations.

labels

Get the set of labels for the defined parameters.

params

Get the set of currently defined simulation parameters.

property base

Get the base parameters, common across all simulations.

Returns:
base_paramsdict

Definition of the current base parameters.

clear(clear_base=False)[source]

“Clear parameter definitions.

Parameters:
clear_basebool, optional, default: False

Whether to also clear base parameters.

copy()[source]

Return a copy of the current object.

property labels

Get the set of labels for the defined parameters.

Returns:
labelslist of str

Labels for all defined simulation parameters.

make_params(params=None, **kwargs)[source]

Make a simulation parameter definition from given parameters.

Parameters:
paramsdict or list of dict

Parameter definition(s) to create simulation parameter definition.

**kwargs

Additional keyword arguments to create the simulation definition.

Returns:
paramsdict

Parameter definition.

property params

Get the set of currently defined simulation parameters.

Returns:
paramsdict

Dictionary of currently defined simulation parameters. Each key is a label for the parameter definition. Each value is a dictionary of simulations parameters.

register(label, params=None, **kwargs)[source]

Register a new simulation parameter definition.

Parameters:
labelstr

Label to set simulation parameters under in params.

paramsdict or list of dict

Parameter definition(s) to create simulation parameter definition.

**kwargs

Additional keyword arguments to create the simulation definition.

register_group(group, clear=False)[source]

Register multiple simulation parameter definitions.

Parameters:
groupdict

Dictionary of simulation parameters. Each key should be a label, and each set of values a dictionary of parameters.

clearbool, optional, default: False

If True, clears current parameter definitions before adding new group.

to_iters()[source]

Convert to a SimIters object.

Returns:
itersSimIters

A converted object, initialized with the current base parameters.

to_samplers(n_samples=None)[source]

Convert to a SimSamplers object.

Parameters:
n_samplesint, optional

The number of parameter iterations to set as max. If None, samplers are created as infinite generators.

Returns:
samplersSimSamplers

A converted object, initialized with the current base parameters.

update_base(n_seconds=False, fs=False)[source]

Update base parameters.

Parameters:
n_secondsfloat, optional

Simulation time, in seconds.

fsfloat, optional

Sampling rate of simulated signal, in Hz.

Notes

If set as False, value will not be updated. If set as None, value will be updated to None.

update_param(label, attribute, new_value)[source]

Update a simulation parameter definition.

Parameters:
labelstr

Label for the parameter definition.

attributestr

Name of the attribute to update.

new_valueobj

New value to give the attribute.

Examples using neurodsp.sim.params.SimParams

Managing Simulation Parameters

Managing Simulation Parameters