当前位置: 首页>>代码示例>>Python>>正文


Python RawArray.apply_function方法代码示例

本文整理汇总了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)
开发者ID:ImmanuelSamuel,项目名称:mne-python,代码行数:33,代码来源:test_apply_function.py

示例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
开发者ID:SherazKhan,项目名称:mne-python,代码行数:22,代码来源:test_apply_function.py

示例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)
开发者ID:EmanuelaLiaci,项目名称:mne-python,代码行数:26,代码来源:test_apply_function.py


注:本文中的mne.io.RawArray.apply_function方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。