-
Notifications
You must be signed in to change notification settings - Fork 1
/
tiling_south_america.py
50 lines (43 loc) · 1.25 KB
/
tiling_south_america.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate
import seaborn as sns
import sleplet
sns.set(context="paper")
B = 3
J_MIN = 2
L = 128
STEP = 0.01
def main() -> None:
"""Plots the tiling of the Slepian line."""
xlim = L**2
x = np.arange(xlim)
xi = np.arange(0, xlim - 1 + STEP, STEP)
kappas = sleplet.wavelet_methods.create_kappas(xlim, B, J_MIN)
yi = scipy.interpolate.pchip(x, kappas[0])
plt.semilogx(xi, yi(xi), label=r"$\Phi_p$")
for j, k in enumerate(kappas[1:]):
yi = scipy.interpolate.pchip(x, k)
plt.semilogx(xi, yi(xi), label=rf"$\Psi^{{{j+J_MIN}}}_p$")
slepian = sleplet.slepian.SlepianArbitrary(L, "south_america")
plt.axvline(slepian.N, color="k", linestyle="dashed")
plt.annotate(
f"N={slepian.N}",
xy=(slepian.N, 1),
xytext=(17, 3),
ha="center",
textcoords="offset points",
annotation_clip=False,
)
plt.xlim(1, xlim)
ticks = 2 ** np.arange(np.log2(xlim) + 1, dtype=int)
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.legend()
print(f"Opening: south_america_slepian_tiling_L{L}")
plt.tight_layout()
plt.show(block=False)
plt.pause(10)
plt.close()
if __name__ == "__main__":
main()