Skip to content

Commit

Permalink
Start filling in the empty documentation (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy authored Apr 2, 2023
1 parent 69fb7b2 commit d4b8a7c
Show file tree
Hide file tree
Showing 94 changed files with 661 additions and 510 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
python -m pip install -e .[docs]
- name: Create documentation
run: pdoc --html src/sleplet
run: pdoc --html src/sleplet --template-dir templates

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
5 changes: 1 addition & 4 deletions examples/arbitrary/africa/eigenvalues_africa.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

from sleplet.plot_methods import save_plot
from sleplet.slepian import SlepianArbitrary

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

L = 128
Expand All @@ -31,7 +28,7 @@ def main() -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.ylabel(r"$\mu$")
save_plot(_fig_path, f"africa_eigenvalues_L{L}")
save_plot(f"africa_eigenvalues_L{L}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@


def main() -> None:
"""Plots the difference between the theoretical &
"""
Plots the difference between the theoretical &
experimental covariances for the Slepian wavelets.
"""
# compute wavelets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from argparse import ArgumentParser
from pathlib import Path

import numpy as np
import seaborn as sns
Expand All @@ -12,7 +11,6 @@
from sleplet.plot_methods import save_plot
from sleplet.slepian import Region

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

B = 3
Expand Down Expand Up @@ -55,7 +53,8 @@ def _plot_axisymmetric_coefficients(shannon: int) -> None:


def main(*, limit: bool) -> None:
"""Plot a comparison of the absolute values of the wavelet coefficients
"""
Plot a comparison of the absolute values of the wavelet coefficients
compared to the Slepian coefficients. Expect the Slepian coefficients to
decay faster than the wavelet coefficients.
"""
Expand All @@ -68,7 +67,7 @@ def main(*, limit: bool) -> None:
plt.xlim(right=300)
plt.ylim(top=50)
filename += "_limit"
save_plot(_fig_path, filename)
save_plot(filename)


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions examples/arbitrary/africa/tiling_africa.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
Expand All @@ -9,7 +7,6 @@
from sleplet.slepian import SlepianArbitrary
from sleplet.wavelet_methods import create_kappas

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

B = 3
Expand Down Expand Up @@ -44,7 +41,7 @@ def main() -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.legend()
save_plot(_fig_path, f"africa_slepian_tiling_L{L}")
save_plot(f"africa_slepian_tiling_L{L}")


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions examples/arbitrary/eigenvalues_combined.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

from sleplet.plot_methods import save_plot
from sleplet.slepian import SlepianArbitrary

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

COLOURS = ["b", "k"]
Expand Down Expand Up @@ -44,7 +41,7 @@ def main() -> None:
plt.xlabel(r"$p$")
plt.ylabel(r"$\mu$")
plt.legend(loc=3)
save_plot(_fig_path, f"combined_eigenvalues_L{L}")
save_plot(f"combined_eigenvalues_L{L}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

from sleplet.plot_methods import save_plot
from sleplet.slepian import SlepianArbitrary

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

L = 128
Expand All @@ -31,7 +28,7 @@ def main() -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.ylabel(r"$\mu$")
save_plot(_fig_path, f"south_america_eigenvalues_L{L}")
save_plot(f"south_america_eigenvalues_L{L}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@


def main() -> None:
"""Plots the difference between the theoretical &
"""
Plots the difference between the theoretical &
experimental covariances for the Slepian wavelets.
"""
# compute wavelets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from argparse import ArgumentParser
from pathlib import Path

import numpy as np
import seaborn as sns
Expand All @@ -12,7 +11,6 @@
from sleplet.plot_methods import save_plot
from sleplet.slepian import Region

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

B = 3
Expand Down Expand Up @@ -55,7 +53,8 @@ def _plot_axisymmetric_coefficients(shannon: int) -> None:


def main(*, limit: bool) -> None:
"""Plot a comparison of the absolute values of the wavelet coefficients
"""
Plot a comparison of the absolute values of the wavelet coefficients
compared to the Slepian coefficients. Expect the Slepian coefficients to
decay faster than the wavelet coefficients.
"""
Expand All @@ -68,7 +67,7 @@ def main(*, limit: bool) -> None:
plt.xlim(right=300)
plt.ylim(top=50)
filename += "_limit"
save_plot(_fig_path, filename)
save_plot(filename)


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions examples/arbitrary/south_america/tiling_south_america.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
Expand All @@ -9,7 +7,6 @@
from sleplet.slepian import SlepianArbitrary
from sleplet.wavelet_methods import create_kappas

_fig_path = Path(__file__).resolve().parents[3] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

B = 3
Expand Down Expand Up @@ -44,7 +41,7 @@ def main() -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.legend()
save_plot(_fig_path, f"south_america_slepian_tiling_L{L}")
save_plot(f"south_america_slepian_tiling_L{L}")


if __name__ == "__main__":
Expand Down
7 changes: 1 addition & 6 deletions examples/mesh/mesh_slepian_eigenvalues.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from argparse import ArgumentParser
from pathlib import Path

import numpy as np
import seaborn as sns
Expand All @@ -8,7 +7,6 @@
from sleplet.meshes import Mesh, MeshSlepian
from sleplet.plot_methods import save_plot

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

MESHES = [
Expand Down Expand Up @@ -42,10 +40,7 @@ def main(mesh_name: str, num_basis_fun: int) -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.ylabel(r"$\mu$")
save_plot(
_fig_path,
f"{mesh_name}_slepian_eigenvalues_b{mesh.number_basis_functions}",
)
save_plot(f"{mesh_name}_slepian_eigenvalues_b{mesh.number_basis_functions}")


if __name__ == "__main__":
Expand Down
7 changes: 1 addition & 6 deletions examples/mesh/mesh_tiling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from argparse import ArgumentParser
from pathlib import Path

import numpy as np
import seaborn as sns
Expand All @@ -10,7 +9,6 @@
from sleplet.plot_methods import save_plot
from sleplet.wavelet_methods import create_kappas

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

B = 3
Expand Down Expand Up @@ -64,10 +62,7 @@ def main(mesh_name: str) -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.legend()
save_plot(
_fig_path,
f"{mesh_name}_slepian_tiling_b{mesh.mesh_eigenvalues.shape[0]}",
)
save_plot(f"{mesh_name}_slepian_tiling_b{mesh.mesh_eigenvalues.shape[0]}")


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions examples/misc/translation_normalisation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import numpy as np
import pyssht as ssht
import seaborn as sns
Expand All @@ -9,7 +7,6 @@
from sleplet.functions import HarmonicGaussian
from sleplet.plot_methods import save_plot

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

ALPHA_DEFAULT = 0.75
Expand All @@ -31,7 +28,7 @@ def compute_translation_normalisation_theta() -> None:
plt.ylabel(r"${\Vert f_{\ell m} Y_{\ell m}(\omega')\Vert}_{2}$")
plt.xlim(0, 180)
plt.ylim(0, np.ceil(norm.max()))
save_plot(_fig_path, f"harmonic_gaussian_translation_normalisation_L{L}")
save_plot(f"harmonic_gaussian_translation_normalisation_L{L}")


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions examples/misc/wavelet_transform.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from numpy import typing as npt

from sleplet.plot_methods import save_plot

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

DELTA_T = 0.001
Expand All @@ -24,7 +21,7 @@ def main() -> None:
plt.plot(amplitude)
plt.xticks([])
plt.xlabel(r"$t$")
save_plot(_fig_path, "ricker_wavelets")
save_plot("ricker_wavelets")


def _ricker(freq: float) -> npt.NDArray[np.float_]:
Expand Down
8 changes: 3 additions & 5 deletions examples/polar_cap/eigenfunctions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import numpy as np
import pooch
import seaborn as sns
Expand All @@ -11,7 +9,6 @@
from sleplet.plot_methods import calc_plot_resolution, save_plot
from sleplet.slepian import SlepianPolarCap

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

COLUMNS = 3
Expand All @@ -29,7 +26,8 @@


def main() -> None:
"""Create fig 5.1 from Spatiospectral Concentration on a Sphere
"""
Create fig 5.1 from Spatiospectral Concentration on a Sphere
by Simons et al 2006.
"""
x = np.linspace(THETA_MIN_DEFAULT, np.rad2deg(THETA_MAX_DEFAULT), RESOLUTION + 1)
Expand All @@ -47,7 +45,7 @@ def main() -> None:
slepian = SlepianPolarCap(L, np.deg2rad(THETA_MAX), order=ORDER)
for rank in range(ROWS * COLUMNS):
_helper(axes[rank], slepian, x, i, rank)
save_plot(_fig_path, "slepian_colatitude")
save_plot("slepian_colatitude")


def _helper(
Expand Down
5 changes: 1 addition & 4 deletions examples/polar_cap/eigenvalues.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from pathlib import Path

import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

from sleplet.plot_methods import save_plot
from sleplet.slepian import SlepianPolarCap

_fig_path = Path(__file__).resolve().parents[2] / "src" / "sleplet" / "_figures"
sns.set(context="paper")

L = 16
Expand All @@ -32,7 +29,7 @@ def main() -> None:
plt.xticks(ticks, ticks)
plt.xlabel(r"$p$")
plt.ylabel(r"$\mu$")
save_plot(_fig_path, "polar_cap_eigenvalues")
save_plot("polar_cap_eigenvalues")


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion examples/polar_cap/fried_egg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@


def main() -> None:
"""Create fig 5.4 from Spatiospectral Concentration on a Sphere
"""
Create fig 5.4 from Spatiospectral Concentration on a Sphere
by Simons et al 2006.
"""
region = Region(theta_max=np.deg2rad(THETA_MAX))
Expand Down
Loading

0 comments on commit d4b8a7c

Please sign in to comment.