osl_ephys.utils.simulate#

Utility functions for simulating data.

Attributes#

fname

Functions#

simulate_data(model[, num_samples, num_realisations, ...])

Simulate data from a linear model.

simulate_raw_from_template(sim_samples[, ...])

Simulate raw MEG data from a 306-channel MEGIN template.

simulate_rest_mvar(raw, sim_samples[, mvar_pca, ...])

Simulate resting state data from a raw object using a reduced MVAR model.

Module Contents#

osl_ephys.utils.simulate.simulate_data(model, num_samples=1000, num_realisations=1, use_cov=True, noise=None)[source]#

Simulate data from a linear model.

Parameters:
  • model (sails.AbstractLinearModel) – A linear model object.

  • num_samples (int) – The number of samples to simulate.

  • num_realisations (int) – The number of realisations to simulate.

  • use_cov (bool) – Whether to use the residual covariance matrix.

Returns:

Y – The simulated data.

Return type:

ndarray, shape (num_sources, num_samples, num_realisations)

osl_ephys.utils.simulate.simulate_raw_from_template(sim_samples, bad_segments=None, bad_channels=None, flat_channels=None, noise=None)[source]#

Simulate raw MEG data from a 306-channel MEGIN template.

Parameters:
  • sim_samples (int) – The number of samples to simulate.

  • bad_segments (list of tuples) – The bad segments to simulate.

  • bad_channels (list of ints) – The bad channels to simulate.

  • flat_channels (list of ints) – The flat channels to simulate.

Returns:

sim – The simulated data.

Return type:

mne.io.Raw

osl_ephys.utils.simulate.simulate_rest_mvar(raw, sim_samples, mvar_pca=32, mvar_order=12, picks=None, modalities=None, drop_dig=False)[source]#

Simulate resting state data from a raw object using a reduced MVAR model.

Parameters:
  • raw (mne.io.Raw) – The raw object to simulate from.

  • sim_samples (int) – The number of samples to simulate.

  • mvar_pca (int) – The number of PCA components to use.

  • mvar_order (int) – The MVAR model order.

  • picks (dict) – The picks to use. See mne.pick_types.

  • modalities (list of str) – The modalities to use. See mne.pick_types.

  • drop_dig (bool) – Whether to drop the digitisation points.

Returns:

sim – The simulated data.

Return type:

mne.io.Raw

Notes

Best used on low sample rate data <200Hz. fiff only for now.

osl_ephys.utils.simulate.fname = '/Users/andrew/Projects/ntad/raw_data/meeg_pilots/NTAD_Neo_Pilot2_RSO.fif'[source]#