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_seeds
int Number of seed channels to simulate.
- n_targets
int Number of target channels to simulate.
- freq_band
tupleoffloat 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_epochs
int(default 10) Number of epochs in the simulated data.
- duration
float(defaultNone) Duration of each epoch, in seconds.
Added in version 0.9.
- n_times
int(defaultNone) Number of timepoints in each epoch of the simulated data. If
n_times=Noneandduration=None, 200 samples are used, and the unit ofconnection_delayis samples. Ifn_times=Noneandduration!=None, epoch length is determined bydurationand the unit ofconnection_delayis seconds.Deprecated since version 0.9:
n_timesis deprecated and will be removed in 1.0. Usedurationinstead to specify epoch length in seconds.- sfreq
float(default 100.0) Sampling frequency of the simulated data, in Hz.
- trans_bandwidth
float(default 1.0) Transition bandwidth of the filter to apply to isolate activity in
freq_band, in Hz. These are passed to thel_bandwidthandh_bandwidthkeyword arguments inmne.filter.create_filter().- snr
float(default 0.7) Signal-to-noise ratio of the simulated data in the range [0, 1].
- connection_delay
int|float(defaultNone) Connectivity delay between the seeds and targets. If
n_timesis specified, the unit is samples, and the default (None) is 5 samples. Ifdurationis 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 thanduration.- connection_time
tupleoffloatorNone|None(defaultNone) 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 thanduration + tmin. If a given entry isNone, it will be substituted fortminorduration + tmin, as appropriate. IfNone, the connectivity is simulated throughout the whole epoch.Added in version 0.9.
- window_alpha
float(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_timeisNone.Added in version 0.9.
- tmin
float(default 0.0) Earliest time of each epoch, in seconds. Does not affect the total duration of each epoch. E.g., if
duration=2.0andtmin=-0.5, epochs will have timepoints in the range [-0.5, 1.5] seconds.- ch_names
listofstr|None(defaultNone) 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 ofn_seeds + n_targetschannel names.- ch_types
str|listofstr(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_targetschannel names.- rng_seed
int|None(defaultNone) Seed to use for the random number generator. If
None, no seed is specified.
- n_seeds
- Returns:
- epochs
EpochsArray, shape (n_epochs, n_seeds + n_targets, n_times) The simulated data stored in an
mne.EpochsArrayobject. The channels are arranged according to seeds, then targets.
- epochs
Notes
Signals are simulated as a single source of activity in the given frequency band and projected into
n_seeds + n_targetswhite 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_timeandwindow_alphaparameters, 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#
Multivariate decomposition for efficient connectivity analysis