mne.simulation.SourceSimulator¶
-
class
mne.simulation.
SourceSimulator
(src, tstep=0.001, duration=None)[source]¶ Class to generate simulated Source Estimates.
- Parameters
- srcinstance of
SourceSpaces
Source space.
- tstep
float
Time step between successive samples in data. Default is 0.001 sec.
- duration
float
|None
Time interval during which the simulation takes place in seconds. If None, it is computed using existing events and waveform lengths.
- srcinstance of
- Attributes
Methods
__hash__
(/)Return hash(self).
__iter__
()Iterate over 1 second STCs.
add_data
(label, waveform, events)Add data to the simulation.
get_stc
([start_sample, stop_sample])Simulate a SourceEstimate from the provided data.
get_stim_channel
([start_sample, stop_sample])Get the stim channel from the provided data.
-
add_data
(label, waveform, events)[source]¶ Add data to the simulation.
Data should be added in the form of a triplet of Label (Where) - Waveform(s) (What) - Event(s) (When)
- Parameters
- labelinstance of
Label
The label (as created for example by mne.read_label). If the label does not match any sources in the SourceEstimate, a ValueError is raised.
- waveform
array
, shape (n_times,) or (n_events, n_times) |list
The waveform(s) describing the activity on the label vertices. If list, it must have the same length as events.
- events
array
ofint
, shape (n_events, 3) Events associated to the waveform(s) to specify when the activity should occur.
- labelinstance of
Examples using
add_data
:
-
property
duration
¶ Duration of the simulation
-
get_stc
(start_sample=0, stop_sample=None)[source]¶ Simulate a SourceEstimate from the provided data.
Returns a SourceEstimate object constructed according to the simulation parameters which should be added through function add_data. If both start_sample and stop_sample are not specified, the entire duration is used.
- Parameters
- Returns
- stc
SourceEstimate
object The generated source time courses.
- stc
Examples using
get_stc
:
-
get_stim_channel
(start_sample=0, stop_sample=None)[source]¶ Get the stim channel from the provided data.
Returns the stim channel data according to the simulation parameters which should be added through function add_data. If both start_sample and stop_sample are not specified, the entire duration is used.
- Parameters
- Returns
-
property
n_times
¶ Number of time samples in the simulation