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

    name = osjoin(MASTER, 'theme_gray_master') if master else 'theme_gray'

    # Make the plot
    fcp.set_theme('gray')
    fcp.plot(df=df,
             x='Voltage',
             y='I [A]',
             legend=['Die', 'Substrate'],
             filter=
             'Target Wavelength==450 & Boost Level==0.2 & Temperature [C]==25',
             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
Exemplo n.º 2
0
import os, sys, pdb, platform
import fivecentplots.utilities as utl
import inspect
osjoin = os.path.join
db = pdb.set_trace
if platform.system() != 'Windows':
    raise utl.PlatformError()

MPL = utl.get_mpl_version_dir()
MASTER = osjoin(os.path.dirname(fcp.__file__), 'tests', 'test_images', MPL,  'barplot.py')

# Sample data
df = pd.read_csv(osjoin(os.path.dirname(fcp.__file__), 'tests', 'fake_data_bar.csv'))

# Set theme
fcp.set_theme('gray')
# fcp.set_theme('white')


# Other
SHOW = False


def make_all():
    """
    Remake all test master images
    """

    members = inspect.getmembers(sys.modules[__name__])
    members = [f for f in members if 'test_' in f[0]]
    for member in members: