[plotter] fix movies
This commit is contained in:
+5
-2
@@ -26,7 +26,7 @@ if os.environ.get("DISPLAY", "") == "":
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from moviepy.video.io import ImageSequenceClip
|
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
|
||||||
|
|
||||||
import pspec_read
|
import pspec_read
|
||||||
from baseprocessor import Rule, BaseProcessor
|
from baseprocessor import Rule, BaseProcessor
|
||||||
@@ -301,6 +301,8 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
nums = self.nums
|
nums = self.nums
|
||||||
|
|
||||||
datafiles = []
|
datafiles = []
|
||||||
|
if movie:
|
||||||
|
filenames = []
|
||||||
|
|
||||||
if rule.kind == "snapshot" or rule.kind == "cells":
|
if rule.kind == "snapshot" or rule.kind == "cells":
|
||||||
run_num = [(run, num) for run in runs for num in nums[run]]
|
run_num = [(run, num) for run in runs for num in nums[run]]
|
||||||
@@ -362,6 +364,8 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
# Save in astrophysix format
|
# Save in astrophysix format
|
||||||
df = rule.datafile(name, arg)
|
df = rule.datafile(name, arg)
|
||||||
df[filetype] = plot_filename
|
df[filetype] = plot_filename
|
||||||
|
if movie:
|
||||||
|
filenames.append(plot_filename)
|
||||||
if plot_info is not None:
|
if plot_info is not None:
|
||||||
df.plot_info = plot_info
|
df.plot_info = plot_info
|
||||||
if num is not None:
|
if num is not None:
|
||||||
@@ -378,7 +382,6 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
datafiles.append(df)
|
datafiles.append(df)
|
||||||
|
|
||||||
if movie:
|
if movie:
|
||||||
filenames = [df[filetype] for df in datafiles]
|
|
||||||
clip = ImageSequenceClip(filenames, fps=movie_fps)
|
clip = ImageSequenceClip(filenames, fps=movie_fps)
|
||||||
movie_filename = self._find_filename(name_full)
|
movie_filename = self._find_filename(name_full)
|
||||||
movie.filename = os.path.splitext(movie_filename)[0] + ".mp4"
|
movie.filename = os.path.splitext(movie_filename)[0] + ".mp4"
|
||||||
|
|||||||
Reference in New Issue
Block a user