2020-03-31 15:39:59 +02:00
|
|
|
import matplotlib.pyplot as plt
|
2020-12-30 20:41:30 +01:00
|
|
|
from rebound import SimulationArchive, Particle, Simulation
|
2020-03-31 15:39:59 +02:00
|
|
|
|
|
|
|
from extradata import ExtraData
|
2021-05-03 16:42:34 +02:00
|
|
|
from utils import filename_from_argv, plot_settings, is_ci
|
2021-05-03 16:16:28 +02:00
|
|
|
|
|
|
|
plot_settings()
|
2020-03-31 15:39:59 +02:00
|
|
|
|
|
|
|
fn = filename_from_argv()
|
|
|
|
sa = SimulationArchive(str(fn.with_suffix(".bin")))
|
2021-02-04 17:29:01 +01:00
|
|
|
ed = ExtraData.load(fn)
|
2020-04-02 12:54:11 +02:00
|
|
|
print(ed.meta)
|
2020-03-31 15:39:59 +02:00
|
|
|
|
|
|
|
data = {}
|
2020-12-30 20:41:30 +01:00
|
|
|
sim: Simulation
|
2021-01-04 14:48:48 +01:00
|
|
|
print(f"{len(sa)} Snapshots found")
|
2020-12-30 20:41:30 +01:00
|
|
|
for sim in sa:
|
|
|
|
t = sim.t
|
2020-03-31 15:39:59 +02:00
|
|
|
for pn in range(1, sim.N):
|
|
|
|
part: Particle = sim.particles[pn]
|
|
|
|
hash = part.hash.value
|
|
|
|
if hash not in data:
|
|
|
|
data[hash] = ([], [])
|
2020-04-02 12:54:11 +02:00
|
|
|
data[hash][0].append(t)
|
|
|
|
data[hash][1].append(part.a)
|
2020-03-31 15:39:59 +02:00
|
|
|
|
|
|
|
for name, d in data.items():
|
|
|
|
times, values = d
|
|
|
|
print(list(map(len, [times, values])))
|
2020-04-02 12:54:11 +02:00
|
|
|
if False:
|
2020-03-31 15:39:59 +02:00
|
|
|
plt.scatter(times, values, label=name, s=.9)
|
|
|
|
else:
|
2021-05-03 16:16:28 +02:00
|
|
|
plt.plot(times, values, label=name, linewidth=0.6)
|
2020-03-31 15:39:59 +02:00
|
|
|
# plt.legend()
|
|
|
|
# OrbitPlot(sim, slices=1)
|
2021-05-03 16:16:28 +02:00
|
|
|
plt.tight_layout()
|
2021-05-03 16:31:30 +02:00
|
|
|
if not is_ci():
|
|
|
|
plt.savefig("/home/lukas/tmp/time.pdf", transparent=True)
|
2020-03-31 15:39:59 +02:00
|
|
|
plt.show()
|