本文整理汇总了Python中mne.io.Raw._data[picks,time_slice]方法的典型用法代码示例。如果您正苦于以下问题:Python Raw._data[picks,time_slice]方法的具体用法?Python Raw._data[picks,time_slice]怎么用?Python Raw._data[picks,time_slice]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.io.Raw
的用法示例。
在下文中一共展示了Raw._data[picks,time_slice]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simulate_movement
# 需要导入模块: from mne.io import Raw [as 别名]
# 或者: from mne.io.Raw import _data[picks,time_slice] [as 别名]
def simulate_movement(raw, pos, stc, trans, src, bem, cov='simple',
mindist=1.0, interp='linear', random_state=None,
n_jobs=1, verbose=None):
"""Simulate raw data with head movements
Parameters
----------
raw : instance of Raw
The raw instance to use. The measurement info, including the
head positions, will be used to simulate data.
pos : str | dict | None
Name of the position estimates file. Should be in the format of
the files produced by maxfilter-produced. If dict, keys should
be the time points and entries should be 4x3 ``dev_head_t``
matrices. If None, the original head position (from
``raw.info['dev_head_t']``) will be used.
stc : instance of SourceEstimate
The source estimate to use to simulate data. Must have the same
sample rate as the raw data.
trans : dict | str
Either a transformation filename (usually made using mne_analyze)
or an info dict (usually opened using read_trans()).
If string, an ending of `.fif` or `.fif.gz` will be assumed to
be in FIF format, any other ending will be assumed to be a text
file with a 4x4 transformation matrix (like the `--trans` MNE-C
option).
src : str | instance of SourceSpaces
If string, should be a source space filename. Can also be an
instance of loaded or generated SourceSpaces.
bem : str
Filename of the BEM (e.g., "sample-5120-5120-5120-bem-sol.fif").
cov : instance of Covariance | 'simple' | None
The sensor covariance matrix used to generate noise. If None,
no noise will be added. If 'simple', a basic (diagonal) ad-hoc
noise covariance will be used.
mindist : float
Minimum distance between sources and the inner skull boundary
to use during forward calculation.
interp : str
Either 'linear' or 'zero', the type of forward-solution
interpolation to use between provided time points.
random_state : None | int | np.random.RandomState
To specify the random generator state.
n_jobs : int
Number of jobs to use.
verbose : bool, str, int, or None
If not None, override default verbose level (see mne.verbose).
Returns
-------
raw : instance of Raw
The simulated raw file.
Notes
-----
Events coded with the number of the forward solution used will be placed
in the raw files in the trigger channel STI101 at the t=0 times of the
SourceEstimates.
The resulting SNR will be determined by the structure of the noise
covariance, and the amplitudes of the SourceEstimate. Note that this
will vary as a function of position.
"""
if isinstance(raw, string_types):
with warnings.catch_warnings(record=True):
raw = Raw(raw, allow_maxshield=True, preload=True, verbose=False)
else:
raw = raw.copy()
if not isinstance(stc, _BaseSourceEstimate):
raise TypeError('stc must be a SourceEstimate')
if not np.allclose(raw.info['sfreq'], 1. / stc.tstep):
raise ValueError('stc and raw must have same sample rate')
rng = check_random_state(random_state)
if interp not in ('linear', 'zero'):
raise ValueError('interp must be "linear" or "zero"')
if pos is None: # use pos from file
dev_head_ts = [raw.info['dev_head_t']] * 2
offsets = np.array([0, raw.n_times])
interp = 'zero'
else:
if isinstance(pos, string_types):
pos = get_chpi_positions(pos, verbose=False)
if isinstance(pos, tuple): # can be an already-loaded pos file
transs, rots, ts = pos
ts -= raw.first_samp / raw.info['sfreq'] # MF files need reref
dev_head_ts = [np.r_[np.c_[r, t[:, np.newaxis]], [[0, 0, 0, 1]]]
for r, t in zip(rots, transs)]
del transs, rots
elif isinstance(pos, dict):
ts = np.array(list(pos.keys()), float)
ts.sort()
dev_head_ts = [pos[float(tt)] for tt in ts]
else:
raise TypeError('unknown pos type %s' % type(pos))
if not (ts >= 0).all(): # pathological if not
raise RuntimeError('Cannot have t < 0 in transform file')
tend = raw.times[-1]
assert not (ts < 0).any()
#.........这里部分代码省略.........