mne.simulation.add_ecg¶
- mne.simulation.add_ecg(raw, head_pos=None, interp='cos2', n_jobs=1, random_state=None, verbose=None)[source]¶
Add ECG noise to raw data.
- Parameters
- rawinstance of
Raw
The raw instance to modify.
- head_pos
None
|str
|dict
|tuple
|array
Name of the position estimates file. Should be in the format of the files produced by MaxFilter. If dict, keys should be the time points and entries should be 4x4
dev_head_t
matrices. If None, the original head position (frominfo['dev_head_t']
) will be used. If tuple, should have the same format as data returned byhead_pos_to_trans_rot_t
. If array, should be of the form returned bymne.chpi.read_head_pos()
.- interp
str
Either ‘hann’, ‘cos2’ (default), ‘linear’, or ‘zero’, the type of forward-solution interpolation to use between forward solutions at different head positions.
- n_jobs
int
The number of jobs to run in parallel (default 1). Requires the joblib package.
- random_state
None
|int
| instance ofRandomState
If
random_state
is anint
, it will be used as a seed forRandomState
. IfNone
, the seed will be obtained from the operating system (seeRandomState
for details). Default isNone
. The random generator state used for blink, ECG, and sensor noise randomization.- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.
- rawinstance of
- Returns
- rawinstance of
Raw
The instance, modified in place.
- rawinstance of
See also
Notes
The ECG artifacts are generated by:
Random inter-beat intervals are drawn from a uniform distribution of times corresponding to 40 and 80 beats per minute.
The activation function is the sum of three Hanning windows with varying durations and scales to make a more complex waveform.
The activated dipole is located one (estimated) head radius to the left (-x) of head center and three head radii below (+z) head center; this dipole is oriented in the +x direction.
Activations only affect MEG channels.
The scale-factor of the activation function was chosen based on visual inspection to yield amplitudes generally consistent with those seen in experimental data. Noisy versions of the activation will be stored in the first EOG channel in the raw instance, if it exists.
New in version 0.18.