Ejemplo n.º 1
0
def test_legend(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'legend_master') if master else 'legend'

    # Make the plot
    fcp.hist(df=df,
             x='Value',
             show=SHOW,
             legend='Region',
             filename=name + '.png',
             inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
    else:
        compare = utl.img_compare(name + '.png',
                                  osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare
Ejemplo n.º 2
0
def test_wrap_names(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'wrap_names_master') if master else 'wrap_names'

    # Make the plot
    df['Value*2'] = 2 * df['Value']
    df['Value*3'] = 3 * df['Value']
    fcp.hist(df=df,
             x=['Value', 'Value*2', 'Value*3'],
             wrap='x',
             show=SHOW,
             ncol=3,
             ax_size=[250, 250],
             filename=name + '.png',
             inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
    else:
        compare = utl.img_compare(name + '.png',
                                  osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare
Ejemplo n.º 3
0
def test_wrap_values(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'wrap_values_master') if master else 'wrap_values'

    # Make the plot
    fcp.hist(df=df,
             x='Value',
             show=SHOW,
             legend='Region',
             wrap='Batch',
             ax_size=[250, 250],
             horizontal=True,
             filename=name + '.png',
             inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
    else:
        compare = utl.img_compare(name + '.png',
                                  osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare
Ejemplo n.º 4
0
def test_hist_color(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'hist_color_master') if master else 'hist_color'

    # Make the plot
    df_hist = pd.read_csv(
        osjoin(os.path.dirname(fcp.__file__), 'tests', 'fake_data_box.csv'))
    fcp.hist(df=df_hist,
             x='Value',
             show=SHOW,
             legend='Region',
             hist_fill_alpha=1,
             colors=['#FF0000', '#00FF11'],
             filename=name + '.png',
             inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
        compare = utl.img_compare(name + '.png',
                                  osjoin(MASTER, name + '_master.png'),
                                  show=True)
    else:
        compare = utl.img_compare(name + '.png',
                                  osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare
Ejemplo n.º 5
0
def test_horizontal(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'horizontal_master') if master else 'horizontal'

    # Make the plot
    fcp.hist(df=df, x='Value', show=SHOW, horizontal=True,
             filename=name + '.png', inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
        compare = utl.img_compare(name + '.png', osjoin(MASTER, name + '_master.png'), show=True)
    else:
        compare = utl.img_compare(name + '.png', osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare
Ejemplo n.º 6
0
def test_grid(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'grid_master') if master else 'grid'

    # Make the plot
    fcp.hist(df=df, x='Value', show=SHOW, legend='Region', col='Batch', row='Sample', ax_size=[250, 250],
             filename=name + '.png', inline=False)

    # Compare with master
    if master:
        return
    elif show:
        os.startfile(osjoin(MASTER, name + '_master.png'))
        os.startfile(name + '.png')
        compare = utl.img_compare(name + '.png', osjoin(MASTER, name + '_master.png'), show=True)
    else:
        compare = utl.img_compare(name + '.png', osjoin(MASTER, name + '_master.png'))
        if remove:
            os.remove(name + '.png')

        assert not compare