mne.simulation.add_noise#

mne.simulation.add_noise(inst, cov, iir_filter=None, verbose=None, *, rng=None, random_state=None)[source]#

Create noise as a multivariate Gaussian.

The spatial covariance of the noise is given from the cov matrix.

Parameters:
instinstance of Evoked, Epochs, or Raw

Instance to which to add noise.

covinstance of Covariance

The noise covariance.

iir_filterNone | array_like

IIR filter coefficients (denominator).

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

rngNone | int | instance of Generator | RandomState

The random number generator (RNG). If None (default), a new numpy.random.Generator seeded from entropy is used. Pass an int or a numpy.random.Generator for reproducible results, or a legacy RandomState to control the random-number stream or for interoperability with third-party code such as scikit-learn that does not accept generators. An integer seed uses numpy.random.default_rng() and therefore produces a different stream than the same integer passed to a legacy random_state or seed parameter.

New in v1.13.

random_stateNone | int | instance of RandomState

Supported for compatibility. New code should use rng. If None, NumPy’s global RandomState is used.

Returns:
instsame type as the input data

The instance, modified to have additional noise.

Notes

Only channels in both inst.info['ch_names'] and cov['names'] will have noise added to them.

This function operates inplace on inst.

New in v0.18.0.

Examples using mne.simulation.add_noise#

Compare simulated and estimated source activity

Compare simulated and estimated source activity

Generate simulated raw data

Generate simulated raw data

Simulate raw data using subject anatomy

Simulate raw data using subject anatomy

Generate simulated source data

Generate simulated source data

DICS for power mapping

DICS for power mapping