def test_plot_customized_axes(): d = make_dense_dataset(ndim=3) plot(d["Sample"], projection="3d", xlabel="MyXlabel", ylabel="MyYlabel", zlabel="MyZlabel")
def test_plot_1d_two_entries_hide_variances(): d = make_dense_dataset(ndim=1, variances=True) d["Background"] = sc.Variable(['tof'], values=2.0 * np.random.rand(50), unit=sc.units.counts) plot(d, errorbars=False) # When variances are not present, the plot does not fail, is silently does # not show variances plot(d, errorbars={"Sample": False, "Background": True})
def test_plot_sliceviewer_with_1d_projection_with_nans(): d = make_dense_dataset(ndim=3, binedges=True, variances=True) d['Sample'].values = np.where(d['Sample'].values < -0.8, np.nan, d['Sample'].values) d['Sample'].variances = np.where(d['Sample'].values < 0., np.nan, d['Sample'].variances) p = plot(d, projection='1d') # Move the sliders p['tof.x.y.counts']['widgets']['sliders']['tof'].value = 10 p['tof.x.y.counts']['widgets']['sliders']['x'].value = 10 p['tof.x.y.counts']['widgets']['sliders']['y'].value = 10
def test_plot_3d_data_ragged(): """ This test has caught MANY bugs and should not be disabled. """ d = make_dense_dataset(ndim=3, ragged=True) plot(d) # Also check that it raises an error if we try to have ragged coord along # slider dim with pytest.raises(RuntimeError) as e: plot(d, axes={'x': 'tof', 'y': 'x'}) assert str(e.value) == ("A ragged coordinate cannot lie along " "a slider dimension, it must be one of " "the displayed dimensions.")
def test_plot_1d_three_entries_with_labels(): N = 50 d = make_dense_dataset(ndim=1, labels=True) d["Background"] = sc.Variable(['tof'], values=2.0 * np.random.rand(N), unit=sc.units.counts) d.coords['x'] = sc.Variable(['x'], values=np.arange(N).astype(np.float64), unit=sc.units.m) d["Sample2"] = sc.Variable(['x'], values=10.0 * np.random.rand(N), unit=sc.units.counts) d.coords["Xlabels"] = sc.Variable(['x'], values=np.linspace(151., 155., N), unit=sc.units.s) plot(d, axes={'x': "Xlabels", 'tof': "somelabels"})
def test_plot_dataset_view(): d = make_dense_dataset(ndim=2) plot(d['x', 0])
def test_plot_data_array(): d = make_dense_dataset(ndim=1) plot(d["Sample"])
def test_plot_sliceviewer_with_1d_projection(): d = make_dense_dataset(ndim=3) plot(d, projection="1d")
def test_plot_2d_image_with_log_scale_xy(): plot(make_dense_dataset(ndim=2), scale={'tof': 'log', 'x': 'log'})
def test_plot_1d_bin_edges_with_variances(): d = make_dense_dataset(ndim=1, variances=True, binedges=True) plot(d)
def test_plot_2d_image_with_cmap(): plot(make_dense_dataset(ndim=2), cmap='jet')
def test_plot_2d_with_masks(): plot(make_dense_dataset(ndim=2, masks=True))
def test_plot_1d_with_labels(): d = make_dense_dataset(ndim=1, labels=True) plot(d, axes=["somelabels"])
def test_plot_2d_image_with_filename(): plot(make_dense_dataset(ndim=2), filename='image.pdf')
def test_plot_2d_image_with_bin_edges(): plot(make_dense_dataset(ndim=2, binedges=True))
def test_plot_2d_image_with_attrss(): plot(make_dense_dataset(ndim=2, attrs=True), axes={'x': 'attr'})
def test_plot_2d_image_with_labels(): plot(make_dense_dataset(ndim=2, labels=True), axes={'x': 'somelabels'})
def test_plot_2d_image_with_yaxis_specified(): plot(make_dense_dataset(ndim=2), axes={'y': 'tof'})
def test_plot_1d(): d = make_dense_dataset(ndim=1) plot(d)
def test_plot_2d_with_masks_and_labels(): plot(make_dense_dataset(ndim=2, masks=True, labels=True), axes={'x': 'somelabels'})
def test_plot_1d_bin_edges(): d = make_dense_dataset(ndim=1, binedges=True) plot(d)
def test_plot_1d_two_entries_on_same_plot(): d = make_dense_dataset(ndim=1) d["Background"] = sc.Variable(['tof'], values=2.0 * np.random.rand(50), unit=sc.units.counts) plot(d)
def test_plot_1d_log_axes(): d = make_dense_dataset(ndim=1) plot(d, logx=True) plot(d, logy=True) plot(d, logxy=True)
def test_plot_2d_image_with_vmin_vmax_with_log(): plot(make_dense_dataset(ndim=2), vmin=0.1, vmax=0.9, norm='log')
def test_plot_1d_two_separate_entries(): d = make_dense_dataset(ndim=1) d["Background"] = sc.Variable(['tof'], values=2.0 * np.random.rand(50), unit=sc.units.kg) plot(d)
def test_plot_2d_image_with_with_nan_with_log(): d = make_dense_dataset(ndim=2) d['Sample'].values[0, 0] = np.nan plot(d, norm='log')
def test_plot_2d_image_with_non_regular_bin_edges_resolution(): d = make_dense_dataset(ndim=2, binedges=True) d.coords['tof'].values = d.coords['tof'].values**2 plot(d, resolution=128)
def test_plot_2d_image_int32(): plot(make_dense_dataset(ndim=2, dtype=sc.dtype.int32))
def test_plot_1d_with_masks(): d = make_dense_dataset(ndim=1, masks=True) plot(d)
def test_plot_collapse(): d = make_dense_dataset(ndim=2) plot(sc.collapse(d["Sample"], keep='tof'))