Exemplo n.º 1
0
def test_field_cut_off_axis_octree():
    ds = fake_octree_ds() 
    cut = ds.all_data().cut_region('obj["density"]>0.5') 
    p1 = OffAxisProjectionPlot(ds, [1, 0, 0], 'density')
    p2 = OffAxisProjectionPlot(ds, [1, 0, 0], 'density', data_source=cut)
    assert_equal(p2.frb["density"].min() == 0.0, True) # Lots of zeros
    assert_equal((p1.frb["density"] == p2.frb["density"]).all(), False)
    p3 = OffAxisSlicePlot(ds, [1, 0, 0], 'density')
    p4 = OffAxisSlicePlot(ds, [1, 0, 0], 'density', data_source=cut)
    assert_equal((p3.frb["density"] == p4.frb["density"]).all(), False)
    p4rho = p4.frb["density"]
    assert_equal(p4rho.min() == 0.0, True) # Lots of zeros
    assert_equal(p4rho[p4rho > 0.0].min() >= 0.5, True)
Exemplo n.º 2
0
    def setUpClass(cls):
        test_ds = fake_random_ds(64)
        normal = [1, 1, 1]
        ds_region = test_ds.region([0.5] * 3, [0.4] * 3, [0.6] * 3)
        projections = []
        projections_ds = []
        projections_c = []
        projections_wf = []
        projections_w = {}
        for dim in range(3):
            projections.append(ProjectionPlot(test_ds, dim, "density"))
            projections_ds.append(
                ProjectionPlot(test_ds, dim, "density", data_source=ds_region))
        for center in CENTER_SPECS:
            projections_c.append(
                ProjectionPlot(test_ds, dim, "density", center=center))
        for width in WIDTH_SPECS:
            projections_w[width] = ProjectionPlot(test_ds,
                                                  dim,
                                                  'density',
                                                  width=width)
        for wf in WEIGHT_FIELDS:
            projections_wf.append(
                ProjectionPlot(test_ds, dim, "density", weight_field=wf))

        cls.slices = [SlicePlot(test_ds, dim, "density") for dim in range(3)]
        cls.projections = projections
        cls.projections_ds = projections_ds
        cls.projections_c = projections_c
        cls.projections_wf = projections_wf
        cls.projections_w = projections_w
        cls.offaxis_slice = OffAxisSlicePlot(test_ds, normal, "density")
        cls.offaxis_proj = OffAxisProjectionPlot(test_ds, normal, "density")
Exemplo n.º 3
0
 def test_offaxis_projection_plot(self):
     test_ds = fake_random_ds(16)
     prj = OffAxisProjectionPlot(test_ds, [1, 1, 1], "density")
     for fname in TEST_FLNMS:
         assert assert_fname(prj.save(fname)[0])