diff --git a/examples/symba_energy_momentum/collision_movie.py b/examples/symba_energy_momentum/collision_movie.py index 2cf98a46d..efc62ab86 100644 --- a/examples/symba_energy_momentum/collision_movie.py +++ b/examples/symba_energy_momentum/collision_movie.py @@ -10,8 +10,8 @@ ymin = -20.0 ymax = 20.0 -#cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off'] -cases = ['disruption_off', 'supercat_off'] +cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off'] +#cases = ['disruption_off', 'supercat_off'] def scale_sim(ds, config): @@ -169,14 +169,12 @@ def spin_arrows(self, pl, id, len): py = pl[:, 1] sarrowend = [] sarrowtip = [] - idxactive = np.arange(id.size)[self.mask] for i in range(pl.shape[0]): - endrel = np.array([0.0, len[i], 0.0]) - tiprel = np.array([0.0, -len[i], 0.0]) + endrel = np.array([len[i], 0.0, 0.0]) + tiprel = np.array([-len[i], 0.0, 0.0]) r = R.from_rotvec(self.rot_angle[id[i]]) - if i in idxactive: - endrel = r.apply(endrel) - tiprel = r.apply(tiprel) + endrel = r.apply(endrel) + tiprel = r.apply(tiprel) send = (px[i] + endrel[0], py[i] + endrel[1]) stip = (px[i] + tiprel[0], py[i] + tiprel[1]) sarrowend.append(send) @@ -268,6 +266,7 @@ def data_stream(self, frame=0): roty = np.nan_to_num(roty, copy=False) rotz = np.nan_to_num(rotz, copy=False) rotvec = np.array([rotx, roty, rotz]) + self.rotvec = dict(zip(id, zip(*rotvec))) if frame == 0: tmp = np.zeros_like(rotvec) @@ -275,13 +274,9 @@ def data_stream(self, frame=0): else: t0 = self.ds.coords['time'].values[frame-1] dt = t - t0 - for i in np.arange(npl): - if id[i] in self.rot_angle: - self.rot_angle[id[i]] = self.rot_angle[id[i]] + dt * rotvec[:,i] - self.rot_angle[id[i]] = self.rot_angle[id[i]] % (2 * np.pi) - else: - self.rot_angle[id[i]] = np.zeros(3) - + idxactive = np.arange(id.size)[self.mask] + for i in id[idxactive]: + self.rot_angle[i] = self.rot_angle[i] + dt * np.array(self.rotvec[i]) frame += 1 yield t, name, mass, radius, npl, np.c_[x, y, vx, vy], radmarker, origin diff --git a/examples/symba_energy_momentum/disruption_headon.in b/examples/symba_energy_momentum/disruption_headon.in index 34688822c..fe81f1641 100644 --- a/examples/symba_energy_momentum/disruption_headon.in +++ b/examples/symba_energy_momentum/disruption_headon.in @@ -9,10 +9,10 @@ 1.0 -4.20E-05 0.0 0.00 6.28 0.0 0.4 0.4 0.4 !Ip -0.0 0.0 0.0 !rot +0.0 0.0 6.0e4 !rot 3 7e-10 0.0004 3.25e-06 1.0 4.20E-05 0.0 0.00 -6.28 0.0 0.4 0.4 0.4 !Ip -0.0 0.0 0.0 !rot +0.0 0.0 1.0e5 !rot diff --git a/examples/symba_energy_momentum/supercatastrophic_headon.in b/examples/symba_energy_momentum/supercatastrophic_headon.in index 1ffbeacc5..b87fbba05 100644 --- a/examples/symba_energy_momentum/supercatastrophic_headon.in +++ b/examples/symba_energy_momentum/supercatastrophic_headon.in @@ -9,10 +9,10 @@ 1.0 -4.20E-05 0.0 0.00 6.28 0.0 0.4 0.4 0.4 !Ip -0.0 0.0 0.0 !rot +0.0 0.0 -6.0e4 !rot 3 1e-08 0.0004 3.25e-06 1.0 4.20E-05 0.0 0.00 -6.28 0.0 0.4 0.4 0.4 !Ip -0.0 0.0 0.0 !rot +0.0 0.0 1.0e5 !rot