-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
61 lines (48 loc) · 1.69 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Run a simulation and save outputs
Authors:
- Andrea Maiani <[email protected]>
- Ciro Pentangelo <[email protected]>
"""
import os
import time
import simulations_collection as sim
from waveplotter import WavePlotter
if __name__ == "__main__":
#####CALL BELOW THE SIMULATION INIT FUNCTION#####
ss, x0, p0 = sim.dancing()
#################################################
wp = WavePlotter(ss, x0, p0)
print("+----------------------------+")
print("| QuantumWave |")
print("+----------------------------+")
print("")
print("")
print("SIMULATION NAME: " + ss.simname)
print("[*] Running numerical simulation... ", end='')
start = time.time()
ss.run()
end = time.time()
print("completed in %.2fs" % (end - start))
print("[*] Building output... ")
os.makedirs("./output/" + ss.simname, exist_ok=True)
print(" [Norm]", end='')
start = time.time()
fig = wp.plot_norm()
fig.savefig("./output/" + ss.simname + "/" + ss.simname + "-norm.pdf")
end = time.time()
print(" completed in %.2fs" % (end - start))
print(" [Optics]", end='')
start = time.time()
fig = wp.plot_optics()
fig.savefig("./output/" + ss.simname + "/" + ss.simname + "-optics.png")
end = time.time()
print(" completed in %.2fs" % (end - start))
print(" [Animation]", end='')
start = time.time()
wp.createmp4("./output/" + ss.simname + "/" + ss.simname + "-animation.mp4", center_line=False, max_line=False)
end = time.time()
print(" completed in %.2fs" % (end - start))
print("[*] Execution completed")