ds = yt.load( "/Volumes/Transcend/R_Tony/interpolated_co/xycut_co/done/NGC5908.co.xycut.K.fits", nan_mask=0.0) ds.periodicity = (True, True, True) shape = ds.domain_dimensions v = ds.r[::1j * shape[0], ::1j * shape[1], ::1j * shape[2]]["intensity"] print(v.min(), v.max()) v -= v.min() v /= (v.max() - v.min()) v = 10**v print(v.min(), v.max()) ds = yt.load_uniform_grid({'response': v}, v.shape, bbox=np.array([[0.0, 1.0] for _ in 'xyz'])) rc = RenderingContext(960, 960) rc = RenderingContext(960, 960, always_on_top=True) dd = ds.all_data() collection = ivr.BlockCollection(data_source=dd) collection.add_data("response") br = ivr.BlockRendering(data=collection, vertex_shader="default.v", fragment_shader="max_intensity.f", colormap_vertex="passthrough.v", colormap_fragment="apply_colormap.f") scene = ivr.SceneGraph() scene.data_objects.append(collection)
import yt from yt.visualization.volume_rendering.interactive_vr import \ SceneGraph, BlockCollection, TrackballCamera from yt.visualization.volume_rendering.interactive_loop import \ RenderingContext from yt.visualization.volume_rendering import glfw_inputhook rc = RenderingContext(1280, 960) scene = SceneGraph() collection = BlockCollection() ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030") dd = ds.all_data() collection.add_data(dd, "density") scene.add_collection(collection) position = (1.0, 1.0, 1.0) c = TrackballCamera(position=position, focus=ds.domain_center, near_plane=0.1) callbacks = rc.setup_loop(scene, c) rl = rc(scene, c, callbacks) # To make this work from IPython execute: # # glfw_inputhook.inputhook_manager.enable_gui("glfw", app=rl)
import yt from yt.visualization.volume_rendering.interactive_vr import \ SceneGraph, BlockCollection, TrackballCamera from yt.visualization.volume_rendering.interactive_loop import \ RenderingContext ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030") # Create GLUT window rc = RenderingContext(1280, 960) # Create a 3d Texture from all_data() collection = BlockCollection() dd = ds.all_data() collection.add_data(dd, "density") # Initiliaze basic Scene and pass the data scene = SceneGraph() scene.add_collection(collection) # Create default camera position = (1.0, 1.0, 1.0) c = TrackballCamera(position=position, focus=ds.domain_center, near_plane=0.1) # Start rendering loop rc.start_loop(scene, c)