def test_marker_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0, 1.0, 1.0]
        ds = fake_amr_ds(fields=("density", ))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        yield assert_fname, p.save(prefix)[0]
        p = SlicePlot(ds, ax, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        yield assert_fname, p.save(prefix)[0]
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        yield assert_fname, p.save(prefix)[0]
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        p.annotate_marker([0.5, 0.5], coord_system='axis', marker='*')
        p.save(prefix)
def test_marker_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0,1.0,1.0]
        ds = fake_amr_ds(fields = ("density",))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_marker([0.5,0.5,0.5])
        yield assert_fname, p.save(prefix)[0]
        p = SlicePlot(ds, ax, "density")
        p.annotate_marker([0.5,0.5,0.5])
        yield assert_fname, p.save(prefix)[0]
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_marker([0.5,0.5,0.5])
        yield assert_fname, p.save(prefix)[0]
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        p.annotate_marker([0.5,0.5], coord_system='axis', marker='*')
        p.save(prefix)
示例#3
0
def test_marker_callback():
    with _cleanup_fname() as prefix:
        ax = 'z'
        vector = [1.0, 1.0, 1.0]
        ds = fake_amr_ds(fields=("density", ))
        p = ProjectionPlot(ds, ax, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        p = SlicePlot(ds, ax, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        p = OffAxisSlicePlot(ds, vector, "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", "density")
        coord = ds.arr([0.75, 0.75, 0.75], 'unitary')
        coord.convert_to_units('kpc')
        p.annotate_marker(coord, coord_system='data')
        p.annotate_marker([0.5, 0.5], coord_system='axis', marker='*')
        p.annotate_marker([[0.5, 0.6], [0.5, 0.6], [0.5, 0.6]],
                          coord_system='data')
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8], [0.5, 0.6, 0.8]],
                          coord_system='data')
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]],
                          coord_system='axis')
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]],
                          coord_system='figure')
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]],
                          coord_system='plot')
        p.save(prefix)

    with _cleanup_fname() as prefix:
        ds = fake_amr_ds(fields=("density", ), geometry="spherical")
        p = ProjectionPlot(ds, "r", "density")
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_raises(YTDataTypeUnsupported, p.save, prefix)
        p = ProjectionPlot(ds, "r", "density")
        p.annotate_marker([0.5, 0.5], coord_system="axis")
        assert_fname(p.save(prefix)[0])
示例#4
0
def test_marker_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",))
        p = ProjectionPlot(ds, ax, ("gas", "density"))
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        p = SlicePlot(ds, ax, ("gas", "density"))
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        p = OffAxisSlicePlot(ds, vector, ("gas", "density"))
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_fname(p.save(prefix)[0])
        # Now we'll check a few additional minor things
        p = SlicePlot(ds, "x", ("gas", "density"))
        coord = ds.arr([0.75, 0.75, 0.75], "unitary")
        coord.convert_to_units("kpc")
        p.annotate_marker(coord, coord_system="data")
        p.annotate_marker([0.5, 0.5], coord_system="axis", marker="*")
        p.annotate_marker([[0.5, 0.6], [0.5, 0.6], [0.5, 0.6]], coord_system="data")
        p.annotate_marker(
            [[0.5, 0.6, 0.8], [0.5, 0.6, 0.8], [0.5, 0.6, 0.8]], coord_system="data"
        )
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]], coord_system="axis")
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]], coord_system="figure")
        p.annotate_marker([[0.5, 0.6, 0.8], [0.5, 0.6, 0.8]], coord_system="plot")
        p.save(prefix)

    with _cleanup_fname() as prefix:
        ds = fake_amr_ds(fields=("density",), units=("g/cm**3",), geometry="spherical")
        p = ProjectionPlot(ds, "r", ("gas", "density"))
        p.annotate_marker([0.5, 0.5, 0.5])
        assert_raises(YTDataTypeUnsupported, p.save, prefix)
        p = ProjectionPlot(ds, "r", ("gas", "density"))
        p.annotate_marker([0.5, 0.5], coord_system="axis")
        assert_fname(p.save(prefix)[0])