Ejemplo n.º 1
0
def test_vlims():
    "Test vlim determination"
    ds = datasets.get_uts()
    epochs = [[ds[i: i+5, 'uts'].mean('case')] for i in range(0, 10, 5)]
    meas = ds['uts'].info.get('meas')

    # without cmap
    lims = _base.find_fig_vlims(epochs)
    assert lims[meas] == (-1, 3)
    lims = _base.find_fig_vlims(epochs, 1)
    assert lims[meas] == (-1, 1)
    lims = _base.find_fig_vlims(epochs, .1)
    assert lims[meas] == (-.1, .1)
    lims = _base.find_fig_vlims(epochs, 1, -2)
    assert lims[meas] == (-2, 1)

    # positive data
    epochs = [[e * e.sign()] for e in chain(*epochs)]
    lims = _base.find_fig_vlims(epochs)
    assert lims[meas][0] == 0
    lims = _base.find_fig_vlims(epochs, 1)
    assert lims[meas] == (0, 1)
    lims = _base.find_fig_vlims(epochs, 1, -1)
    assert lims[meas] == (-1, 1)

    # symmetric
    cmaps = _base.find_fig_cmaps(epochs)
    assert cmaps == {meas: 'xpolar'}
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    assert lims[meas][0] == -lims[meas][1]
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    assert lims[meas] == (-1, 1)
    lims = _base.find_fig_vlims(epochs, 1, 0, cmaps=cmaps)
    assert lims[meas] == (-1, 1)

    # zero-based
    cmaps[meas] = 'sig'
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    assert lims[meas][0] == 0
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    assert lims[meas] == (0, 1)
    lims = _base.find_fig_vlims(epochs, 1, -1, cmaps=cmaps)
    assert lims[meas] == (0, 1)
Ejemplo n.º 2
0
def test_vlims():
    "Test vlim determination"
    ds = datasets.get_uts()
    epochs = [[ds[i:i + 5, 'uts'].mean('case')] for i in range(0, 10, 5)]
    meas = ds['uts'].info.get('meas')

    # without cmap
    lims = _base.find_fig_vlims(epochs)
    assert lims[meas] == (-1, 3)
    lims = _base.find_fig_vlims(epochs, 1)
    assert lims[meas] == (-1, 1)
    lims = _base.find_fig_vlims(epochs, .1)
    assert lims[meas] == (-.1, .1)
    lims = _base.find_fig_vlims(epochs, 1, -2)
    assert lims[meas] == (-2, 1)

    # positive data
    epochs = [[e * e.sign()] for e in chain(*epochs)]
    lims = _base.find_fig_vlims(epochs)
    assert lims[meas][0] == 0
    lims = _base.find_fig_vlims(epochs, 1)
    assert lims[meas] == (0, 1)
    lims = _base.find_fig_vlims(epochs, 1, -1)
    assert lims[meas] == (-1, 1)

    # symmetric
    cmaps = _base.find_fig_cmaps(epochs)
    assert cmaps == {meas: 'xpolar'}
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    assert lims[meas][0] == -lims[meas][1]
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    assert lims[meas] == (-1, 1)
    lims = _base.find_fig_vlims(epochs, 1, 0, cmaps=cmaps)
    assert lims[meas] == (-1, 1)

    # zero-based
    cmaps[meas] = 'sig'
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    assert lims[meas][0] == 0
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    assert lims[meas] == (0, 1)
    lims = _base.find_fig_vlims(epochs, 1, -1, cmaps=cmaps)
    assert lims[meas] == (0, 1)
Ejemplo n.º 3
0
def test_vlims():
    "Test vlim determination"
    ds = datasets.get_uts()
    epochs = [[ds[i:i + 5, 'uts'].mean('case')] for i in range(0, 10, 5)]
    meas = ds['uts'].info.get('meas')

    lims = _base.find_fig_vlims(epochs)
    assert_greater(lims[meas][1], lims[meas][0])
    lims = _base.find_fig_vlims(epochs, 1)
    eq_(lims[meas], (-1, 1))
    lims = _base.find_fig_vlims(epochs, 1, -2)
    eq_(lims[meas], (-2, 1))

    # positive data
    epochs = [[e * e.sign()] for e in chain(*epochs)]
    lims = _base.find_fig_vlims(epochs)
    eq_(lims[meas][0], 0)
    lims = _base.find_fig_vlims(epochs, 1)
    eq_(lims[meas], (0, 1))
    lims = _base.find_fig_vlims(epochs, 1, -1)
    eq_(lims[meas], (-1, 1))

    # symmetric
    cmaps = _base.find_fig_cmaps(epochs)
    eq_(cmaps, {meas: 'xpolar'})
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    eq_(lims[meas][0], -lims[meas][1])
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    eq_(lims[meas], (-1, 1))
    lims = _base.find_fig_vlims(epochs, 1, 0, cmaps=cmaps)
    eq_(lims[meas], (-1, 1))

    # zero-based
    cmaps[meas] = 'sig'
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    eq_(lims[meas][0], 0)
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    eq_(lims[meas], (0, 1))
    lims = _base.find_fig_vlims(epochs, 1, -1, cmaps=cmaps)
    eq_(lims[meas], (0, 1))
Ejemplo n.º 4
0
def test_vlims():
    "Test vlim determination"
    ds = datasets.get_uts()
    epochs = [[ds[i: i+5, 'uts'].mean('case')] for i in xrange(0, 10, 5)]
    meas = ds['uts'].info.get('meas')

    lims = _base.find_fig_vlims(epochs)
    assert_greater(lims[meas][1], lims[meas][0])
    lims = _base.find_fig_vlims(epochs, 1)
    eq_(lims[meas], (-1, 1))
    lims = _base.find_fig_vlims(epochs, 1, -2)
    eq_(lims[meas], (-2, 1))

    # positive data
    epochs = [[e * e.sign()] for e in chain(*epochs)]
    lims = _base.find_fig_vlims(epochs)
    eq_(lims[meas][0], 0)
    lims = _base.find_fig_vlims(epochs, 1)
    eq_(lims[meas], (0, 1))
    lims = _base.find_fig_vlims(epochs, 1, -1)
    eq_(lims[meas], (-1, 1))

    # symmetric
    cmaps = _base.find_fig_cmaps(epochs)
    eq_(cmaps, {meas: 'xpolar'})
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    eq_(lims[meas][0], -lims[meas][1])
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    eq_(lims[meas], (-1, 1))
    lims = _base.find_fig_vlims(epochs, 1, 0, cmaps=cmaps)
    eq_(lims[meas], (-1, 1))

    # zero-based
    cmaps[meas] = 'sig'
    lims = _base.find_fig_vlims(epochs, cmaps=cmaps)
    eq_(lims[meas][0], 0)
    lims = _base.find_fig_vlims(epochs, 1, cmaps=cmaps)
    eq_(lims[meas], (0, 1))
    lims = _base.find_fig_vlims(epochs, 1, -1, cmaps=cmaps)
    eq_(lims[meas], (0, 1))