def test_plot_scatter1(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) isopy.tb.plot_scatter(plt, x, y) return plt
def test_plot_hstack1(): plt.close() plt.clf() array1 = isopy.random(100, -0.5, seed=46) array2 = isopy.random(100, 0.5, seed=47) isopy.tb.plot_hstack(plt, array1) isopy.tb.plot_hstack(plt, array2, cval=np.mean, pmval=isopy.sd2) return plt
def test_plot_vcompare2(): plt.close() plt.clf() array1 = isopy.random(100, -0.5, seed=46) array2 = isopy.random(100, 0.5, seed=47) isopy.tb.plot_vstack(plt, array1, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_vstack(plt, array2, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_vcompare(plt, pmval=isopy.sd, sigfig=3) return plt
def test_plot_hcompare1(): plt.close() plt.clf() array1 = isopy.random(100, 0.9, seed=46) array2 = isopy.random(100, 1.1, seed=47) isopy.tb.plot_hstack(plt, array1, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_hstack(plt, array2, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_hcompare(plt) return plt
def test_plot_regression2(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) regression = lambda x: 2 * x + x**2 # Any callable that takes x and return y is a valid isopy.tb.plot_scatter(plt, x, y, color='red') isopy.tb.plot_regression(plt, regression, color='red', xlim=(-1, 1)) return plt
def test_plot_regression1(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) regression = isopy.tb.regression_linear(x, y) isopy.tb.plot_scatter(plt, x, y) isopy.tb.plot_regression(plt, regression) return plt
def test_plot_vcompare4(): plt.close() plt.clf() keys = isopy.keylist('pd105', 'ru101', 'cd111') array1 = isopy.random(100, 0.9, keys, seed=46) array2 = isopy.random(100, 1.1, keys, seed=47) isopy.tb.plot_vstack(plt, array1) isopy.tb.plot_vstack(plt, array2, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_vcompare(plt.gcf(), combine_ticklabels=True) return plt
def test_plot_hstack2(): plt.close() plt.clf() keys = isopy.keylist('pd105', 'ru101', 'cd111') array1 = isopy.random(100, -0.5, keys, seed=46) array2 = isopy.random(100, 0.5, keys, seed=47) isopy.tb.create_subplots(plt, keys.sorted(), (-1, 1)) isopy.tb.plot_hstack(plt, array1) isopy.tb.plot_hstack(plt, array2, cval=np.mean, pmval=isopy.sd2) return plt
def test_plot_regression3(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) xerr = 0.2 yerr = isopy.random(20, seed=48) regression = isopy.tb.regression_york1(x, y, xerr, yerr) isopy.tb.plot_scatter(plt, x, y, xerr, yerr) isopy.tb.plot_regression(plt, regression) return plt
def test_plot_regression4(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) xerr = 0.2 yerr = isopy.random(20, seed=48) regression = isopy.tb.regression_york1(x, y, xerr, yerr) isopy.tb.plot_scatter(plt, x, y, xerr, yerr, color='red') isopy.tb.plot_regression(plt, regression, color='red', line='dashed', edgeline=False) return plt
def test_plot_vcompare3(): plt.close() plt.clf() pmunits = ['diff', 'abs', '%', 'ppt', 'ppm', 'ppb'] subplots = isopy.tb.create_subplots(plt, pmunits, (1, -1), figure_width=8) array1 = isopy.random(100, 0.9, seed=46) array2 = isopy.random(100, 1.1, seed=47) for unit, axes in subplots.items(): isopy.tb.plot_vstack(axes, array1, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_vstack(axes, array2, cval=np.mean, pmval=isopy.sd2) isopy.tb.plot_vcompare(axes, pmval=isopy.sd, pmunit=unit, combine_ticklabels=True) axes.set_xlabel(f'pmunit="{unit}"') return plt
def test_plot_scatter2(): plt.close() plt.clf() x = isopy.random(20, seed=46) y = x * 3 + isopy.random(20, seed=47) xerr = 0.2 yerr = isopy.random(20, seed=48) isopy.tb.plot_scatter(plt, x, y, xerr, yerr, regression='york1', color='red', marker='s') return plt
def test_plot_hstack3(): plt.close() plt.clf() keys = isopy.keylist('pd105', 'ru101', 'cd111') array = isopy.random(100, -0.5, keys, seed=46) mean = np.mean(array) sd = isopy.sd(array) outliers = isopy.tb.find_outliers(array, mean, sd) isopy.tb.create_subplots(plt, keys.sorted(), (-1, 1)) isopy.tb.plot_hstack(plt, array, cval=mean, pmval=sd, outliers=outliers, color=('red', 'pink')) return plt
def test_create_legend1(): plt.close() plt.clf() data = isopy.random(100, keys='ru pd cd'.split(), seed=46) axes = isopy.tb.create_subplots(plt, [['left', 'right']], figure_width=8) isopy.tb.plot_scatter(axes['left'], data['pd'], data['ru'], label='ru/pd', color='red') isopy.tb.plot_scatter(axes['right'], data['pd'], data['cd'], label='cd/pd', color='blue') isopy.tb.create_legend(axes['right'], axes['left']) return plt
def test_create_legend2(): plt.close() plt.clf() data = isopy.random(100, keys='ru pd cd'.split(), seed=46) axes = isopy.tb.create_subplots(plt, [['left', 'right', 'legend']], figure_width=9, gridspec_width_ratios=[4, 4, 1]) isopy.tb.plot_scatter(axes['left'], data['pd'], data['ru'], label='ru/pd', color='red') isopy.tb.plot_scatter(axes['right'], data['pd'], data['cd'], label='cd/pd', color='blue') isopy.tb.create_legend(axes['legend'], axes, hide_axis=True) return plt