updated picture
This commit is contained in:
parent
6ed08e3695
commit
3f8fdd38d1
@ -6,7 +6,7 @@ import numpy as np
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
plt.style.use("two_column")
|
plt.style.use(["style", "colors","two_column"])
|
||||||
|
|
||||||
|
|
||||||
def simulate():
|
def simulate():
|
||||||
@ -14,19 +14,19 @@ def simulate():
|
|||||||
lat = VO2_New(LEN, LEN)
|
lat = VO2_New(LEN, LEN)
|
||||||
plot = Plotter(lat)
|
plot = Plotter(lat)
|
||||||
si = SpinImage(lat.get_phases())
|
si = SpinImage(lat.get_phases())
|
||||||
mask_misk = np.ones((LEN, 2*LEN))
|
mask_misk = np.ones((2*LEN, 2*LEN))
|
||||||
ind = np.arange(mask_misk.size)
|
ind = np.arange(mask_misk.size)
|
||||||
np.random.shuffle(ind)
|
np.random.shuffle(ind)
|
||||||
mask_misk[np.unravel_index(
|
mask_misk[np.unravel_index(
|
||||||
ind[:int(mask_misk.size/2)], mask_misk.shape)] = 0
|
ind[:int(mask_misk.size/2)], mask_misk.shape)] = 0
|
||||||
print(mask_misk.shape)
|
print(mask_misk.shape)
|
||||||
|
|
||||||
si.apply_mask(lat.parse_mask(np.zeros((LEN, 2*LEN))))
|
si.apply_mask(lat.parse_mask(np.ones((2*LEN, 2*LEN))))
|
||||||
si.gaussian(20)
|
si.gaussian(20)
|
||||||
intens_mono = si.fft()
|
intens_mono = si.fft()
|
||||||
intens_mono.clean()
|
intens_mono.clean()
|
||||||
|
|
||||||
si.apply_mask(lat.parse_mask(np.ones((LEN, 2*LEN))))
|
si.apply_mask(lat.parse_mask(np.zeros((2*LEN, 2*LEN))))
|
||||||
si.gaussian(20)
|
si.gaussian(20)
|
||||||
intens_rutile = si.fft()
|
intens_rutile = si.fft()
|
||||||
intens_rutile.clean()
|
intens_rutile.clean()
|
||||||
@ -43,18 +43,25 @@ def simulate():
|
|||||||
|
|
||||||
|
|
||||||
def plot(fft, ax):
|
def plot(fft, ax):
|
||||||
ax.imshow(
|
return ax.imshow(
|
||||||
fft.intens,
|
fft.intens,
|
||||||
extent=fft.extents(),
|
extent=fft.extents(),
|
||||||
norm=matplotlib.colors.LogNorm(),
|
norm=matplotlib.colors.LogNorm(vmin=1e-10, vmax=1),
|
||||||
|
#norm=matplotlib.colors.Normalize(vmax=1, vmin=1e-10),
|
||||||
cmap="magma",
|
cmap="magma",
|
||||||
origin="lower"
|
origin="lower"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def norm(*intenss):
|
||||||
|
max = 1e-10
|
||||||
|
for intens in intenss:
|
||||||
|
m = np.max(intens.intens)
|
||||||
|
max = np.maximum(max,m)
|
||||||
|
return max
|
||||||
|
|
||||||
def plot_all(intens_rutile, intens_mono, intens_mixed):
|
def plot_all(intens_rutile, intens_mono, intens_mixed):
|
||||||
fig, axs = plt.subplots(4, 2)
|
fig, axs = plt.subplots(3, 2)
|
||||||
fig.set_figheight(6)
|
fig.set_figheight(5.2)
|
||||||
for ax in axs.flatten():
|
for ax in axs.flatten():
|
||||||
ax.axis("off")
|
ax.axis("off")
|
||||||
axs = axs[:, 1]
|
axs = axs[:, 1]
|
||||||
@ -83,33 +90,20 @@ def plot_all(intens_rutile, intens_mono, intens_mixed):
|
|||||||
ax.add_patch(c)
|
ax.add_patch(c)
|
||||||
|
|
||||||
ax = axs[2]
|
ax = axs[2]
|
||||||
plot(intens_mixed, ax)
|
cmap = plot(intens_mixed, ax)
|
||||||
# c = matplotlib.patches.Ellipse((0., 0.), width=0.2, height=1.4, angle=45,
|
|
||||||
# label='patch', fill=False, ec="w", ls=":")
|
|
||||||
# height = 1.4
|
|
||||||
# width = 0.0
|
|
||||||
# c = matplotlib.patches.Rectangle((-width/2, -height/2), width=width, height=height,
|
|
||||||
# angle=45, rotation_point="center",
|
|
||||||
# label='patch', fill=False, ec="w", ls=":")
|
|
||||||
# ax.add_patch(c)
|
|
||||||
ax.plot([-1, 1], [1, -1], "w", linestyle=(0, (2, 6)))
|
|
||||||
|
|
||||||
ax = axs[3]
|
|
||||||
plot(intens_mixed, ax)
|
|
||||||
ax.plot([-1, 1], [0, 0], "w", linestyle=(0, (2, 6)))
|
|
||||||
ax.plot([-1, 1], [2 * y_shift, 2 * y_shift], "w", linestyle=(0, (2, 6)))
|
|
||||||
ax.plot([-1, 1], [-2*y_shift, -2*y_shift], "w", linestyle=(0, (2, 6)))
|
|
||||||
|
|
||||||
ax.plot([-100*l_shift + big_shift*.5, 100*l_shift + big_shift*.5],
|
|
||||||
[y_shift*100, -y_shift*100], "w", linestyle=(0, (2, 6)))
|
|
||||||
ax.plot([-100*l_shift - big_shift*.5, 100*l_shift - big_shift*.5],
|
|
||||||
[y_shift*100, -y_shift*100], "w", linestyle=(0, (2, 6)))
|
|
||||||
|
|
||||||
|
cut_off = 0.8
|
||||||
for ax in axs:
|
for ax in axs:
|
||||||
ax.axis("off")
|
ax.axis("off")
|
||||||
ax.set_xlim(-0.5, 0.5)
|
ax.set_xlim(-cut_off, cut_off)
|
||||||
ax.set_ylim(-0.5, 0.5)
|
ax.set_ylim(-cut_off, cut_off)
|
||||||
plt.tight_layout()
|
plt.tight_layout()
|
||||||
|
fig.subplots_adjust(bottom=0.1,right=0.95,left=0.15,wspace=0.)
|
||||||
|
cbar_ax = fig.add_axes([0.55, 0.07, 0.4, 0.015])
|
||||||
|
cbar = fig.colorbar(cmap, cax=cbar_ax, orientation="horizontal", ticks=[1e-10, 1e-5, 1e0])
|
||||||
|
#cbar.ax.set_xticklabels(['Low', 'Medium', 'High'])
|
||||||
|
|
||||||
|
|
||||||
fig.savefig("erklaerbaer.pdf")
|
fig.savefig("erklaerbaer.pdf")
|
||||||
fig.savefig("erklaerbaer.png")
|
fig.savefig("erklaerbaer.png")
|
||||||
# Plotting cuts
|
# Plotting cuts
|
||||||
@ -128,9 +122,13 @@ def load():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
np.random.seed(1234)
|
np.random.seed(1234)
|
||||||
simulate()
|
#simulate()
|
||||||
# np.savez("intens.npz", r=r, mo=mo, mi=mi)
|
# np.savez("intens.npz", r=r, mo=mo, mi=mi)
|
||||||
r, mo, mi = load()
|
r, mo, mi = load()
|
||||||
|
max = norm(r,mo,mi)
|
||||||
|
r.intens = r.intens/max
|
||||||
|
mo.intens = mo.intens/max
|
||||||
|
mi.intens = mi.intens/max
|
||||||
plot_all(r, mo, mi)
|
plot_all(r, mo, mi)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -111,7 +111,7 @@ class VO2_Lattice(Lattice):
|
|||||||
# offset_a_m = -offset_a_m
|
# offset_a_m = -offset_a_m
|
||||||
|
|
||||||
offset_a_r, offset_c_r = self._mono_2_rutile(offset_c_m, offset_a_m)
|
offset_a_r, offset_c_r = self._mono_2_rutile(offset_c_m, offset_a_m)
|
||||||
# offset_a_r = -offset_a_r
|
offset_a_r = -offset_a_r
|
||||||
# offset_c_r = -offset_c_r
|
# offset_c_r = -offset_c_r
|
||||||
|
|
||||||
x = offset_a_r + self.X * \
|
x = offset_a_r + self.X * \
|
||||||
@ -153,21 +153,5 @@ class VO2_Lattice(Lattice):
|
|||||||
|
|
||||||
|
|
||||||
class VO2_New(VO2_Lattice):
|
class VO2_New(VO2_Lattice):
|
||||||
# def parse_mask(self, mask: np.ndarray) -> np.ndarray:
|
|
||||||
# maske = np.empty((mask.shape[0]*2, mask.shape[1]*2))
|
|
||||||
# maske[0::2, 0::2] = mask
|
|
||||||
# maske[1::2, 0::2] = mask
|
|
||||||
# maske[0::2, 1::2] = mask
|
|
||||||
# maske[1::2, 1::2] = mask
|
|
||||||
# maske[0::4, :] = np.roll(maske[0::4, :], axis=1, shift=1)
|
|
||||||
# maske[1::4, :] = np.roll(maske[1::4, :], axis=1, shift=1)
|
|
||||||
# return maske
|
|
||||||
# def parse_mask(self, mask: np.ndarray) -> np.ndarray:
|
|
||||||
# print(mask.shape)
|
|
||||||
# maske = np.empty((mask.shape[0]*2, mask.shape[1]))
|
|
||||||
# maske[0::2, :] = mask
|
|
||||||
# maske[1::2, :] = mask
|
|
||||||
# print(maske.shape)
|
|
||||||
# return maske
|
|
||||||
def parse_mask(self, mask: np.ndarray):
|
def parse_mask(self, mask: np.ndarray):
|
||||||
return mask
|
return mask
|
||||||
|
@ -24,8 +24,9 @@ logger.addHandler(ch)
|
|||||||
def random(seed):
|
def random(seed):
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
LEN = 40
|
LEN = 40
|
||||||
lat = VO2_New(LEN, LEN)
|
#lat = VO2_New(LEN, LEN)
|
||||||
maske = np.zeros((LEN*2, LEN*2))
|
lat = VO2_Lattice(LEN, LEN)
|
||||||
|
maske = np.zeros((LEN, LEN))
|
||||||
ind = np.arange(maske.size)
|
ind = np.arange(maske.size)
|
||||||
np.random.shuffle(ind)
|
np.random.shuffle(ind)
|
||||||
rect = Rect_Evaluator(lat.get_spots())
|
rect = Rect_Evaluator(lat.get_spots())
|
||||||
|
Loading…
Reference in New Issue
Block a user