Exemplo n.º 1
0
def test_heatmap_model_passes(df, flush_guard):
    passes = df.executor.passes
    x = vaex.jupyter.model.Axis(df=df, expression='x')
    y = vaex.jupyter.model.Axis(df=df, expression='y')
    model = vaex.jupyter.model.Heatmap(df=df, x=x, y=y, shape=5)
    assert df.executor.passes == passes
    flush()
    # this will do two minmaxes in 1 pass
    assert df.executor.passes == passes + 1

    # now will will manually do the grid
    grid = vaex.jupyter.model.GridCalculator(df, [model])
    grid.computation()
    flush()
    assert df.executor.passes == passes + 2

    # once a minmax and a new grid
    x.expression = 'y'
    assert df.executor.passes == passes + 2
    flush()
    assert df.executor.passes == passes + 2 + 2

    # twice a minmax in 1 pass, followed by a gridding
    x.expression = 'x*2'
    y.expression = 'y*2'
    assert df.executor.passes == passes + 2 + 2
    flush()
    assert df.executor.passes == passes + 2 + 2 + 2

    # once a minmax and a new grid
    x.expression = 'x*3'
    assert df.executor.passes == passes + 2 + 2 + 2
    flush(all=True)
    assert df.executor.passes == passes + 2 + 2 + 2 + 2
Exemplo n.º 2
0
def test_histogram_model_passes(df, flush_guard):
    passes = df.executor.passes
    x = vaex.jupyter.model.Axis(df=df, expression='x')
    model = vaex.jupyter.model.Histogram(df=df, x=x)
    assert df.executor.passes == passes
    flush()
    # this will do the minmax
    assert df.executor.passes == passes + 1

    # now will will manually do the grid
    grid = vaex.jupyter.model.GridCalculator(df, [model])
    grid.computation()
    flush()
    assert df.executor.passes == passes + 2

    # a minmax and a new grid
    model.x.expression = 'y'
    assert df.executor.passes == passes + 2
    flush(all=True)
    assert df.executor.passes == passes + 2 + 2