mne.
VectorSourceEstimate
(data, vertices=None, tmin=None, tstep=None, subject=None, verbose=None)[source]¶Container for vector surface source estimates.
For each vertex, the magnitude of the current is defined in the X, Y and Z directions.
Parameters: | data : array of shape (n_dipoles, 3, n_times)
vertices : array | list of two arrays
tmin : float
tstep : float
subject : str | None
verbose : bool, str, int, or None
|
---|
See also
SourceEstimate
VolSourceEstimate
MixedSourceEstimate
Notes
New in version 0.15.
Attributes
times |
A timestamp for each sample. |
shape |
Shape of the data. |
subject | (str | None) The subject name. |
Methods
__add__ (a) |
Add source estimates. |
__div__ (a) |
Divide source estimates. |
__hash__ () <==> hash(x) |
|
__mul__ (a) |
Multiply source estimates. |
__neg__ () |
Negate the source estimate. |
__sub__ (a) |
Subtract source estimates. |
bin (width[, tstart, tstop, func]) |
Return a source estimate object with data summarized over time bins. |
copy () |
Return copy of source estimate instance. |
crop ([tmin, tmax]) |
Restrict SourceEstimate to a time interval. |
expand (vertices) |
Expand SourceEstimate to include more vertices. |
in_label (label) |
Get a source estimate object restricted to a label. |
magnitude () |
Compute magnitude of activity without directionality. |
mean () |
Make a summary stc file with mean power between tmin and tmax. |
morph (subject_to[, grade, smooth, …]) |
Morph a source estimate from one subject to another. |
morph_precomputed (subject_to, vertices_to, …) |
Morph source estimate between subjects using a precomputed matrix. |
normal (src) |
Compute activity orthogonal to the cortex. |
plot ([subject, hemi, colormap, time_label, …]) |
Plot VectorSourceEstimates with PySurfer. |
resample (sfreq[, npad, window, n_jobs, verbose]) |
Resample data. |
save (fname[, ftype, verbose]) |
Save the full source estimate to an HDF5 file. |
sqrt () |
Take the square root. |
time_as_index (times[, use_rounding]) |
Convert time to indices. |
to_data_frame ([picks, index, scaling_time, …]) |
Export data in tabular structure as a pandas DataFrame. |
to_original_src (src_orig[, subject_orig, …]) |
Get a source estimate from morphed source to the original subject. |
transform (func[, idx, tmin, tmax, copy]) |
Apply linear transform. |
transform_data (func[, idx, tmin_idx, tmax_idx]) |
Get data after a linear (time) transform has been applied. |
__hash__
() <==> hash(x)¶bin
(width, tstart=None, tstop=None, func=<function mean>)[source]¶Return a source estimate object with data summarized over time bins.
Time bins of width
seconds. This method is intended for
visualization only. No filter is applied to the data before binning,
making the method inappropriate as a tool for downsampling data.
Parameters: | width : scalar
tstart : scalar | None
tstop : scalar | None
func : callable
|
---|---|
Returns: | stc : SourceEstimate | VectorSourceEstimate
|
crop
(tmin=None, tmax=None)[source]¶Restrict SourceEstimate to a time interval.
Parameters: | tmin : float | None
tmax : float | None
|
---|
data
¶Numpy array of source estimate data.
expand
(vertices)[source]¶Expand SourceEstimate to include more vertices.
This will add rows to stc.data (zero-filled) and modify stc.vertices to include all vertices in stc.vertices and the input vertices.
Parameters: | vertices : list of array
|
---|---|
Returns: | stc : SourceEstimate | VectorSourceEstimate
|
in_label
(label)[source]¶Get a source estimate object restricted to a label.
SourceEstimate contains the time course of activation of all sources inside the label.
Parameters: | label : Label | BiHemiLabel
|
---|---|
Returns: | stc : SourceEstimate | VectorSourceEstimate
|
lh_data
¶Left hemisphere data.
lh_vertno
¶Left hemisphere vertno.
magnitude
()[source]¶Compute magnitude of activity without directionality.
Returns: | stc : instance of SourceEstimate
|
---|
mean
()[source]¶Make a summary stc file with mean power between tmin and tmax.
Returns: | stc : SourceEstimate | VectorSourceEstimate
|
---|
morph
(subject_to, grade=5, smooth=None, subjects_dir=None, buffer_size=64, n_jobs=1, subject_from=None, sparse=False, verbose=None)[source]¶Morph a source estimate from one subject to another.
Parameters: | subject_to : string
grade : int, list (of two arrays), or None
smooth : int or None
subjects_dir : string, or None
buffer_size : int
n_jobs : int
subject_from : string
sparse : bool
verbose : bool, str, int, or None
|
---|---|
Returns: | stc_to : SourceEstimate | VectorSourceEstimate
|
morph_precomputed
(subject_to, vertices_to, morph_mat, subject_from=None)[source]¶Morph source estimate between subjects using a precomputed matrix.
Parameters: | subject_to : string
vertices_to : list of array of int
morph_mat : sparse matrix
subject_from : string | None
|
---|---|
Returns: | stc_to : SourceEstimate | VectorSourceEstimate
|
normal
(src)[source]¶Compute activity orthogonal to the cortex.
Parameters: | src : instance of SourceSpaces
|
---|---|
Returns: | stc : instance of SourceEstimate
|
plot
(subject=None, hemi='lh', colormap='hot', time_label='auto', smoothing_steps=10, transparent=None, brain_alpha=0.4, overlay_alpha=None, vector_alpha=1.0, scale_factor=None, time_viewer=False, subjects_dir=None, figure=None, views='lat', colorbar=True, clim='auto', cortex='classic', size=800, background='black', foreground='white', initial_time=None, time_unit='s')[source]¶Plot VectorSourceEstimates with PySurfer.
A “glass brain” is drawn and all dipoles defined in the source estimate are shown using arrows, depicting the direction and magnitude of the current moment at the dipole. Additionally, an overlay is plotted on top of the cortex with the magnitude of the current.
Parameters: | subject : str | None
hemi : str, ‘lh’ | ‘rh’ | ‘split’ | ‘both’
colormap : str | np.ndarray of float, shape(n_colors, 3 | 4)
time_label : str | callable | None
smoothing_steps : int
transparent : bool | None
brain_alpha : float
overlay_alpha : float
vector_alpha : float
scale_factor : float | None
time_viewer : bool
subjects_dir : str
figure : instance of mayavi.core.scene.Scene | list | int | None
views : str | list
colorbar : bool
clim : str | dict
cortex : str or tuple
size : float or pair of floats
background : matplotlib color
foreground : matplotlib color
initial_time : float | None
time_unit : ‘s’ | ‘ms’
|
---|---|
Returns: | brain : Brain
|
Notes
New in version 0.15.
If the current magnitude overlay is not desired, set overlay_alpha=0
and smoothing_steps=1
.
resample
(sfreq, npad='auto', window='boxcar', n_jobs=1, verbose=None)[source]¶Resample data.
Parameters: | sfreq : float
npad : int | str
window : string or tuple
n_jobs : int
verbose : bool, str, int, or None
|
---|
Notes
For some data, it may be more accurate to use npad=0 to reduce artifacts. This is dataset dependent – check your data!
Note that the sample rate of the original data is inferred from tstep.
rh_data
¶Right hemisphere data.
rh_vertno
¶Right hemisphere vertno.
save
(fname, ftype='h5', verbose=None)[source]¶Save the full source estimate to an HDF5 file.
Parameters: | fname : string
ftype : string
verbose : bool, str, int, or None
|
---|
sfreq
¶Sample rate of the data.
shape
¶Shape of the data.
sqrt
()[source]¶Take the square root.
Returns: | stc : instance of SourceEstimate
|
---|
time_as_index
(times, use_rounding=False)[source]¶Convert time to indices.
Parameters: | times : list-like | float | int
use_rounding : boolean
|
---|---|
Returns: | index : ndarray
|
times
¶A timestamp for each sample.
tmin
¶The first timestamp.
to_data_frame
(picks=None, index=None, scaling_time=1000.0, scalings=None, copy=True, start=None, stop=None, scale_time=None)[source]¶Export data in tabular structure as a pandas DataFrame.
Columns and indices will depend on the object being converted. Generally this will include as much relevant information as possible for the data type being converted. This makes it easy to convert data for use in packages that utilize dataframes, such as statsmodels or seaborn.
Parameters: | picks : array-like of int | None
index : tuple of str | None
scaling_time : float
scalings : dict | None
copy : bool
start : int | None
stop : int | None
|
---|---|
Returns: | df : instance of pandas.core.DataFrame
|
to_original_src
(src_orig, subject_orig=None, subjects_dir=None, verbose=None)[source]¶Get a source estimate from morphed source to the original subject.
Parameters: | src_orig : instance of SourceSpaces
subject_orig : str | None
subjects_dir : string, or None
verbose : bool, str, int, or None
|
---|---|
Returns: | stc : SourceEstimate | VectorSourceEstimate
|
See also
Notes
New in version 0.10.0.
transform
(func, idx=None, tmin=None, tmax=None, copy=False)[source]¶Apply linear transform.
The transform is applied to each source time course independently.
Parameters: | func : callable
idx : array | None
tmin : float | int | None
tmax : float | int | None
copy : bool
|
---|---|
Returns: | stcs : SourceEstimate | VectorSourceEstimate | list
|
Notes
Applying transforms can be significantly faster if the SourceEstimate object was created using “(kernel, sens_data)”, for the “data” parameter as the transform is applied in sensor space. Inverse methods, e.g., “apply_inverse_epochs”, or “lcmv_epochs” do this automatically (if possible).
transform_data
(func, idx=None, tmin_idx=None, tmax_idx=None)[source]¶Get data after a linear (time) transform has been applied.
The transform is applied to each source time course independently.
Parameters: | func : callable
idx : array | None
tmin_idx : int | None
tmax_idx : int | None
|
---|---|
Returns: | data_t : ndarray
|
Notes
Applying transforms can be significantly faster if the SourceEstimate object was created using “(kernel, sens_data)”, for the “data” parameter as the transform is applied in sensor space. Inverse methods, e.g., “apply_inverse_epochs”, or “lcmv_epochs” do this automatically (if possible).
tstep
¶The change in time between two consecutive samples (1 / sfreq).