Esempio n. 1
0
def test_plot_customized_axes():
    d = make_dense_dataset(ndim=3)
    plot(d["Sample"],
         projection="3d",
         xlabel="MyXlabel",
         ylabel="MyYlabel",
         zlabel="MyZlabel")
Esempio n. 2
0
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})
Esempio n. 3
0
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
Esempio n. 4
0
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.")
Esempio n. 5
0
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"})
Esempio n. 6
0
def test_plot_dataset_view():
    d = make_dense_dataset(ndim=2)
    plot(d['x', 0])
Esempio n. 7
0
def test_plot_data_array():
    d = make_dense_dataset(ndim=1)
    plot(d["Sample"])
Esempio n. 8
0
def test_plot_sliceviewer_with_1d_projection():
    d = make_dense_dataset(ndim=3)
    plot(d, projection="1d")
Esempio n. 9
0
def test_plot_2d_image_with_log_scale_xy():
    plot(make_dense_dataset(ndim=2), scale={'tof': 'log', 'x': 'log'})
Esempio n. 10
0
def test_plot_1d_bin_edges_with_variances():
    d = make_dense_dataset(ndim=1, variances=True, binedges=True)
    plot(d)
Esempio n. 11
0
def test_plot_2d_image_with_cmap():
    plot(make_dense_dataset(ndim=2), cmap='jet')
Esempio n. 12
0
def test_plot_2d_with_masks():
    plot(make_dense_dataset(ndim=2, masks=True))
Esempio n. 13
0
def test_plot_1d_with_labels():
    d = make_dense_dataset(ndim=1, labels=True)
    plot(d, axes=["somelabels"])
Esempio n. 14
0
def test_plot_2d_image_with_filename():
    plot(make_dense_dataset(ndim=2), filename='image.pdf')
Esempio n. 15
0
def test_plot_2d_image_with_bin_edges():
    plot(make_dense_dataset(ndim=2, binedges=True))
Esempio n. 16
0
def test_plot_2d_image_with_attrss():
    plot(make_dense_dataset(ndim=2, attrs=True), axes={'x': 'attr'})
Esempio n. 17
0
def test_plot_2d_image_with_labels():
    plot(make_dense_dataset(ndim=2, labels=True), axes={'x': 'somelabels'})
Esempio n. 18
0
def test_plot_2d_image_with_yaxis_specified():
    plot(make_dense_dataset(ndim=2), axes={'y': 'tof'})
Esempio n. 19
0
def test_plot_1d():
    d = make_dense_dataset(ndim=1)
    plot(d)
Esempio n. 20
0
def test_plot_2d_with_masks_and_labels():
    plot(make_dense_dataset(ndim=2, masks=True, labels=True),
         axes={'x': 'somelabels'})
Esempio n. 21
0
def test_plot_1d_bin_edges():
    d = make_dense_dataset(ndim=1, binedges=True)
    plot(d)
Esempio n. 22
0
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)
Esempio n. 23
0
def test_plot_1d_log_axes():
    d = make_dense_dataset(ndim=1)
    plot(d, logx=True)
    plot(d, logy=True)
    plot(d, logxy=True)
Esempio n. 24
0
def test_plot_2d_image_with_vmin_vmax_with_log():
    plot(make_dense_dataset(ndim=2), vmin=0.1, vmax=0.9, norm='log')
Esempio n. 25
0
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)
Esempio n. 26
0
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')
Esempio n. 27
0
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)
Esempio n. 28
0
def test_plot_2d_image_int32():
    plot(make_dense_dataset(ndim=2, dtype=sc.dtype.int32))
Esempio n. 29
0
def test_plot_1d_with_masks():
    d = make_dense_dataset(ndim=1, masks=True)
    plot(d)
Esempio n. 30
0
def test_plot_collapse():
    d = make_dense_dataset(ndim=2)
    plot(sc.collapse(d["Sample"], keep='tof'))