mne_connectivity.make_signals_in_freq_bands#

mne_connectivity.make_signals_in_freq_bands(n_seeds, n_targets, freq_band, *, n_epochs=10, duration=None, n_times=None, sfreq=100.0, trans_bandwidth=1.0, snr=0.7, connection_delay=None, connection_time=None, window_alpha=0.5, tmin=0.0, ch_names=None, ch_types='eeg', rng_seed=None)[source]#

Simulate signals interacting in a given frequency band.

Parameters:
n_seedsint

Number of seed channels to simulate.

n_targetsint

Number of target channels to simulate.

freq_bandtuple of float

Frequency band where the connectivity should be simulated, where the first entry corresponds to the lower frequency, and the second entry to the higher frequency.

n_epochsint (default 10)

Number of epochs in the simulated data.

durationfloat (default None)

Duration of each epoch, in seconds.

Added in version 0.9.

n_timesint (default None)

Number of timepoints in each epoch of the simulated data. If n_times=None and duration=None, 200 samples are used, and the unit of connection_delay is samples. If n_times=None and duration!=None, epoch length is determined by duration and the unit of connection_delay is seconds.

Deprecated since version 0.9: n_times is deprecated and will be removed in 1.0. Use duration instead to specify epoch length in seconds.

sfreqfloat (default 100.0)

Sampling frequency of the simulated data, in Hz.

trans_bandwidthfloat (default 1.0)

Transition bandwidth of the filter to apply to isolate activity in freq_band, in Hz. These are passed to the l_bandwidth and h_bandwidth keyword arguments in mne.filter.create_filter().

snrfloat (default 0.7)

Signal-to-noise ratio of the simulated data in the range [0, 1].

connection_delayint | float (default None)

Connectivity delay between the seeds and targets. If n_times is specified, the unit is samples, and the default (None) is 5 samples. If duration is specified, the unit is seconds, and the default (None) is 0.05 seconds. If > 0, the target data is a delayed form of the seed data. If < 0, the seed data is a delayed form of the target data. The absolute value must be less than duration.

connection_timetuple of float or None | None (default None)

Start and end times at which the interaction occurs in each epoch, in seconds. First entry must be greater than tmin, last entry must be less than duration + tmin. If a given entry is None, it will be substituted for tmin or duration + tmin, as appropriate. If None, the connectivity is simulated throughout the whole epoch.

Added in version 0.9.

window_alphafloat (default 0.5)

Fraction of the Tukey window in the cosine tapered region, used to isolate the interaction to a given time in the epochs. Must be between 0 and 1. 0 is equivalent to a rectangular window. 1 is equivalent to a Hann window. Ignored if connection_time is None.

Added in version 0.9.

tminfloat (default 0.0)

Earliest time of each epoch, in seconds. Does not affect the total duration of each epoch. E.g., if duration=2.0 and tmin=-0.5, epochs will have timepoints in the range [-0.5, 1.5] seconds.

ch_nameslist of str | None (default None)

Names of the channels in the simulated data. If None, the channels are named according to their index and the frequency band of interaction. If specified, must be a list of n_seeds + n_targets channel names.

ch_typesstr | list of str (default 'eeg')

Types of the channels in the simulated data. Must be a recognised data channel type (see data channels). If specified as a list, must be a list of n_seeds + n_targets channel names.

rng_seedint | None (default None)

Seed to use for the random number generator. If None, no seed is specified.

Returns:
epochsEpochsArray, shape (n_epochs, n_seeds + n_targets, n_times)

The simulated data stored in an mne.EpochsArray object. The channels are arranged according to seeds, then targets.

Notes

Signals are simulated as a single source of activity in the given frequency band and projected into n_seeds + n_targets white noise channels.

By default, connectivity is simulated throughout the whole epoch. However, the interaction can be isolated to a given time range using the connection_time and window_alpha parameters, mimicking an evoked potential. E.g., to simulate a burst of activity with a 200 ms duration beginning at the start of each epoch:

epochs = make_signals_in_freq_bands(
    ...,
    duration=2.0,  # 2 second epochs
    tmin=-0.5,  # make first 500 ms a pre-trial period (optional)
    connection_time=(0.0, 0.2),  # burst from 0 to 200 ms
    window_alpha=0.5,  # isolate burst with 50% cosine-tapered Tukey window
)

Added in version 0.7.

Examples using mne_connectivity.make_signals_in_freq_bands#

Compute multivariate coherency/coherence

Compute multivariate coherency/coherence

Comparison of coherency-based methods

Comparison of coherency-based methods

Multivariate decomposition for efficient connectivity analysis

Multivariate decomposition for efficient connectivity analysis