rotate
This commit is contained in:
parent
a6e526264e
commit
57152e4054
@ -7,6 +7,7 @@ import scipy.fftpack as sfft
|
|||||||
import matplotlib.patches as patches
|
import matplotlib.patches as patches
|
||||||
import matplotlib
|
import matplotlib
|
||||||
import scipy
|
import scipy
|
||||||
|
import scipy.signal
|
||||||
import tqdm
|
import tqdm
|
||||||
|
|
||||||
|
|
||||||
@ -115,9 +116,16 @@ def plot(freqx, freqy, intens, ax_log=None, ax_lin=None):
|
|||||||
plt.colorbar(t)
|
plt.colorbar(t)
|
||||||
|
|
||||||
|
|
||||||
|
def rotate(x, y, angle):
|
||||||
|
radian = angle / 180 * 2 * np.pi
|
||||||
|
return np.cos(radian) * x - np.sin(radian) * y, np.sin(radian) * x + np.cos(radian) * y
|
||||||
|
|
||||||
|
|
||||||
def test_square():
|
def test_square():
|
||||||
lat = SCC_Lattice(300, 300)
|
lat = SCC_Lattice(40, 40)
|
||||||
si = SpinImage(*lat.get_from_mask(None))
|
pos_x, pos_y = lat.get_from_mask(None)
|
||||||
|
pos_x, pos_y = rotate(pos_x, pos_y,30)
|
||||||
|
si = SpinImage(pos_x, pos_y)
|
||||||
fig, axs = plt.subplots(2, 2)
|
fig, axs = plt.subplots(2, 2)
|
||||||
si.pad_it_square(10)
|
si.pad_it_square(10)
|
||||||
si.plot(axs[0, 0], 2)
|
si.plot(axs[0, 0], 2)
|
||||||
@ -129,6 +137,7 @@ def test_square():
|
|||||||
fx, fy, intens = si.fft()
|
fx, fy, intens = si.fft()
|
||||||
plot(fx, fy, intens, axs[1, 0], axs[1, 1])
|
plot(fx, fy, intens, axs[1, 0], axs[1, 1])
|
||||||
print("Done")
|
print("Done")
|
||||||
|
plt.savefig("test.png")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user