From eee38ad7f45b02d7188b7554f480c1045e3671f8 Mon Sep 17 00:00:00 2001 From: David Minton Date: Sat, 28 Aug 2021 17:17:09 -0400 Subject: [PATCH] Updated movie script so that it can actually process out the empty data in a reasonable amount of time --- examples/symba_mars_disk/aescattermovie.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/symba_mars_disk/aescattermovie.py b/examples/symba_mars_disk/aescattermovie.py index eaaa4d9b4..c91296c63 100755 --- a/examples/symba_mars_disk/aescattermovie.py +++ b/examples/symba_mars_disk/aescattermovie.py @@ -20,14 +20,11 @@ class AnimatedScatter(object): def __init__(self, ds, param): frame = 0 - nframes = int(ds['time'].size / framejump) self.ds = ds - self.param = param + self.nframes = int(ds['time'].size / framejump) self.Rcb = self.ds['radius'].sel(id=0, time=0).values - self.ds['radmarker'] = self.ds['radius'].fillna(0) - np.where(self.ds['radmarker'] > ncutoff, 0, self.ds['radmarker']) - self.ds['radmarker'] = (self.ds['radmarker'] / self.Rcb) * radscale - + self.ds = ds + self.param = param self.clist = {'Initial conditions' : 'xkcd:faded blue', 'Disruption' : 'xkcd:marigold', 'Supercatastrophic' : 'xkcd:shocking pink', @@ -41,7 +38,8 @@ def __init__(self, ds, param): self.ax.set_xlim(xmin, xmax) self.ax.set_ylim(ymin, ymax) fig.add_axes(self.ax) - self.ani = animation.FuncAnimation(fig, self.update, interval=1, frames=nframes, init_func=self.setup_plot, blit=True) + self.ani = animation.FuncAnimation(fig, self.update, interval=1, frames=self.nframes, init_func=self.setup_plot, blit=True) + #self.ani.save('aescatter.mp4', fps=30, dpi=300, extra_args=['-vcodec', 'libx264']) self.ani.save('aescatter.mp4', fps=30, dpi=300, extra_args=['-vcodec', 'mpeg4']) print('Finished writing aescattter.mp4') @@ -79,10 +77,10 @@ def setup_plot(self): def data_stream(self, frame=0): while True: d = self.ds.isel(time=frame) - d = d.where(d['a'] < ncutoff, drop=True) + d = d.where(d['radius'] < self.Rcb, drop=True) + d['radmarker'] = (d['radius'] / self.Rcb) * radscale radius = d['radmarker'].values - d = d.where(d['a'] > self.Rcb, drop=True) Gmass = d['Gmass'].values a = d['a'].values / self.Rcb