本文整理汇总了Python中mne.io.RawArray.apply_function方法的典型用法代码示例。如果您正苦于以下问题:Python RawArray.apply_function方法的具体用法?Python RawArray.apply_function怎么用?Python RawArray.apply_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.io.RawArray
的用法示例。
在下文中一共展示了RawArray.apply_function方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_apply_function_verbose
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import apply_function [as 别名]
def test_apply_function_verbose():
"""Test apply function verbosity
"""
n_chan = 2
n_times = 3
ch_names = [str(ii) for ii in range(n_chan)]
raw = RawArray(np.zeros((n_chan, n_times)),
create_info(ch_names, 1., 'mag'))
# test return types in both code paths (parallel / 1 job)
assert_raises(TypeError, raw.apply_function, bad_1,
None, None, 1)
assert_raises(ValueError, raw.apply_function, bad_2,
None, None, 1)
assert_raises(TypeError, raw.apply_function, bad_1,
None, None, 2)
assert_raises(ValueError, raw.apply_function, bad_2,
None, None, 2)
# check our arguments
tempdir = _TempDir()
test_name = op.join(tempdir, 'test.log')
set_log_file(test_name)
try:
raw.apply_function(printer, None, None, 1, verbose=False)
with open(test_name) as fid:
assert_equal(len(fid.readlines()), 0)
raw.apply_function(printer, None, None, 1, verbose=True)
with open(test_name) as fid:
assert_equal(len(fid.readlines()), n_chan)
finally:
set_log_file(None)
示例2: test_apply_function_verbose
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import apply_function [as 别名]
def test_apply_function_verbose():
"""Test apply function verbosity."""
n_chan = 2
n_times = 3
ch_names = [str(ii) for ii in range(n_chan)]
raw = RawArray(np.zeros((n_chan, n_times)),
create_info(ch_names, 1., 'mag'))
# test return types in both code paths (parallel / 1 job)
pytest.raises(TypeError, raw.apply_function, bad_1)
pytest.raises(ValueError, raw.apply_function, bad_2)
pytest.raises(TypeError, raw.apply_function, bad_1, n_jobs=2)
pytest.raises(ValueError, raw.apply_function, bad_2, n_jobs=2)
# check our arguments
with catch_logging() as sio:
out = raw.apply_function(printer, verbose=False)
assert len(sio.getvalue()) == 0
assert out is raw
raw.apply_function(printer, verbose=True)
assert sio.getvalue().count('\n') == n_chan
示例3: test_apply_function_verbose
# 需要导入模块: from mne.io import RawArray [as 别名]
# 或者: from mne.io.RawArray import apply_function [as 别名]
def test_apply_function_verbose():
"""Test apply function verbosity
"""
n_chan = 2
n_times = 3
ch_names = [str(ii) for ii in range(n_chan)]
raw = RawArray(np.zeros((n_chan, n_times)),
create_info(ch_names, 1., 'mag'))
# test return types in both code paths (parallel / 1 job)
assert_raises(TypeError, raw.apply_function, bad_1,
None, None, 1)
assert_raises(ValueError, raw.apply_function, bad_2,
None, None, 1)
assert_raises(TypeError, raw.apply_function, bad_1,
None, None, 2)
assert_raises(ValueError, raw.apply_function, bad_2,
None, None, 2)
# check our arguments
with catch_logging() as sio:
raw.apply_function(printer, None, None, 1, verbose=False)
assert_equal(len(sio.getvalue()), 0)
raw.apply_function(printer, None, None, 1, verbose=True)
assert_equal(sio.getvalue().count('\n'), n_chan)