calibrain.SourceSimulator#

class calibrain.SourceSimulator(ERP_config=None, logger=None)[source]#

Simulate synthetic source coefficients for three settings:

  1. fixed orientation (MEG and EEG):

    s shape = (N, T) One scalar coefficient per source location.

  2. free orientation (EEG):

    x shape = (N, 3, T) General 3D coefficient process in the retained local 3D source basis.

  3. free orientation (MEG):

    a shape = (N, 2, T) General reduced 2D coefficient process in the MEG-sensitive local subspace.

Methods

simulate([n_sources, nnz, orientation_type, ...])

__init__(ERP_config=None, logger=None)[source]#
Parameters:
  • ERP_config (dict, optional) –

    ERP simulation configuration. If None, defaults are used.

    Required/used keys (with defaults):

    • tminfloat, default -0.5

      Start time (s) of the epoch.

    • tmaxfloat, default 0.5

      End time (s) of the epoch.

    • stim_onsetfloat, default 0.0

      Stimulus onset time (s) within [tmin, tmax].

    • sfreqfloat, default 250

      Sampling frequency (Hz).

    • fmin, fmaxfloat, default 1, 5

      Bandpass limits (Hz) for ERP-like waveform shaping.

    • amplitude_distributiondict

      Log-normal amplitude distribution in nAm:

      • median : float, default 20.0

      • sigma : float, default 0.2

      • clip : (low, high), default (2.5, 50.0)

    • random_erp_timingbool, default True

      If True, randomize ERP segment duration and start offset after stim_onset.

    • erp_min_lengthint or None, default None

      Minimum ERP segment length in samples; if None, uses internal default (82).

  • logger (logging.Logger, optional) – Logger instance. If None, uses module logger.

simulate(n_sources=1284, nnz=5, orientation_type='fixed', coil_type=1(FIFFV_COIL_EEG), seed=42)[source]#
Return type:

Tuple[ndarray, ndarray]