Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yt-project
GitHub Repository: yt-project/yt
Path: blob/main/doc/source/cookbook/custom_camera_volume_rendering.py
928 views
1
import yt
2
3
# Load the dataset
4
ds = yt.load("Enzo_64/DD0043/data0043")
5
6
# Create a volume rendering
7
sc = yt.create_scene(ds, field=("gas", "density"))
8
9
# Now increase the resolution
10
sc.camera.resolution = (1024, 1024)
11
12
# Set the camera focus to a position that is offset from the center of
13
# the domain
14
sc.camera.focus = ds.arr([0.3, 0.3, 0.3], "unitary")
15
16
# Move the camera position to the other side of the dataset
17
sc.camera.position = ds.arr([0, 0, 0], "unitary")
18
19
# save to disk with a custom filename and apply sigma clipping to eliminate
20
# very bright pixels, producing an image with better contrast.
21
sc.render()
22
sc.save("custom.png", sigma_clip=4)
23
24