summaryrefslogtreecommitdiff
path: root/single_dequantify.py
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-30 19:24:20 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-30 19:24:20 +0100
commit94935f80fac8d1275142d73b1a6b6d6492cc8207 (patch)
tree837c34f9db9426e74daefa8ba7e11b96ba527484 /single_dequantify.py
parente1172e94602f4cf003392409d9543d17c31881dc (diff)
Animate tow level systems
Diffstat (limited to 'single_dequantify.py')
-rw-r--r--single_dequantify.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/single_dequantify.py b/single_dequantify.py
index f43f9f1..99ebdc4 100644
--- a/single_dequantify.py
+++ b/single_dequantify.py
@@ -1,5 +1,5 @@
import sys
-import subprocess
+import plot
import math as mth
import cmath as cmt
import numpy as npy
@@ -7,7 +7,7 @@ import scipy.linalg as sla
dt = 0.08
iterations = 100
-state_num = 1
+state_num = 3
H = npy.array([[1,0],[0,2]])
@@ -40,8 +40,6 @@ def sphere2cart(phi, theta):
-1 * mth.cos(theta)
]
-f = open("data", "w")
-
states = []
for i in range(state_num):
(alpha, beta) = init_state(i)
@@ -49,7 +47,7 @@ for i in range(state_num):
state = npy.array([alpha / norm, beta / norm])
states.append(state)
-
+f = open("data", "w")
for i in range(iterations):
for j in range(state_num):
(phi, theta) = bloch_map(states[j])
@@ -57,18 +55,9 @@ for i in range(iterations):
colour = i / iterations
if state_num > 1:
colour = j / state_num
- f.write(f"{coords[0]}; {coords[1]}; {coords[2]}; {colour}\n")
+ f.write(f"{coords[0]}; {coords[1]}; {coords[2]}; 0; 0; {colour}\n")
states[j] = time_evolution(states[j])
-
f.close()
-import os
+plot.plot(1, iterations, state_num, "anim2d.plt")
-path = 'gnuplot/'
-if os.name == 'nt':
- path.replace('/','\\')
-subprocess.run(["gnuplot",
- "-e", f"states={state_num};",
- "-e", f"start={iterations};" ,
- "-e", f"end={iterations};",
- "-c", path + "animation.plt"])