Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated movie script so that it can actually process out the empty data in a reasonable amount of time
  • Loading branch information
daminton committed Aug 28, 2021
1 parent fdbf1a9 commit eee38ad
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions examples/symba_mars_disk/aescattermovie.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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')

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eee38ad

Please sign in to comment.