本文整理汇总了Python中mne.io.RawArray.info['meas_date']方法的典型用法代码示例。如果您正苦于以下问题:Python RawArray.info['meas_date']方法的具体用法?Python RawArray.info['meas_date']怎么用?Python RawArray.info['meas_date']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.io.RawArray
的用法示例。
在下文中一共展示了RawArray.info['meas_date']方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_chunk_duration
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import info['meas_date'] [as 别名]
def test_chunk_duration():
"""Test chunk_duration."""
# create dummy raw
raw = RawArray(data=np.empty([10, 10], dtype=np.float64),
info=create_info(ch_names=10, sfreq=1.),
first_samp=0)
raw.info['meas_date'] = 0
raw.set_annotations(Annotations(description='foo', onset=[0],
duration=[10], orig_time=None))
# expected_events = [[0, 0, 1], [0, 0, 1], [1, 0, 1], [1, 0, 1], ..
# [9, 0, 1], [9, 0, 1]]
expected_events = np.atleast_2d(np.repeat(range(10), repeats=2)).T
expected_events = np.insert(expected_events, 1, 0, axis=1)
expected_events = np.insert(expected_events, 2, 1, axis=1)
events, events_id = events_from_annotations(raw, chunk_duration=.5,
use_rounding=False)
assert_array_equal(events, expected_events)
# test chunk durations that do not fit equally in annotation duration
expected_events = np.zeros((3, 3))
expected_events[:, -1] = 1
expected_events[:, 0] = np.arange(0, 9, step=3)
events, events_id = events_from_annotations(raw, chunk_duration=3.)
assert_array_equal(events, expected_events)
示例2: _raw_annot
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import info['meas_date'] [as 别名]
def _raw_annot(meas_date, orig_time):
info = create_info(ch_names=10, sfreq=10.)
raw = RawArray(data=np.empty((10, 10)), info=info, first_samp=10)
raw.info['meas_date'] = meas_date
annot = Annotations([.5], [.2], ['dummy'], orig_time)
raw.set_annotations(annotations=annot)
return raw
示例3: raw_factory
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import info['meas_date'] [as 别名]
def raw_factory(meas_date):
raw = RawArray(data=np.empty((10, 10)),
info=create_info(ch_names=10, sfreq=10., ),
first_samp=10)
raw.info['meas_date'] = meas_date
raw.set_annotations(annotations=Annotations(onset=[.5],
duration=[.2],
description='dummy',
orig_time=None))
return raw
示例4: test_time_as_index_ref
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import info['meas_date'] [as 别名]
def test_time_as_index_ref(offset, origin):
"""Test indexing of raw times."""
meas_date = 1
info = create_info(ch_names=10, sfreq=10.)
raw = RawArray(data=np.empty((10, 10)), info=info, first_samp=10)
raw.info['meas_date'] = meas_date
relative_times = raw.times
inds = raw.time_as_index(relative_times + offset,
use_rounding=True,
origin=origin)
assert_array_equal(inds, np.arange(raw.n_times))
示例5: _create_annotation_based_on_descr
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import info['meas_date'] [as 别名]
def _create_annotation_based_on_descr(description, annotation_start_sampl=0,
duration=0, orig_time=0):
"""Create a raw object with annotations from descriptions.
The returning raw object contains as many annotations as description given.
All starting at `annotation_start_sampl`.
"""
# create dummy raw
raw = RawArray(data=np.empty([10, 10], dtype=np.float64),
info=create_info(ch_names=10, sfreq=1000.),
first_samp=0)
raw.info['meas_date'] = 0
# create dummy annotations based on the descriptions
onset = raw.times[annotation_start_sampl]
onset_matching_desc = np.full_like(description, onset, dtype=type(onset))
duration_matching_desc = np.full_like(description, duration,
dtype=type(duration))
annot = Annotations(description=description,
onset=onset_matching_desc,
duration=duration_matching_desc,
orig_time=orig_time)
if duration != 0:
with pytest.warns(RuntimeWarning, match='Limited.*expanding outside'):
# duration 0.1s is larger than the raw data expand
raw.set_annotations(annot)
else:
raw.set_annotations(annot)
# Make sure that set_annotations(annot) works
assert all(raw.annotations.onset == onset)
if duration != 0:
expected_duration = (len(raw.times) / raw.info['sfreq']) - onset
else:
expected_duration = 0
_duration = raw.annotations.duration[0]
assert _duration == approx(expected_duration)
assert all(raw.annotations.duration == _duration)
assert all(raw.annotations.description == description)
return raw