Example #1
0
def test_time_slicer():
    "Test linked time axes"
    ds = datasets.get_uts(True)

    p1 = plot.Butterfly(ds['utsnd'])
    p2 = plot.Array('utsnd', 'A', ds=ds)
    p1.link_time_axis(p2)

    p1._set_time(.1, True)
    assert p2._current_time == .1
    assert p2._time_fixed == True
    p2._set_time(.2)
    assert p1._current_time == .2
    assert p1._time_fixed == False

    p1 = plot.TopoButterfly(ds['utsnd'])
    p2 = plot.Array('utsnd', 'A', ds=ds)
    p2.link_time_axis(p1)

    p1._set_time(.1, True)
    assert p2._current_time == .1
    assert p2._time_fixed == True

    # merge another
    p3 = plot.TopoButterfly(ds[0, 'utsnd'])
    p3.link_time_axis(p2)

    p2._set_time(.2)
    assert p1._current_time == .2
    assert p1._time_fixed == False
Example #2
0
def test_plot_butterfly():
    "Test plot.TopoButterfly"
    ds = datasets.get_uts(utsnd=True)
    p = plot.TopoButterfly('utsnd', ds=ds, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', ds=ds, vmax=0.2, w=2, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', 'A%B', ds=ds, axw=2, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=[1, 2], ds=ds, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=['1', '2'], ds=ds, show=False)
    p.close()
Example #3
0
def test_plot_butterfly():
    "Test plot.TopoButterfly"
    plot.configure_backend(False, False)
    ds = datasets.get_rand(utsnd=True)
    p = plot.TopoButterfly('utsnd', ds=ds)
    p.close()
    p = plot.TopoButterfly('utsnd', ds=ds, vmax=0.2, w=2)
    p.close()
    p = plot.TopoButterfly('utsnd', 'A%B', ds=ds, axw=2)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=[1, 2], ds=ds)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=['1', '2'], ds=ds)
    p.close()
Example #4
0
def test_time_slicer():
    "Test linked time axes"
    ds = datasets.get_uts(True)

    p1 = plot.Butterfly(ds['utsnd'], show=False)
    p2 = plot.Array('utsnd', 'A', ds=ds, show=False)
    p1.link_time_axis(p2)

    p1._set_time(.1, True)
    eq_(p2._current_time, .1)
    eq_(p2._time_fixed, True)
    p2._set_time(.2)
    eq_(p1._current_time, .2)
    eq_(p1._time_fixed, False)

    p1 = plot.TopoButterfly(ds['utsnd'], show=False)
    p2 = plot.Array('utsnd', 'A', ds=ds, show=False)
    p2.link_time_axis(p1)

    p1._set_time(.1, True)
    eq_(p2._current_time, .1)
    eq_(p2._time_fixed, True)
    p2._set_time(.2)
    eq_(p1._current_time, .2)
    eq_(p1._time_fixed, False)
Example #5
0
def test_plot_topo_butterfly():
    "Test plot.TopoButterfly"
    ds = datasets.get_uts(utsnd=True)
    p = plot.TopoButterfly('utsnd', ds=ds, show=False)
    p.set_topo_t(0.2)
    p.close()
    p = plot.TopoButterfly('utsnd', ds=ds, vmax=0.2, w=2, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', 'A%B', ds=ds, w=3, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=[1, 2], ds=ds, show=False)
    p.close()
    p = plot.TopoButterfly('utsnd', mark=['1', '2'], ds=ds, show=False)
    p.set_vlim(-1, 1)
    eq_(p.get_ylim(), (1.0, -1.0))
    p.close()
Example #6
0
def test_plot_topo_butterfly():
    "Test plot.TopoButterfly"
    ds = datasets.get_uts(utsnd=True)

    # single row
    p = plot.TopoButterfly('utsnd', ds=ds)
    p.set_time(0.2)
    # t keypress on topomap
    x, y = p.topo_axes[0].transAxes.transform((.5, .5))
    event = KeyEvent('test', p.canvas, 't', x, y, wx.KeyEvent())
    p._on_key_press(event)
    p.close()

    p = plot.TopoButterfly('utsnd', ds=ds, vmax=0.2, w=6)
    p.close()

    # multiple rows
    p = plot.TopoButterfly('utsnd', 'A%B', ds=ds, w=6)
    if not IS_WINDOWS:
        assert (*p.figure.get_size_inches(), ) == (6, 12)
    # t keypress on topomaps
    for ax in p.topo_axes:
        x, y = ax.transAxes.transform((.5, .5))
        event = KeyEvent('test', p.canvas, 't', x, y, wx.KeyEvent())
        p._on_key_press(event)
    p.close()

    p = plot.TopoButterfly('utsnd', mark=[1, 2], ds=ds)
    p.close()

    p = plot.TopoButterfly('utsnd', mark=['1', '2'], ds=ds)
    p.set_vlim(2)
    assert p.get_vlim() == (-2.0, 2.0)
    p.set_ylim(-1, 1)
    assert p.get_ylim() == (-1.0, 1.0)
    p.close()