Пример #1
0
def test_group_single(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'group_single_master') if master else 'group_single'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                groups='Batch',
                show=SHOW,
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #2
0
def test_groups_boxplot(master=False, remove=True, show=False):

    name = osjoin(MASTER,
                  'groups_boxplot_master') if master else 'groups_boxplot'

    # Make the plot
    df_box = pd.read_csv(
        osjoin(os.path.dirname(fcp.__file__), 'tests', 'fake_data_box.csv'))
    fcp.boxplot(df=df_box,
                y='Value',
                groups=['Batch', 'Sample'],
                legend='Region',
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #3
0
def test_violin_box_off(master=False, remove=True, show=False):

    name = osjoin(MASTER,
                  'violin_box_off_master') if master else 'violin_box_off'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                groups=['Batch', 'Sample'],
                show=SHOW,
                violin=True,
                violin_box_on=False,
                violin_markers=True,
                jitter=False,
                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
Пример #4
0
def test_range_lines(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'range_lines_master') if master else 'range_lines'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                groups=['Batch', 'Sample'],
                show=SHOW,
                box_range_lines=False,
                ax_size=[300, 300],
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #5
0
def test_mean_diamonds(master=False, remove=True, show=False):

    name = osjoin(MASTER,
                  'mean_diamonds_master') if master else 'mean_diamonds'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                groups=['Batch', 'Sample'],
                show=SHOW,
                mean_diamonds=True,
                conf_coeff=0.95,
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #6
0
def test_grid_wrap_y_no_share(master=False, remove=True, show=False):

    name = osjoin(MASTER,
                  'grid_y-no-share_master') if master else 'grid_y-no-share'

    # Make the plot
    df['Value*2'] = 2 * df['Value']
    fcp.boxplot(df=df,
                y=['Value', 'Value*2'],
                groups=['Batch', 'Sample', 'Region'],
                wrap='y',
                show=SHOW,
                ax_size=[300, 300],
                share_y=False,
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #7
0
def test_simple(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'simple_master') if master else 'simple'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                show=SHOW,
                tick_labels_minor=True,
                grid_minor=True,
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #8
0
def test_boxplot_iqr(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'boxplot_iqr_master') if master else 'boxplot_iqr'

    # Make the plot
    fcp.boxplot(df=df_box,
                y='Value',
                groups=['Batch', 'Sample'],
                filter='Batch==101',
                show=SHOW,
                ymin='1.5*iqr',
                ymax='1.5*iqr',
                filename=name + '.png',
                inline=False,
                jitter=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
Пример #9
0
def test_violin_styled(master=False, remove=True, show=False):

    name = osjoin(MASTER,
                  'violin_styled_master') if master else 'violin_styled'

    # Make the plot
    fcp.boxplot(df=df,
                y='Value',
                groups=['Batch', 'Sample'],
                show=SHOW,
                violin=True,
                violin_fill_color='#eaef1a',
                violin_fill_alpha=1,
                violin_edge_color='#555555',
                violin_edge_width=2,
                violin_box_color='#ffffff',
                violin_whisker_color='#ff0000',
                violin_median_marker='+',
                violin_median_color='#00ffff',
                violin_median_size=10,
                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
Пример #10
0
def test_marker_boxplot(master=False, remove=True, show=False):

    name = osjoin(MASTER, 'boxplot_master') if master else 'boxplot'

    # Make the plot
    df_box = pd.read_csv(
        osjoin(os.path.dirname(fcp.__file__), 'tests', 'fake_data_box.csv'))
    fcp.boxplot(df=df_box,
                y='Value',
                groups=['Batch', 'Sample'],
                show=SHOW,
                box_fill_color=[0, 0, 1, 1, 2, 2],
                box_fill_alpha=0.3,
                box_edge_width=0,
                marker_edge_color=[0, 0, 1, 1, 2, 2],
                marker_type=['o', '+'],
                box_whisker_color=[0, 0, 1, 1, 2, 2],
                box_whisker_width=1,
                jitter=False,
                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
Пример #11
0
# Fig groups example
d = fcp.plot(df=df, x='Voltage', y='I [A]', leg_groups='Die',
             fig_groups=['Substrate'],
             row='Boost Level', col='Temperature [C]', ax_scale='logx',
             ytrans=('pow',4), ymin=1E-8, ymax=1E-2, show=True)  #issues here with ranges, ticks
d = fcp.plot(df=df, x='Voltage', y='I [A]', leg_groups='Die',
             fig_groups=['Substrate', 'Target Wavelength'],
             row='Boost Level', col='Temperature [C]', ax_scale='logx',
             ytrans=('pow',4), ymin=1E-8, ymax=1E-2, show=True)  #issues here with ranges, ticks


# Multiple y on same axis with filter
filt = 'Substrate=="Si" & Target_Wavelength==450 & Boost_Level==0.2 & ' \
       'Temperature_C==25'
d = fcp.plot(df=df, x='Voltage', y=['I [A]', 'Voltage'], filter=filt,
             leg_groups='Die', ylabel='Values', show=True)

# Multiple y on same axis with filter and twinx
filt = 'Substrate=="Si" & Target_Wavelength==450 & Boost_Level==0.2 & ' \
       'Temperature_C==25'
d = fcp.plot(df=df, x='Voltage', y=['I [A]', 'Voltage'], filter=filt,
             show=True, leg_groups='Die', ylabel='I [A]', ylabel2='Voltage')

# Boxplot test
d = fcp.boxplot(df=df_box, y='Value', groups=['Batch', 'Sample'], show=True)
d = fcp.boxplot(df=df_box, y='Value', groups=['Batch', 'Region'], row='Sample',
                show=True, ax_size=[300,300])

# Contour test
d = fcp.contour(df=df_c, x='X', y='Y', z='Value')
Пример #12
0
d = fcp.plot(df=df,
             x='Voltage',
             y=['I [A]', 'Voltage'],
             filter=filt,
             leg_groups='Die',
             ylabel='Values',
             show=True)

# Multiple y on same axis with filter and twinx
filt = 'Substrate=="Si" & Target_Wavelength==450 & Boost_Level==0.2 & ' \
       'Temperature_C==25'
d = fcp.plot(df=df,
             x='Voltage',
             y=['I [A]', 'Voltage'],
             filter=filt,
             show=True,
             leg_groups='Die',
             ylabel='I [A]',
             ylabel2='Voltage')

# Boxplot test
d = fcp.boxplot(df=df_box, y='Value', groups=['Batch', 'Sample'], show=True)
d = fcp.boxplot(df=df_box,
                y='Value',
                groups=['Batch', 'Region'],
                row='Sample',
                show=True,
                ax_size=[300, 300])

# Contour test
d = fcp.contour(df=df_c, x='X', y='Y', z='Value')