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
 into IO
  • Loading branch information
daminton committed Aug 29, 2021
2 parents 1802274 + 44ea179 commit d2c9d4d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 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,16 +77,16 @@ 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
e = d['e'].values
name = d['id'].values
npl = d.id.count().values
npl = d['npl'].values[0]
radmarker = d['radmarker']
origin = d['origin_type'].values

Expand Down

0 comments on commit d2c9d4d

Please sign in to comment.