From 56438ced53990b8295f7b282758561ac39947ca0 Mon Sep 17 00:00:00 2001 From: Ruben Erlenstedt Date: Sat, 30 Nov 2019 13:13:48 +0100 Subject: work on 2d plot of phi --- plotting.py | 9 ++++++--- single_dequantify.py | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/plotting.py b/plotting.py index 9def377..57116c1 100644 --- a/plotting.py +++ b/plotting.py @@ -43,12 +43,15 @@ def kugel(historie): plt.show() def phi(phi): - fig, ax = plt.subplots() + ax = plt.axes() + plt.grid() x = mth.cos(phi[0]) y = mth.sin(phi[0]) - ax.arrow(0, 0, 1, 1) - ax.set_title('Zeitentwicklung von phi') + ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.07) + plt.title('Zeitentwicklung von phi') + plt.xlim(-1.1,1.1) + plt.ylim(-1.1,1.1) plt.show() diff --git a/single_dequantify.py b/single_dequantify.py index 43c256d..0d38fc7 100644 --- a/single_dequantify.py +++ b/single_dequantify.py @@ -10,9 +10,9 @@ beta = 1 / npy.sqrt(2) state = npy.array([alpha, beta]) dt = 0.2 -iterations = 20 +iterations = 200 -H = npy.array([[2,-2j],[2j,3]]) +H = npy.array([[2,0],[0,3]]) def time_evolution(state, dt = dt): @@ -32,7 +32,7 @@ def sphere2cart(phi, theta): ] historie = npy.array([bloch_map(state)]) -f = open("data", "a") +f = open("data", "w") for i in range(iterations): state = time_evolution(state) @@ -43,4 +43,7 @@ for i in range(iterations): f.write(f"{coords[0]}; {coords[1]}; {coords[2]}\n") f.close() -subprocess.run(["gnuplot", "gnuplot.plt"]) +import plotting +#plotting.phi(historie[:,0]) +plotting.kugel(historie) +#subprocess.run(["gnuplot", "gnuplot.plt"]) -- cgit v1.2.3-70-g09d2