From 84bed226f54e2eaff6f7f0b1d572d12a5604c629 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 10 May 2023 10:06:29 +0200 Subject: [PATCH] updated stuff --- software/fft_sim/__init__.py | 1 + software/fft_sim/analysis.py | 40 +++++++++++++++++----------------- software/fft_sim/ditact_pic.py | 6 ++--- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/software/fft_sim/__init__.py b/software/fft_sim/__init__.py index eafe3b1..8139819 100644 --- a/software/fft_sim/__init__.py +++ b/software/fft_sim/__init__.py @@ -1,2 +1,3 @@ from .ising import runner from .main import runner +from .analysis import analysis_main diff --git a/software/fft_sim/analysis.py b/software/fft_sim/analysis.py index 9dda998..2409b9c 100644 --- a/software/fft_sim/analysis.py +++ b/software/fft_sim/analysis.py @@ -1,13 +1,10 @@ -from ditact_pic import plot -from spin_image import SpinImage, FFT +from .ditact_pic import plot +from .spin_image import SpinImage, FFT import sys import numpy as np import matplotlib.pyplot as plt -import glob import scipy.interpolate as ip -from spin_image import SpinImage, FFT -from ditact_pic import plot -from lattices import VO2_Lattice +from .lattices import VO2_Lattice plt.style.use(["style", "colors", "one_column"]) @@ -43,19 +40,19 @@ def new_merge(files): print(out) out = np.array(out)[:, :, 0] - spot_rutile.append(out[0, :]) #rutile - spot_mono.append(out[2, :]) #mono - spot_diff.append(out[3, :]) #diff + spot_rutile.append(out[0, :]) # rutile + spot_mono.append(out[2, :]) # mono + spot_diff.append(out[3, :]) # diff wp = np.concatenate(wp, axis=0) op = np.concatenate(op, axis=0) - + wp = 1-wp op = 1-op spot_rutile = np.concatenate(spot_rutile, axis=0) spot_mono = np.concatenate(spot_mono, axis=0) spot_diff = np.concatenate(spot_diff, axis=0) - + arg_sort = np.argsort(op) wp = wp[arg_sort] op = op[arg_sort] @@ -73,7 +70,7 @@ def new_merge(files): x = op plt.plot(x, spot_rutile, "r.", label="rutile") plt.plot(x, spot_mono, "g.", label="mono") - plt.plot(x, spot_diff, "b.",label="diff" ) + plt.plot(x, spot_diff, "b.", label="diff") plt.legend() ma = np.max(spot_rutile+spot_mono+spot_diff) spot_rutile /= ma @@ -150,23 +147,25 @@ def stacked_plot(ax, percentage, out, title=""): ax.text(0.35, 0.73, "diffusive", backgroundcolor="w", bbox=dict(boxstyle='square,pad=0.0', ec="None", fc="w")) ax.stackplot(percentage, out[[0, 2, 1]], colors=["None"], ec="k") - - ax.plot([0,1], [0.52,1],":k") + + ax.plot([0, 1], [0.52, 1], ":k") + def stacked_plot_norm(ax, percentage, out, title=""): out = out.copy() ref = out[0][0] out[0] = out[0] - ref - + sum = out[0] + out[1] out /= sum - - #out[0] += ref - #out /= 1+ref + + # out[0] += ref + # out /= 1+ref out[2] = 0. - stacked_plot(ax, percentage, out,title) + stacked_plot(ax, percentage, out, title) + def time_scale(ax, p, o): rut_perc = o[0] @@ -208,6 +207,7 @@ def read_file(file): o = files["o"] return p, o + def intens(ax, file, p, o): intens = FFT() intens.load(file) @@ -256,7 +256,7 @@ def intens(ax, file, p, o): axins.set_yticks([0, 1]) -if __name__ == "__main__": +def analysis_main(): p, o = new_merge(sys.argv[2:]) np.savez("merged.npz", p=p, o=o) diff --git a/software/fft_sim/ditact_pic.py b/software/fft_sim/ditact_pic.py index ea27f17..494ab82 100644 --- a/software/fft_sim/ditact_pic.py +++ b/software/fft_sim/ditact_pic.py @@ -1,7 +1,7 @@ -from plotter import Plotter +from .plotter import Plotter import matplotlib -from lattices import VO2_New -from spin_image import SpinImage, FFT +from .lattices import VO2_New +from .spin_image import SpinImage, FFT import numpy as np import matplotlib.pyplot as plt