本文整理汇总了Python中mne.time_frequency.tfr.AverageTFR.comment方法的典型用法代码示例。如果您正苦于以下问题:Python AverageTFR.comment方法的具体用法?Python AverageTFR.comment怎么用?Python AverageTFR.comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.time_frequency.tfr.AverageTFR
的用法示例。
在下文中一共展示了AverageTFR.comment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_io
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import comment [as 别名]
def test_io():
"""Test TFR IO capacities."""
tempdir = _TempDir()
fname = op.join(tempdir, 'test-tfr.h5')
data = np.zeros((3, 2, 3))
times = np.array([.1, .2, .3])
freqs = np.array([.10, .20])
info = mne.create_info(['MEG 001', 'MEG 002', 'MEG 003'], 1000.,
['mag', 'mag', 'mag'])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs,
nave=20, comment='test', method='crazy-tfr')
tfr.save(fname)
tfr2 = read_tfrs(fname, condition='test')
assert_array_equal(tfr.data, tfr2.data)
assert_array_equal(tfr.times, tfr2.times)
assert_array_equal(tfr.freqs, tfr2.freqs)
assert_equal(tfr.comment, tfr2.comment)
assert_equal(tfr.nave, tfr2.nave)
assert_raises(IOError, tfr.save, fname)
tfr.comment = None
tfr.save(fname, overwrite=True)
assert_equal(read_tfrs(fname, condition=0).comment, tfr.comment)
tfr.comment = 'test-A'
tfr2.comment = 'test-B'
fname = op.join(tempdir, 'test2-tfr.h5')
write_tfrs(fname, [tfr, tfr2])
tfr3 = read_tfrs(fname, condition='test-A')
assert_equal(tfr.comment, tfr3.comment)
assert_true(isinstance(tfr.info, mne.Info))
tfrs = read_tfrs(fname, condition=None)
assert_equal(len(tfrs), 2)
tfr4 = tfrs[1]
assert_equal(tfr2.comment, tfr4.comment)
assert_raises(ValueError, read_tfrs, fname, condition='nonono')
# Test save of EpochsTFR.
data = np.zeros((5, 3, 2, 3))
tfr = EpochsTFR(info, data=data, times=times, freqs=freqs,
comment='test', method='crazy-tfr')
tfr.save(fname, True)
read_tfr = read_tfrs(fname)[0]
assert_array_equal(tfr.data, read_tfr.data)
示例2: test_io
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import comment [as 别名]
def test_io():
"""Test TFR IO capacities"""
tempdir = _TempDir()
fname = op.join(tempdir, "test-tfr.h5")
data = np.zeros((3, 2, 3))
times = np.array([0.1, 0.2, 0.3])
freqs = np.array([0.10, 0.20])
info = mne.create_info(["MEG 001", "MEG 002", "MEG 003"], 1000.0, ["mag", "mag", "mag"])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs, nave=20, comment="test", method="crazy-tfr")
tfr.save(fname)
tfr2 = read_tfrs(fname, condition="test")
assert_array_equal(tfr.data, tfr2.data)
assert_array_equal(tfr.times, tfr2.times)
assert_array_equal(tfr.freqs, tfr2.freqs)
assert_equal(tfr.comment, tfr2.comment)
assert_equal(tfr.nave, tfr2.nave)
assert_raises(IOError, tfr.save, fname)
tfr.comment = None
tfr.save(fname, overwrite=True)
assert_equal(read_tfrs(fname, condition=0).comment, tfr.comment)
tfr.comment = "test-A"
tfr2.comment = "test-B"
fname = op.join(tempdir, "test2-tfr.h5")
write_tfrs(fname, [tfr, tfr2])
tfr3 = read_tfrs(fname, condition="test-A")
assert_equal(tfr.comment, tfr3.comment)
assert_true(isinstance(tfr.info, io.meas_info.Info))
tfrs = read_tfrs(fname, condition=None)
assert_equal(len(tfrs), 2)
tfr4 = tfrs[1]
assert_equal(tfr2.comment, tfr4.comment)
assert_raises(ValueError, read_tfrs, fname, condition="nonono")
示例3: test_io
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import comment [as 别名]
def test_io():
"""Test TFR IO capacities."""
from pandas import DataFrame
tempdir = _TempDir()
fname = op.join(tempdir, 'test-tfr.h5')
data = np.zeros((3, 2, 3))
times = np.array([.1, .2, .3])
freqs = np.array([.10, .20])
info = mne.create_info(['MEG 001', 'MEG 002', 'MEG 003'], 1000.,
['mag', 'mag', 'mag'])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs,
nave=20, comment='test', method='crazy-tfr')
tfr.save(fname)
tfr2 = read_tfrs(fname, condition='test')
assert_array_equal(tfr.data, tfr2.data)
assert_array_equal(tfr.times, tfr2.times)
assert_array_equal(tfr.freqs, tfr2.freqs)
assert_equal(tfr.comment, tfr2.comment)
assert_equal(tfr.nave, tfr2.nave)
pytest.raises(IOError, tfr.save, fname)
tfr.comment = None
tfr.save(fname, overwrite=True)
assert_equal(read_tfrs(fname, condition=0).comment, tfr.comment)
tfr.comment = 'test-A'
tfr2.comment = 'test-B'
fname = op.join(tempdir, 'test2-tfr.h5')
write_tfrs(fname, [tfr, tfr2])
tfr3 = read_tfrs(fname, condition='test-A')
assert_equal(tfr.comment, tfr3.comment)
assert (isinstance(tfr.info, mne.Info))
tfrs = read_tfrs(fname, condition=None)
assert_equal(len(tfrs), 2)
tfr4 = tfrs[1]
assert_equal(tfr2.comment, tfr4.comment)
pytest.raises(ValueError, read_tfrs, fname, condition='nonono')
# Test save of EpochsTFR.
n_events = 5
data = np.zeros((n_events, 3, 2, 3))
# create fake metadata
rng = np.random.RandomState(42)
rt = np.round(rng.uniform(size=(n_events,)), 3)
trialtypes = np.array(['face', 'place'])
trial = trialtypes[(rng.uniform(size=(n_events,)) > .5).astype(int)]
meta = DataFrame(dict(RT=rt, Trial=trial))
# fake events and event_id
events = np.zeros([n_events, 3])
events[:, 0] = np.arange(n_events)
events[:, 2] = np.ones(n_events)
event_id = dict(a=1)
tfr = EpochsTFR(info, data=data, times=times, freqs=freqs,
comment='test', method='crazy-tfr', events=events,
event_id=event_id, metadata=meta)
tfr.save(fname, True)
read_tfr = read_tfrs(fname)[0]
assert_array_equal(tfr.data, read_tfr.data)
assert_metadata_equal(tfr.metadata, read_tfr.metadata)
assert_array_equal(tfr.events, read_tfr.events)
assert_equal(tfr.event_id, read_tfr.event_id)