From 57152e4054b79e90f35ae868d1d7b3c9752c8ff7 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 16 Feb 2023 10:07:19 +0100 Subject: [PATCH] rotate --- 2d_fourie/main.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/2d_fourie/main.py b/2d_fourie/main.py index dd85ba2..4c9a10f 100644 --- a/2d_fourie/main.py +++ b/2d_fourie/main.py @@ -7,6 +7,7 @@ import scipy.fftpack as sfft import matplotlib.patches as patches import matplotlib import scipy +import scipy.signal import tqdm @@ -115,9 +116,16 @@ def plot(freqx, freqy, intens, ax_log=None, ax_lin=None): 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(): - lat = SCC_Lattice(300, 300) - si = SpinImage(*lat.get_from_mask(None)) + lat = SCC_Lattice(40, 40) + 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) si.pad_it_square(10) si.plot(axs[0, 0], 2) @@ -129,6 +137,7 @@ def test_square(): fx, fy, intens = si.fft() plot(fx, fy, intens, axs[1, 0], axs[1, 1]) print("Done") + plt.savefig("test.png") plt.show()