mne.simulation.SourceSimulator#
- class mne.simulation.SourceSimulator(src, tstep=0.001, duration=None, first_samp=0)[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.
- first_samp
int
First sample from which the simulation takes place, as an integer. Comparable to the first_samp property of
Raw
objects. Default is 0.
- srcinstance of
- Attributes:
Methods
__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
:Compare simulated and estimated source activity
Compare simulated and estimated source activitySimulate raw data using subject anatomy
Simulate raw data using subject anatomyGenerate simulated source data
Generate simulated source data
- property duration#
Duration of the simulation in same units as tstep.
- get_stc(start_sample=None, 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
:Compare simulated and estimated source activity
Compare simulated and estimated source activitySimulate raw data using subject anatomy
Simulate raw data using subject anatomy
- 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 the add_data method. 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.
Examples using mne.simulation.SourceSimulator
#
Compare simulated and estimated source activity
Simulate raw data using subject anatomy
Generate simulated source data