color=color) plt.ylabel('Energy') plt.xlabel('Time, s') plt.xlim((0, nbody.t[-1])) if out_file is not None: plt.savefig(out_file) if show is True: plt.show() import analytic_collapse from matplotlib.colors import colorConverter if __name__ == "__main__": bodies = Bodies() bodies.from_pickle(np.load("plummer_N700_T1000_E1e+11_d2e+14.pkl")) bodies.t = np.load('plummer_N700_T1000_E1e+11_d2e+14_time.npy') #print colorConverter.colors #for i in range(len(bodies[0].color)): #print bodies[0].color[i][:3] #print colorConverter.colors[tuple(bodies[0].color[i][:3])] #print colorConverter.colors.get('k') == bodies[0].color[i][:3] #center_of_mass_plot(bodies) #core_density_plot(bodies) #mean_distance_center_off_plot(bodies, color='r', show=False) #mean_distance_plot(bodies) #half_mass_radius_center_off_plot(bodies, color='r', show=False) #half_mass_radius_plot(bodies) #lagrange_radius_plot(bodies) #kinetic_energy_plot(bodies, show=False) #potential_energy_center_off_plot(bodies, color='r', show=False)
else: plt.plot(nbody.t, all_kinetic_energy + all_potential_energy, color=color) plt.ylabel('Energy') plt.xlabel('Time, s') plt.xlim((0, nbody.t[-1])) if out_file is not None: plt.savefig(out_file) if show is True: plt.show() import analytic_collapse from matplotlib.colors import colorConverter if __name__ == "__main__": bodies = Bodies() bodies.from_pickle(np.load("plummer_N700_T1000_E1e+11_d2e+14.pkl")) bodies.t = np.load('plummer_N700_T1000_E1e+11_d2e+14_time.npy') #print colorConverter.colors #for i in range(len(bodies[0].color)): #print bodies[0].color[i][:3] #print colorConverter.colors[tuple(bodies[0].color[i][:3])] #print colorConverter.colors.get('k') == bodies[0].color[i][:3] #center_of_mass_plot(bodies) #core_density_plot(bodies) #mean_distance_center_off_plot(bodies, color='r', show=False) #mean_distance_plot(bodies) #half_mass_radius_center_off_plot(bodies, color='r', show=False) #half_mass_radius_plot(bodies) #lagrange_radius_plot(bodies) #kinetic_energy_plot(bodies, show=False) #potential_energy_center_off_plot(bodies, color='r', show=False)