Example #1
0
def osmesa_empty():
    """Return an OSMesa context that has no dataset.
    """
    rc = yt_idv.render_context("osmesa", width=1024, height=1024)
    ds = yt.testing.fake_amr_ds()
    rc.add_scene(ds, None)
    rc.ds = ds
    yield rc
    rc.osmesa.OSMesaDestroyContext(rc.context)
Example #2
0
def osmesa_fake_amr():
    """Return an OSMesa context that has a "fake" AMR dataset added, with "radius"
    as the field.
    """
    ds = yt.testing.fake_amr_ds()
    dd = ds.all_data()
    rc = yt_idv.render_context("osmesa", width=1024, height=1024)
    rc.add_scene(dd, "radius", no_ghost=True)
    yield rc
    rc.osmesa.OSMesaDestroyContext(rc.context)
Example #3
0
import yt

import yt_idv

ds = yt.load_sample("MOOSE_Sample_data", "out.e-s010")

rc = yt_idv.render_context(height=800, width=800, gui=True)

from yt_idv.cameras.trackball_camera import TrackballCamera  # NOQA
from yt_idv.scene_components.mesh import MeshRendering  # NOQA
from yt_idv.scene_data.mesh import MeshData  # NOQA
from yt_idv.scene_graph import SceneGraph  # NOQA

c = TrackballCamera(position=[3.5, 3.5, 3.5], focus=[0.0, 0.0, 0.0])
rc.scene = SceneGraph(camera=c)

dd = ds.all_data()
md = MeshData(data_source=dd)
md.add_data(("connect1", "diffused"))
mr = MeshRendering(data=md, cmap_log=False)

rc.scene.data_objects.append(md)
rc.scene.components.append(mr)
rc.run()
Example #4
0
import yt

import yt_idv

ds = yt.load_sample("IsolatedGalaxy")
dd = ds.all_data()

rc = yt_idv.render_context("osmesa", width=1024, height=1024)
rc.add_scene(dd, "density", no_ghost=True)

image = rc.run()
yt.write_bitmap(image, "step1.png")

rc.scene.camera.move_forward(1.5)

image = rc.run()
yt.write_bitmap(image, "step2.png")
Example #5
0
import yt

import yt_idv

N = 400

ds = yt.load_sample("HiresIsolatedGalaxy")
c = [0.53, 0.53, 0.53]

rc = yt_idv.render_context("egl", width=1024, height=1024)
sc = rc.add_scene(ds, "density", no_ghost=False)
sc.components[0].render_method = "projection"
sc.camera.focus = c
sc.camera.position = [0.45, 0.44, 0.43]

ds = (sc.camera.focus - sc.camera.position) / N

for i in range(N):
    sc.components[0].cmap_min = sc.components[0].cmap_max = None
    sc.camera.position = sc.camera.position + ds
    sc.camera._update_matrices()
    rc.snap()