Skip to content

Make a rotating movie

Orbit a simulated galaxy while mapping its density-weighted gas temperature.

Before you start

Use the THOR and plotting setup, download the galaxy cutout, and install FFmpeg. Put the files below in the same working directory as the cutout. The projected-map tutorial explains the camera and temperature weighting used here.

Configure

Download rotation.yaml. This is a complete configuration; its camera settings under raytracer.operators.projections include:

mode: rotate
center: [0.509, 0.489, 0.736]
position: [0.509, 0.489, 0.556]
widths: [0.198, 0.132]
nframes: 96
degrees: 360
npixels: [384, 256]

The camera orbits the galaxy about the up axis, covering about 113 × 75 kpc. It renders 96 frames at 384 × 256 pixels.

Run

thor rotation.yaml

The run writes rotation/output.zr. Rerunning replaces that output.

Make the movie

Download plot_rotation.py and thorplot.py into your working directory, then run:

uv run --python 3.11 --with zarr --with numpy --with matplotlib plot_rotation.py

The output movie rotation.mp4 shows a full orbit around the galaxy. Increase nframes for a smoother, longer turn; at 24 frames per second, 96 frames make a four-second movie.