mne.simulation.simulate_sparse_stc#
- mne.simulation.simulate_sparse_stc(src, n_dipoles, times, data_fun=<function <lambda>>, labels=None, random_state=None, location='random', subject=None, subjects_dir=None, surf='sphere')[source]#
Generate sparse (n_dipoles) sources time courses from data_fun.
This function randomly selects
n_dipoles
vertices in the whole cortex or one single vertex (randomly in or in the center of) each label iflabels is not None
. It usesdata_fun
to generate waveforms for each vertex.- Parameters:
- srcinstance of
SourceSpaces
The source space.
- n_dipoles
int
Number of dipoles to simulate.
- times
array
Time array.
- data_fun
callable()
Function to generate the waveforms. The default is a 100 nAm, 10 Hz sinusoid as
1e-7 * np.sin(20 * pi * t)
. The function should take as input the array of time samples in seconds and return an array of the same length containing the time courses.- labels
None
|list
ofLabel
The labels. The default is None, otherwise its size must be n_dipoles.
- random_state
None
|int
| instance ofRandomState
A seed for the NumPy random number generator (RNG). If
None
(default), the seed will be obtained from the operating system (seeRandomState
for details), meaning it will most likely produce different output every time this function or method is run. To achieve reproducible results, pass a value here to explicitly initialize the RNG with a defined state.- location
str
The label location to choose. Can be
'random'
(default) or'center'
to usemne.Label.center_of_mass()
. Note that for'center'
mode the label values are used as weights.New in v0.13.
- subject
str
|None
The subject the label is defined for. Only used with
location='center'
.New in v0.13.
- subjects_dirpath-like |
None
The path to the directory containing the FreeSurfer subjects reconstructions. If
None
, defaults to theSUBJECTS_DIR
environment variable.New in v0.13.
- surf
str
The surface to use for Euclidean distance center of mass finding. The default here is “sphere”, which finds the center of mass on the spherical surface to help avoid potential issues with cortical folding.
New in v0.13.
- srcinstance of
- Returns:
- stc
SourceEstimate
The generated source time courses.
- stc
See also
Notes
New in v0.10.0.
Examples using mne.simulation.simulate_sparse_stc
#
Generate simulated evoked data
Cortical Signal Suppression (CSS) for removal of cortical signals