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