Commit dadf0ecf authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

wip movie output

parent 5d05ae2b
...@@ -1419,8 +1419,8 @@ def solve(problem, ...@@ -1419,8 +1419,8 @@ def solve(problem,
if plot: if plot:
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from grond import plot as gplot from grond import plot as gplot
plt.ion() #plt.ion()
plt.show() #plt.show()
solver_plot = gplot.SolverPlot(problem, plt) solver_plot = gplot.SolverPlot(problem, plt)
while iiter < niter: while iiter < niter:
...@@ -1692,7 +1692,8 @@ def solve(problem, ...@@ -1692,7 +1692,8 @@ def solve(problem,
iiter += 1 iiter += 1
if plot: if plot:
plt.ioff() solver_plot.finish()
#plt.ioff()
def bootstrap_outliers(problem, misfits, std_factor=1.0): def bootstrap_outliers(problem, misfits, std_factor=1.0):
......
...@@ -1607,7 +1607,14 @@ class SolverPlot(object): ...@@ -1607,7 +1607,14 @@ class SolverPlot(object):
self.cmap = LinearSegmentedColormap.from_list('probability', [ self.cmap = LinearSegmentedColormap.from_list('probability', [
(1.0, 1.0, 1.0), (1.0, 1.0, 1.0),
(0.5, 0.9, 0.6)]) (0.5, 0.9, 0.6)])
from matplotlib.animation import FFMpegWriter
metadata = dict(title='Movie Test', artist='Matplotlib',
comment='Movie support!')
self.writer = FFMpegWriter(fps=15, metadata=metadata)
self.writer.setup(self.fig, 'test.mp4', dpi=100)
def set_limits(self): def set_limits(self):
self.axes.set_xlim(*self.xlim) self.axes.set_xlim(*self.xlim)
...@@ -1698,4 +1705,9 @@ class SolverPlot(object): ...@@ -1698,4 +1705,9 @@ class SolverPlot(object):
edgecolors='black') edgecolors='black')
self.set_limits() self.set_limits()
self.plt.draw() #self.plt.draw()
self.writer.grab_frame()
def finish(self):
self.writer.finish()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment