Making Movies

The process of making movies is two-step; the first is to make the frames, which one can do in yt, but the second requires an external software package such as QTSuperImager or mencoder, where the frames are concatenated into a single movie file.

Making Zoomin Movies

There is a command-line script that comes with yt, yt_zoomin.py, that will create a set of frames given command line arguments. However, if you need more control over the process, the following snippet of code should be a good starting place.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from yt.mods import *

pf = get_pf() # Last argument on command line turned into an output file

n_frames = 200
min_dx = 250
frame_template = "frames/frame_%05i"

pc = raven.PlotCollection(pf)

for i in range(3):
    pl = pc.add_slice("Density",i)
    pl.add_callback(raven.UnitBoundaryCallback('pc'))

for i,v in enumerate(na.logspace(0,
             na.log10(pf.h.get_smallest_dx()*min_dx), n_frames)):
    pc.set_width(v,'1')
    fn=pc.save(frame_template % (i))

Making Timeseries Movies

There is a command-line script that comes with yt, yt_timeseries.py, that will create a set of frames given command line arguments. However, the idiom for a very simple set of timeseries frames is given here.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from yt.mods import *

min_output_number = 0
max_output_number = 30
skip = 1

rho_min = 1e-30
rho_max = 1e-20

frame_template = "frames/frame_%04i.png"
basename_template = "galaxy%04i.dir/galaxy%04i"

for i in range(min_output_number, max_output_number+1, skip):
    basename = basename_template % (i,i)
    pf = lagos.EnzoStaticOutput(basename)
    pc = raven.PlotCollection(pf, center=[0.5,0.5,0.5])
    pc.add_projection("Density",0)
    pc.set_zlim(rho_min, rho_max)
    # Override the name
    pc.save(frame_template % (i), override=True)