stuff
This commit is contained in:
parent
3f8fdd38d1
commit
42e3995501
@ -3,8 +3,9 @@ import numpy as np
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import glob
|
import glob
|
||||||
import scipy.interpolate as ip
|
import scipy.interpolate as ip
|
||||||
plt.style.use(["style", "colors", "two_column"])
|
plt.style.use(["style", "colors", "one_column"])
|
||||||
|
from spin_image import SpinImage, FFT
|
||||||
|
from ditact_pic import plot
|
||||||
|
|
||||||
def check_percentage(p1, p2):
|
def check_percentage(p1, p2):
|
||||||
plt.figure()
|
plt.figure()
|
||||||
@ -56,27 +57,22 @@ def debug(percentage, out):
|
|||||||
plt.plot(percentage, out[2, :], "k")
|
plt.plot(percentage, out[2, :], "k")
|
||||||
|
|
||||||
|
|
||||||
def stacked_plot(percentage, out, title=""):
|
def stacked_plot(ax, percentage, out, title=""):
|
||||||
plt.figure()
|
stacks = ax.stackplot(percentage, out[[0, 3, 1, 2]], colors=[
|
||||||
stacks = plt.stackplot(percentage, out[[0, 3, 1, 2]], colors=[
|
|
||||||
"w"], ls="solid", ec="k")
|
"w"], ls="solid", ec="k")
|
||||||
hatches = ["/", "", "\\", "\\"]
|
hatches = ["/", "", "\\", "\\"]
|
||||||
for stack, hatch in zip(stacks, hatches):
|
for stack, hatch in zip(stacks, hatches):
|
||||||
stack.set_hatch(hatch)
|
stack.set_hatch(hatch)
|
||||||
plt.xlabel("Metallic Phase (%)")
|
ax.set_xlabel("Metallic Phase (%)")
|
||||||
plt.ylabel("normalized Intensity ")
|
ax.set_ylabel("normalized Intensity ")
|
||||||
plt.ylim([0.4, 1])
|
ax.set_ylim([0.4, 1])
|
||||||
plt.xlim([0., 1])
|
ax.set_xlim([0., 1])
|
||||||
plt.tight_layout()
|
ax.text(0.1, 0.9, "monoclinic", backgroundcolor="w")
|
||||||
plt.text(0.1, 0.9, "monoclinic", backgroundcolor="w")
|
ax.text(0.6, 0.5, "rutile", backgroundcolor="w")
|
||||||
plt.text(0.6, 0.5, "rutile", backgroundcolor="w")
|
ax.text(0.35, 0.75, "diffusive", backgroundcolor="w")
|
||||||
plt.text(0.35, 0.75, "diffusive", backgroundcolor="w")
|
|
||||||
plt.title(title)
|
|
||||||
plt.savefig("intens.png")
|
|
||||||
plt.savefig("intens.pdf")
|
|
||||||
|
|
||||||
|
|
||||||
def time_scale(p, o):
|
def time_scale(ax, p, o):
|
||||||
rut_perc = o[0]
|
rut_perc = o[0]
|
||||||
rut_perc = rut_perc - np.min(rut_perc)
|
rut_perc = rut_perc - np.min(rut_perc)
|
||||||
rut_perc /= np.max(rut_perc)
|
rut_perc /= np.max(rut_perc)
|
||||||
@ -90,26 +86,22 @@ def time_scale(p, o):
|
|||||||
cs_rut = ip.interp1d(p[::-1], rut_perc[::-1])
|
cs_rut = ip.interp1d(p[::-1], rut_perc[::-1])
|
||||||
cs_mono = ip.interp1d(p[::-1], mono_perc[::-1])
|
cs_mono = ip.interp1d(p[::-1], mono_perc[::-1])
|
||||||
|
|
||||||
plt.figure()
|
#plt.figure()
|
||||||
ph = np.linspace(0.01, 0.99, 100)
|
#ph = np.linspace(0.01, 0.99, 100)
|
||||||
plt.plot(ph, cs_rut(ph))
|
#plt.plot(ph, cs_rut(ph))
|
||||||
plt.plot(ph, cs_mono(ph))
|
#plt.plot(ph, cs_mono(ph))
|
||||||
|
|
||||||
time = np.linspace(0.01, 3, 1000)
|
time = np.linspace(0.01, 3, 1000)
|
||||||
phy_phase = np.exp(-time)
|
phy_phase = np.exp(-time)
|
||||||
rut_phase = cs_rut(phy_phase)
|
rut_phase = cs_rut(phy_phase)
|
||||||
mono_phase = cs_mono(phy_phase)
|
mono_phase = cs_mono(phy_phase)
|
||||||
|
|
||||||
plt.figure()
|
ax.plot(time, phy_phase, "k:", label="physical")
|
||||||
plt.plot(time, phy_phase, "k:", label="corr.")
|
ax.plot(time, rut_phase, label="rutile")
|
||||||
plt.plot(time, rut_phase, label="rut.")
|
ax.plot(time, mono_phase, label="monoclinic")
|
||||||
plt.plot(time, mono_phase, label="mono")
|
ax.set_xlabel("time (a.u.)")
|
||||||
plt.xlabel("time (a.u.)")
|
ax.set_ylabel("Metallic Phase (%)")
|
||||||
plt.ylabel("Metallic Phase (%)")
|
ax.legend()
|
||||||
plt.legend()
|
|
||||||
plt.tight_layout()
|
|
||||||
plt.savefig("timescale.png")
|
|
||||||
plt.savefig("timescale.pdf")
|
|
||||||
|
|
||||||
|
|
||||||
def read_file(file):
|
def read_file(file):
|
||||||
@ -118,11 +110,29 @@ def read_file(file):
|
|||||||
o = files["o"]
|
o = files["o"]
|
||||||
return p, o
|
return p, o
|
||||||
|
|
||||||
|
def intens(ax, file, p, o):
|
||||||
|
intens = FFT()
|
||||||
|
intens.load(file)
|
||||||
|
plot(intens, ax)
|
||||||
|
ax.set_xlim([-.8,0.8])
|
||||||
|
ax.set_ylim([-.8,1.6])
|
||||||
|
axins = ax.inset_axes([0.0, 0.5, 0.47, 0.5])
|
||||||
|
axins.plot(p, o[0], label="rut")
|
||||||
|
axins.plot(p, o[3], label="diff")
|
||||||
|
axins.plot(p, o[2], label="mono")
|
||||||
|
axins.legend(loc='lower left', bbox_to_anchor=(1, 0.5))
|
||||||
|
#axins.get_yaxis().set_visible(False)
|
||||||
|
axins.yaxis.tick_right()
|
||||||
|
axins.set_yticks([0,0.5]
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
p, o = merge(sys.argv[1:])
|
p, o = merge(sys.argv[2:])
|
||||||
np.savez("merged.npz", p=p, o=o)
|
np.savez("merged.npz", p=p, o=o)
|
||||||
# eval_data_print(f)
|
# eval_data_print(f)
|
||||||
stacked_plot(p, o)
|
|
||||||
time_scale(p, o)
|
fig, axs = plt.subplots(1,3)
|
||||||
|
fig.set_figheight(3)
|
||||||
|
stacked_plot(axs[1],p, o)
|
||||||
|
time_scale(axs[2],p, o)
|
||||||
|
intens(axs[0], sys.argv[1], p ,o)
|
||||||
|
plt.tight_layout()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -5,8 +5,8 @@ from spin_image import SpinImage, FFT
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
plt.style.use(["style", "colors","two_column"])
|
plt.style.use(["style", "colors","two_column"])
|
||||||
|
|
||||||
|
|
||||||
def simulate():
|
def simulate():
|
||||||
|
Loading…
Reference in New Issue
Block a user