示例#1
0
def test_ray_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0, 1.0, 1.0]
        ds = fake_amr_ds(fields=("density", ))
        ray = ds.ray((0.1, 0.2, 0.3), (.6, .8, .5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        p = SlicePlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray, plot_args={'color': 'red'})
        p.save(prefix)

    with _cleanup_fname() as prefix:
        ds = fake_amr_ds(fields=("density", ), geometry="spherical")
        ray = ds.ray((0.1, 0.2, 0.3), (0.6, 0.8, 0.5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, "r", "density")
        p.annotate_ray(oray)
        assert_raises(YTDataTypeUnsupported, p.save, prefix)
        p = ProjectionPlot(ds, "r", "density")
        p.annotate_ray(ray)
        assert_raises(YTDataTypeUnsupported, p.save, prefix)
示例#2
0
def test_ray_callback():
    with _cleanup_fname() as prefix:
        ax = "z"
        vector = [1.0, 1.0, 1.0]
        ds = fake_amr_ds(fields=("density",), units=("g/cm**3",))
        ray = ds.ray((0.1, 0.2, 0.3), (0.6, 0.8, 0.5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, ax, ("gas", "density"))
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        p = SlicePlot(ds, ax, ("gas", "density"))
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        p = OffAxisSlicePlot(ds, vector, ("gas", "density"))
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        assert_fname(p.save(prefix)[0])
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", ("gas", "density"))
        p.annotate_ray(oray)
        p.annotate_ray(ray, color="red")
        p.save(prefix)
        check_axis_manipulation(p, prefix)

    with _cleanup_fname() as prefix:
        ds = fake_amr_ds(fields=("density",), units=("g/cm**3",), geometry="spherical")
        ray = ds.ray((0.1, 0.2, 0.3), (0.6, 0.8, 0.5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, "r", ("gas", "density"))
        assert_raises(YTDataTypeUnsupported, p.annotate_ray, oray)
        assert_raises(YTDataTypeUnsupported, p.annotate_ray, ray)
def test_ray_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0, 1.0, 1.0]
        ds = fake_amr_ds(fields=("density", ))
        ray = ds.ray((0.1, 0.2, 0.3), (1.6, 1.8, 1.5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        p = SlicePlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray, plot_args={'color': 'red'})
        p.save(prefix)
def test_ray_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0,1.0,1.0]
        ds = fake_amr_ds(fields = ("density",))
        ray = ds.ray((0.1, 0.2, 0.3), (1.6, 1.8, 1.5))
        oray = ds.ortho_ray(0, (0.3, 0.4))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        p = SlicePlot(ds, ax, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray)
        yield assert_fname, p.save(prefix)[0]
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        p.annotate_ray(oray)
        p.annotate_ray(ray, plot_args={'color':'red'})
        p.save(prefix)