示例#1
0
def test_compare_arbitrary_grid_slice():
    ds = fake_sph_orientation_ds()
    c = np.array([0.0, 0.0, 0.0])
    width = 1.5
    buff_size = 51
    field = ("gas", "density")

    # buffer from arbitrary grid
    ag = ds.arbitrary_grid(c - width / 2, c + width / 2, [buff_size] * 3)
    buff_ag = ag[field][:, :, int(np.floor(buff_size / 2))].d.T

    # buffer from slice
    p = SlicePlot(ds, "z", field, center=c, width=width)
    p.set_buff_size(51)
    buff_slc = p.frb.data[field].d

    assert_equal(buff_slc, buff_ag)
示例#2
0
def test_gather_slice():
    ds = fake_sph_grid_ds()
    ds.num_neighbors = 5
    field = ("gas", "density")

    c = np.array([1.5, 1.5, 0.5])
    width = 3.0

    p = SlicePlot(ds, "z", field, center=c, width=width)
    p.set_buff_size(3)
    buff_scatter = p.frb.data[field].d

    ds.sph_smoothing_style = "gather"

    p = SlicePlot(ds, "z", field, center=c, width=width)
    p.set_buff_size(3)
    buff_gather = p.frb.data[field].d

    assert_equal(buff_scatter, buff_gather)