From f409a937c5a508ca015ee1fbc69a7eed28a1dd75 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sat, 30 Nov 2019 11:46:45 +0100 Subject: Add gnuplot script --- .gitignore | 2 ++ gnuplot.plt | 7 +++++++ single_dequantify.py | 17 +++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 gnuplot.plt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0c7b4fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +data +__pycache__ diff --git a/gnuplot.plt b/gnuplot.plt new file mode 100644 index 0000000..635bd3e --- /dev/null +++ b/gnuplot.plt @@ -0,0 +1,7 @@ +set view equal xyz +set parametric +set isosamples 10,10 +splot cos(u)*cos(v),cos(u)*sin(v),sin(u) +replot 'data' +; +pause mouse close diff --git a/single_dequantify.py b/single_dequantify.py index c5054f5..b9a5253 100644 --- a/single_dequantify.py +++ b/single_dequantify.py @@ -1,9 +1,9 @@ - +#import plotting +import subprocess import math as mth import cmath as cmt import numpy as npy import scipy.linalg as sla -#import matplotlib.pyplot as plt alpha = 1 / npy.sqrt(2) beta = 1 / npy.sqrt(2) @@ -32,15 +32,16 @@ def sphere2cart(phi, theta): ] historie = npy.array([bloch_map(state)]) +f = open("data", "a") + for i in range(iterations): state = time_evolution(state) h = npy.dot(state, state) - historie = npy.vstack([historie,bloch_map(state)]) + historie = npy.vstack([historie,bloch_map(state)]) coords = bloch_map(state) coords = sphere2cart(coords[0], coords[1]) - print(f"{coords[0]}; {coords[1]}; {coords[2]}") - - - - + #print(f"{coords[0]}; {coords[1]}; {coords[2]}") + f.write(f"{coords[0]}; {coords[1]}; {coords[2]}\n") +f.close() +subprocess.run(["gnuplot", "gnuplot.plt"]) -- cgit v1.2.3-70-g09d2