diff options
Diffstat (limited to 'single_dequantify.py')
-rw-r--r-- | single_dequantify.py | 21 |
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"]) |