From 6418525d4f8bb0b521205d5c2471125ac3172cde Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Wed, 14 Feb 2024 17:00:10 +0000 Subject: [PATCH 01/13] Restore `D203` (#352) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b745cb860..7d67f9ff7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,6 +135,7 @@ force-exclude = true lint.ignore = [ "COM812", "D105", + "D203", "D205", "D212", "D407", From 4705b33b472d80d200cac8382edc50d70ad1511b Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Wed, 14 Feb 2024 17:02:31 +0000 Subject: [PATCH 02/13] Restore ISC001 (#353) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7d67f9ff7..1562c9421 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,6 +140,7 @@ lint.ignore = [ "D212", "D407", "D413", + "ISC001", "N803", "N806", ] From 7201b46b3e70a0ca6e32e29ad0e10afeb6b47bb7 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Thu, 15 Feb 2024 13:44:30 +0000 Subject: [PATCH 03/13] Bump `ruff` (#354) --- .pre-commit-config.yaml | 2 +- .../arbitrary/_denoising_slepian_wavelet.py | 2 +- .../arbitrary/_slepian_wavelet_covariance.py | 2 +- .../africa/denoising_slepian_africa.py | 2 +- ...ogressive_wavelet_reconstruction_africa.py | 2 +- .../slepian_wavelet_covariance_africa.py | 4 +- ...noising_slepian_functions_south_america.py | 2 +- .../denoising_slepian_south_america.py | 2 +- ...ve_wavelet_reconstruction_south_america.py | 2 +- ...lepian_wavelet_covariance_south_america.py | 4 +- examples/mesh/denoising_slepian_mesh.py | 2 +- examples/mesh/produce_table.py | 2 +- examples/misc/_denoising_axisym.py | 2 +- examples/misc/denoising_axisym_africa.py | 2 +- examples/misc/denoising_axisym_earth.py | 2 +- .../misc/denoising_axisym_south_america.py | 2 +- examples/misc/wavelet_transform.py | 2 +- examples/polar_cap/eigenfunctions.py | 2 +- examples/polar_cap/simons_5_1.py | 2 +- examples/polar_cap/slepian_coefficients.py | 4 +- examples/polar_cap/slepian_error.py | 12 ++-- .../axisymmetric_wavelet_covariance.py | 6 +- src/sleplet/_convolution_methods.py | 6 +- src/sleplet/_data/create_earth_flm.py | 4 +- src/sleplet/_data/create_wmap_flm.py | 6 +- src/sleplet/_integration_methods.py | 20 +++--- src/sleplet/_mask_methods.py | 26 +++---- src/sleplet/_mesh_methods.py | 22 +++--- src/sleplet/_parallel_methods.py | 12 ++-- src/sleplet/_scripts/plotting_on_sphere.py | 8 +-- src/sleplet/_slepian_arbitrary_methods.py | 4 +- src/sleplet/_smoothing.py | 4 +- src/sleplet/functions/africa.py | 8 +-- ...xisymmetric_wavelet_coefficients_africa.py | 4 +- ...axisymmetric_wavelet_coefficients_earth.py | 4 +- ...tric_wavelet_coefficients_south_america.py | 4 +- .../functions/axisymmetric_wavelets.py | 4 +- src/sleplet/functions/coefficients.py | 24 +++---- src/sleplet/functions/dirac_delta.py | 4 +- src/sleplet/functions/earth.py | 2 +- src/sleplet/functions/elongated_gaussian.py | 8 +-- src/sleplet/functions/flm.py | 10 +-- src/sleplet/functions/fp.py | 10 +-- src/sleplet/functions/gaussian.py | 4 +- src/sleplet/functions/harmonic_gaussian.py | 4 +- src/sleplet/functions/identity.py | 4 +- src/sleplet/functions/noise_earth.py | 2 +- src/sleplet/functions/ridgelets.py | 10 +-- src/sleplet/functions/slepian.py | 2 +- src/sleplet/functions/slepian_africa.py | 2 +- src/sleplet/functions/slepian_dirac_delta.py | 2 +- src/sleplet/functions/slepian_identity.py | 4 +- src/sleplet/functions/slepian_noise_africa.py | 2 +- .../functions/slepian_noise_south_america.py | 2 +- .../functions/slepian_south_america.py | 2 +- .../slepian_wavelet_coefficients_africa.py | 4 +- ...pian_wavelet_coefficients_south_america.py | 4 +- src/sleplet/functions/slepian_wavelets.py | 4 +- src/sleplet/functions/south_america.py | 8 +-- src/sleplet/functions/spherical_harmonic.py | 2 +- src/sleplet/functions/squashed_gaussian.py | 8 +-- src/sleplet/functions/wmap.py | 2 +- src/sleplet/harmonic_methods.py | 34 ++++----- .../meshes/_mesh_slepian_decomposition.py | 6 +- src/sleplet/meshes/mesh.py | 8 +-- src/sleplet/meshes/mesh_basis_functions.py | 2 +- src/sleplet/meshes/mesh_coefficients.py | 12 ++-- src/sleplet/meshes/mesh_field.py | 2 +- .../meshes/mesh_harmonic_coefficients.py | 6 +- src/sleplet/meshes/mesh_noise_field.py | 2 +- src/sleplet/meshes/mesh_slepian.py | 12 ++-- .../meshes/mesh_slepian_coefficients.py | 6 +- src/sleplet/meshes/mesh_slepian_field.py | 2 +- src/sleplet/meshes/mesh_slepian_functions.py | 2 +- .../meshes/mesh_slepian_noise_field.py | 2 +- .../mesh_slepian_wavelet_coefficients.py | 4 +- src/sleplet/meshes/mesh_slepian_wavelets.py | 4 +- src/sleplet/noise.py | 72 +++++++++---------- src/sleplet/plot_methods.py | 24 +++---- src/sleplet/plotting/_create_plot_mesh.py | 10 +-- src/sleplet/plotting/_create_plot_sphere.py | 16 ++--- src/sleplet/slepian/_slepian_decomposition.py | 10 +-- src/sleplet/slepian/slepian_arbitrary.py | 16 ++--- src/sleplet/slepian/slepian_functions.py | 12 ++-- src/sleplet/slepian/slepian_limit_lat_lon.py | 24 ++++--- src/sleplet/slepian/slepian_polar_cap.py | 42 +++++------ src/sleplet/slepian_methods.py | 30 ++++---- src/sleplet/wavelet_methods.py | 38 +++++----- tests/conftest.py | 2 +- tests/test_harmonic.py | 4 +- 90 files changed, 369 insertions(+), 365 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20ed6e5cf..20b3a6164 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/paddyroddy/.github - rev: v0.130.0 + rev: v0.134.0 hooks: - id: general-hooks - id: python-hooks diff --git a/examples/arbitrary/_denoising_slepian_wavelet.py b/examples/arbitrary/_denoising_slepian_wavelet.py index f2e136a92..55dc77bb6 100644 --- a/examples/arbitrary/_denoising_slepian_wavelet.py +++ b/examples/arbitrary/_denoising_slepian_wavelet.py @@ -11,7 +11,7 @@ def denoising_slepian_wavelet( slepian_wavelets: sleplet.functions.SlepianWavelets, snr_in: float, n_sigma: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Denoising demo using Slepian wavelets.""" # compute wavelet coefficients w = sleplet.wavelet_methods.slepian_wavelet_forward( diff --git a/examples/arbitrary/_slepian_wavelet_covariance.py b/examples/arbitrary/_slepian_wavelet_covariance.py index d832c561c..1c9d907e3 100644 --- a/examples/arbitrary/_slepian_wavelet_covariance.py +++ b/examples/arbitrary/_slepian_wavelet_covariance.py @@ -13,7 +13,7 @@ def compute_slepian_wavelet_covariance( slepian_wavelets: sleplet.functions.SlepianWavelets, *, var_signal: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute the theoretical covariance of the wavelet coefficients.""" s_p = sleplet.slepian_methods.compute_s_p_omega(L, slepian_wavelets.slepian) wavelets_reshape = slepian_wavelets.wavelets[ diff --git a/examples/arbitrary/africa/denoising_slepian_africa.py b/examples/arbitrary/africa/denoising_slepian_africa.py index b64235b87..8c621f181 100644 --- a/examples/arbitrary/africa/denoising_slepian_africa.py +++ b/examples/arbitrary/africa/denoising_slepian_africa.py @@ -6,7 +6,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) -from _denoising_slepian_wavelet import denoising_slepian_wavelet # noqa: E402 +from _denoising_slepian_wavelet import denoising_slepian_wavelet B = 3 J_MIN = 2 diff --git a/examples/arbitrary/africa/progressive_wavelet_reconstruction_africa.py b/examples/arbitrary/africa/progressive_wavelet_reconstruction_africa.py index 7e743f651..825ba26be 100644 --- a/examples/arbitrary/africa/progressive_wavelet_reconstruction_africa.py +++ b/examples/arbitrary/africa/progressive_wavelet_reconstruction_africa.py @@ -21,7 +21,7 @@ def main() -> None: ) # plot - f_p = np.zeros(swc.slepian.N, dtype=np.complex_) + f_p = np.zeros(swc.slepian.N, dtype=np.complex128) for p, coeff in enumerate(swc.wavelet_coefficients): print(f"plot reconstruction: {p}") f_p += sleplet.wavelet_methods.slepian_wavelet_inverse( diff --git a/examples/arbitrary/africa/slepian_wavelet_covariance_africa.py b/examples/arbitrary/africa/slepian_wavelet_covariance_africa.py index e07c02cbb..dff53487c 100644 --- a/examples/arbitrary/africa/slepian_wavelet_covariance_africa.py +++ b/examples/arbitrary/africa/slepian_wavelet_covariance_africa.py @@ -7,7 +7,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) -from _slepian_wavelet_covariance import compute_slepian_wavelet_covariance # noqa: E402 +from _slepian_wavelet_covariance import compute_slepian_wavelet_covariance B = 3 J_MIN = 2 @@ -32,7 +32,7 @@ def main() -> None: # initialise matrix covar_runs_shape = (RUNS, *covar_theory.shape) - covar_data_runs = np.zeros(covar_runs_shape, dtype=np.complex_) + covar_data_runs = np.zeros(covar_runs_shape, dtype=np.complex128) # set seed rng = np.random.default_rng(RANDOM_SEED) diff --git a/examples/arbitrary/south_america/denoising_slepian_functions_south_america.py b/examples/arbitrary/south_america/denoising_slepian_functions_south_america.py index 014a96c73..59a7b78e4 100644 --- a/examples/arbitrary/south_america/denoising_slepian_functions_south_america.py +++ b/examples/arbitrary/south_america/denoising_slepian_functions_south_america.py @@ -19,7 +19,7 @@ def _denoising_slepian_function( noised_signal: sleplet.functions.SlepianSouthAmerica, snr_in: float, n_sigma: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Denoising demo using Slepian function.""" # compute Slepian noise sigma_noise = sleplet.noise.compute_sigma_noise( diff --git a/examples/arbitrary/south_america/denoising_slepian_south_america.py b/examples/arbitrary/south_america/denoising_slepian_south_america.py index 739950b00..fb3782442 100644 --- a/examples/arbitrary/south_america/denoising_slepian_south_america.py +++ b/examples/arbitrary/south_america/denoising_slepian_south_america.py @@ -6,7 +6,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) -from _denoising_slepian_wavelet import denoising_slepian_wavelet # noqa: E402 +from _denoising_slepian_wavelet import denoising_slepian_wavelet B = 3 J_MIN = 2 diff --git a/examples/arbitrary/south_america/progressive_wavelet_reconstruction_south_america.py b/examples/arbitrary/south_america/progressive_wavelet_reconstruction_south_america.py index 3a25184a2..b584cb93c 100644 --- a/examples/arbitrary/south_america/progressive_wavelet_reconstruction_south_america.py +++ b/examples/arbitrary/south_america/progressive_wavelet_reconstruction_south_america.py @@ -21,7 +21,7 @@ def main() -> None: ) # plot - f_p = np.zeros(swc.slepian.N, dtype=np.complex_) + f_p = np.zeros(swc.slepian.N, dtype=np.complex128) for p, coeff in enumerate(swc.wavelet_coefficients): print(f"plot reconstruction: {p}") f_p += sleplet.wavelet_methods.slepian_wavelet_inverse( diff --git a/examples/arbitrary/south_america/slepian_wavelet_covariance_south_america.py b/examples/arbitrary/south_america/slepian_wavelet_covariance_south_america.py index 5da16d67e..922389a8a 100644 --- a/examples/arbitrary/south_america/slepian_wavelet_covariance_south_america.py +++ b/examples/arbitrary/south_america/slepian_wavelet_covariance_south_america.py @@ -7,7 +7,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) -from _slepian_wavelet_covariance import compute_slepian_wavelet_covariance # noqa: E402 +from _slepian_wavelet_covariance import compute_slepian_wavelet_covariance B = 3 J_MIN = 2 @@ -32,7 +32,7 @@ def main() -> None: # initialise matrix covar_runs_shape = (RUNS, *covar_theory.shape) - covar_data_runs = np.zeros(covar_runs_shape, dtype=np.complex_) + covar_data_runs = np.zeros(covar_runs_shape, dtype=np.complex128) # set seed rng = np.random.default_rng(RANDOM_SEED) diff --git a/examples/mesh/denoising_slepian_mesh.py b/examples/mesh/denoising_slepian_mesh.py index 07181c465..8b4317532 100644 --- a/examples/mesh/denoising_slepian_mesh.py +++ b/examples/mesh/denoising_slepian_mesh.py @@ -26,7 +26,7 @@ def _denoising_mesh_slepian( mesh_slepian_wavelets: sleplet.meshes.MeshSlepianWavelets, snr_in: float, n_sigma: int, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """Denoising demo using Slepian wavelets.""" # compute wavelet coefficients w = sleplet.wavelet_methods.slepian_wavelet_forward( diff --git a/examples/mesh/produce_table.py b/examples/mesh/produce_table.py index 4e52c9944..7a8d54fdc 100644 --- a/examples/mesh/produce_table.py +++ b/examples/mesh/produce_table.py @@ -3,7 +3,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parent)) -from denoising_slepian_mesh import main # noqa: E402 +from denoising_slepian_mesh import main MESH_SNR_DICT = { "cheetah": -8.64, diff --git a/examples/misc/_denoising_axisym.py b/examples/misc/_denoising_axisym.py index 561bb5f94..d02f1e8a9 100644 --- a/examples/misc/_denoising_axisym.py +++ b/examples/misc/_denoising_axisym.py @@ -20,7 +20,7 @@ def denoising_axisym( # noqa: PLR0913 n_sigma: int, *, rotate_to_south_america: bool = False, -) -> tuple[npt.NDArray[np.complex_], float | None, float]: +) -> tuple[npt.NDArray[np.complex128], float | None, float]: """Reproduce the denoising demo from S2LET paper.""" # compute wavelet coefficients w = sleplet.wavelet_methods.axisymmetric_wavelet_forward( diff --git a/examples/misc/denoising_axisym_africa.py b/examples/misc/denoising_axisym_africa.py index ad857751a..d00fc356b 100644 --- a/examples/misc/denoising_axisym_africa.py +++ b/examples/misc/denoising_axisym_africa.py @@ -5,7 +5,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parent)) -from _denoising_axisym import denoising_axisym # noqa: E402 +from _denoising_axisym import denoising_axisym B = 2 J_MIN = 0 diff --git a/examples/misc/denoising_axisym_earth.py b/examples/misc/denoising_axisym_earth.py index 0ea32861e..a47665a83 100644 --- a/examples/misc/denoising_axisym_earth.py +++ b/examples/misc/denoising_axisym_earth.py @@ -7,7 +7,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parent)) -from _denoising_axisym import denoising_axisym # noqa: E402 +from _denoising_axisym import denoising_axisym B = 2 J_MIN = 0 diff --git a/examples/misc/denoising_axisym_south_america.py b/examples/misc/denoising_axisym_south_america.py index 4c0c14f62..7ec7dbe74 100644 --- a/examples/misc/denoising_axisym_south_america.py +++ b/examples/misc/denoising_axisym_south_america.py @@ -5,7 +5,7 @@ sys.path.append(str(pathlib.Path(__file__).resolve().parent)) -from _denoising_axisym import denoising_axisym # noqa: E402 +from _denoising_axisym import denoising_axisym B = 2 J_MIN = 0 diff --git a/examples/misc/wavelet_transform.py b/examples/misc/wavelet_transform.py index 323829e98..6f6b7caf7 100644 --- a/examples/misc/wavelet_transform.py +++ b/examples/misc/wavelet_transform.py @@ -26,7 +26,7 @@ def main() -> None: plt.close() -def _ricker(freq: float) -> npt.NDArray[np.float_]: +def _ricker(freq: float) -> npt.NDArray[np.float64]: """Create a Ricker wavelet.""" t = np.arange(-LENGTH / 2, (LENGTH - DELTA_T) / 2, DELTA_T) return (1.0 - 2.0 * (np.pi**2) * (freq**2) * (t**2)) * np.exp( diff --git a/examples/polar_cap/eigenfunctions.py b/examples/polar_cap/eigenfunctions.py index 7f509f067..85baf1220 100644 --- a/examples/polar_cap/eigenfunctions.py +++ b/examples/polar_cap/eigenfunctions.py @@ -53,7 +53,7 @@ def main() -> None: def _helper( ax: mpl.axes.Axes, slepian: sleplet.slepian.SlepianPolarCap, - x: npt.NDArray[np.float_], + x: npt.NDArray[np.float64], i: int, rank: int, ) -> None: diff --git a/examples/polar_cap/simons_5_1.py b/examples/polar_cap/simons_5_1.py index 391af8649..d699f8e19 100644 --- a/examples/polar_cap/simons_5_1.py +++ b/examples/polar_cap/simons_5_1.py @@ -52,7 +52,7 @@ def _helper( # noqa: PLR0913 ax: npt.NDArray[typing.Any], slepian: sleplet.slepian.SlepianPolarCap, resolution: int, - x: npt.NDArray[np.float_], + x: npt.NDArray[np.float64], i: int, order: int, rank: int, diff --git a/examples/polar_cap/slepian_coefficients.py b/examples/polar_cap/slepian_coefficients.py index 6e73c642a..436bdc1b4 100644 --- a/examples/polar_cap/slepian_coefficients.py +++ b/examples/polar_cap/slepian_coefficients.py @@ -14,7 +14,7 @@ def _earth_region_harmonic_coefficients( L: int, theta_max: int, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Harmonic coefficients of the Earth for the polar cap region.""" region = sleplet.slepian.Region(theta_max=np.deg2rad(theta_max)) earth = sleplet.functions.Earth(L, region=region) @@ -26,7 +26,7 @@ def _earth_region_harmonic_coefficients( def _earth_region_slepian_coefficients( L: int, theta_max: int, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute the Slepian coefficients.""" region = sleplet.slepian.Region(theta_max=np.deg2rad(theta_max)) earth = sleplet.functions.Earth(L, region=region) diff --git a/examples/polar_cap/slepian_error.py b/examples/polar_cap/slepian_error.py index 84097a4d0..f879c9a8b 100644 --- a/examples/polar_cap/slepian_error.py +++ b/examples/polar_cap/slepian_error.py @@ -52,9 +52,9 @@ def main() -> None: def _helper_sphere( L: int, region: sleplet.slepian.Region, - f: npt.NDArray[np.complex_], - flm: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.float_]: + f: npt.NDArray[np.complex128], + flm: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.float64]: """Calculate the difference in Slepian coefficients by integration of the sphere.""" slepian = sleplet.slepian_methods.choose_slepian_method(L, region) output = np.abs(sleplet.slepian_methods.slepian_forward(L, slepian, f=f)) @@ -65,9 +65,9 @@ def _helper_sphere( def _helper_region( L: int, region: sleplet.slepian.Region, - f: npt.NDArray[np.complex_], - flm: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.float_]: + f: npt.NDArray[np.complex128], + flm: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.float64]: """Calculate the difference in Slepian coefficients by integration of the region.""" slepian = sleplet.slepian_methods.choose_slepian_method(L, region) output = np.abs( diff --git a/examples/wavelets/axisymmetric_wavelet_covariance.py b/examples/wavelets/axisymmetric_wavelet_covariance.py index 74b22c37b..a42e85252 100644 --- a/examples/wavelets/axisymmetric_wavelet_covariance.py +++ b/examples/wavelets/axisymmetric_wavelet_covariance.py @@ -13,10 +13,10 @@ def _compute_wavelet_covariance( - wavelets: npt.NDArray[np.complex_], + wavelets: npt.NDArray[np.complex128], *, var_signal: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute the theoretical covariance of the wavelet coefficients.""" covar_theory = (np.abs(wavelets) ** 2).sum(axis=1) return covar_theory * var_signal @@ -67,7 +67,7 @@ def axisymmetric_wavelet_covariance( # initialise matrix covar_runs_shape = (runs, *covar_theory.shape) - covar_data = np.zeros(covar_runs_shape, dtype=np.complex_) + covar_data = np.zeros(covar_runs_shape, dtype=np.complex128) # set seed rng = np.random.default_rng(RANDOM_SEED) diff --git a/src/sleplet/_convolution_methods.py b/src/sleplet/_convolution_methods.py index 6a346cc2a..41d27026f 100644 --- a/src/sleplet/_convolution_methods.py +++ b/src/sleplet/_convolution_methods.py @@ -3,11 +3,11 @@ def sifting_convolution( - f_coefficient: npt.NDArray[np.complex_ | np.float_], - g_coefficient: npt.NDArray[np.complex_ | np.float_], + f_coefficient: npt.NDArray[np.complex128 | np.float64], + g_coefficient: npt.NDArray[np.complex128 | np.float64], *, shannon: int | None = None, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """Compute the sifting convolution between two multipoles.""" n = shannon if shannon is not None else np.newaxis # change shape if the sizes don't match diff --git a/src/sleplet/_data/create_earth_flm.py b/src/sleplet/_data/create_earth_flm.py index 4da766a88..abe7384fb 100644 --- a/src/sleplet/_data/create_earth_flm.py +++ b/src/sleplet/_data/create_earth_flm.py @@ -8,7 +8,7 @@ import sleplet._smoothing -def create_flm(L: int, *, smoothing: int | None = None) -> npt.NDArray[np.complex_]: +def create_flm(L: int, *, smoothing: int | None = None) -> npt.NDArray[np.complex128]: """Create the flm for the whole Earth.""" # load in data flm = _load_flm() @@ -29,7 +29,7 @@ def create_flm(L: int, *, smoothing: int | None = None) -> npt.NDArray[np.comple return flm -def _load_flm() -> npt.NDArray[np.complex_]: +def _load_flm() -> npt.NDArray[np.complex128]: """Load coefficients from file.""" mat_contents = sio.loadmat( sleplet._data.setup_pooch.find_on_pooch_then_local( diff --git a/src/sleplet/_data/create_wmap_flm.py b/src/sleplet/_data/create_wmap_flm.py index 346395a32..6a9832e4c 100644 --- a/src/sleplet/_data/create_wmap_flm.py +++ b/src/sleplet/_data/create_wmap_flm.py @@ -8,7 +8,7 @@ import sleplet._vars -def create_flm(L: int) -> npt.NDArray[np.complex_]: +def create_flm(L: int) -> npt.NDArray[np.complex128]: """Create the flm for the whole CMB.""" # load in data cl = _load_cl() @@ -17,7 +17,7 @@ def create_flm(L: int) -> npt.NDArray[np.complex_]: rng = np.random.default_rng(sleplet._vars.RANDOM_SEED) # Simulate CMB in harmonic space. - flm = np.zeros(L**2, dtype=np.complex_) + flm = np.zeros(L**2, dtype=np.complex128) for ell in range(2, L): sigma = np.sqrt(2 * np.pi / (ell * (ell + 1)) * cl[ell - 2]) ind = ssht.elm2ind(ell, 0) @@ -37,7 +37,7 @@ def create_flm(L: int) -> npt.NDArray[np.complex_]: def _load_cl( *, file_ending: str = "_lcdm_pl_model_wmap7baoh0", -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """ Pick coefficients from file options are: * _lcdm_pl_model_yr1_v1.mat diff --git a/src/sleplet/_integration_methods.py b/src/sleplet/_integration_methods.py index 259ffceb3..bd518cfe4 100644 --- a/src/sleplet/_integration_methods.py +++ b/src/sleplet/_integration_methods.py @@ -9,7 +9,7 @@ import sleplet._vars -def calc_integration_weight(L: int) -> npt.NDArray[np.float_]: +def calc_integration_weight(L: int) -> npt.NDArray[np.float64]: """Compute the spherical Jacobian for the integration.""" thetas, phis = ssht.sample_positions( L, @@ -22,8 +22,8 @@ def calc_integration_weight(L: int) -> npt.NDArray[np.float_]: def integrate_whole_sphere( - weight: npt.NDArray[np.float_], - *functions: npt.NDArray[np.complex_], + weight: npt.NDArray[np.float64], + *functions: npt.NDArray[np.complex128], ) -> complex: """Compute the integration for the whole sphere.""" multiplied_inputs = _multiply_args(*functions) @@ -31,9 +31,9 @@ def integrate_whole_sphere( def integrate_region_sphere( - mask: npt.NDArray[np.float_], - weight: npt.NDArray[np.float_], - *functions: npt.NDArray[np.complex_ | np.float_], + mask: npt.NDArray[np.float64], + weight: npt.NDArray[np.float64], + *functions: npt.NDArray[np.complex128 | np.float64], ) -> complex: """Compute the integration for a region of the sphere.""" multiplied_inputs = _multiply_args(*functions) @@ -41,9 +41,9 @@ def integrate_region_sphere( def integrate_whole_mesh( - vertices: npt.NDArray[np.float_], # noqa: ARG001 + vertices: npt.NDArray[np.float64], # noqa: ARG001 faces: npt.NDArray[np.int_], # noqa: ARG001 - *functions: npt.NDArray[np.complex_ | np.float_], + *functions: npt.NDArray[np.complex128 | np.float64], ) -> float: """Compute the integral of functions on the vertices.""" multiplied_inputs = _multiply_args(*functions) @@ -52,9 +52,9 @@ def integrate_whole_mesh( def integrate_region_mesh( mask: npt.NDArray[np.bool_], - vertices: npt.NDArray[np.float_], # noqa: ARG001 + vertices: npt.NDArray[np.float64], # noqa: ARG001 faces: npt.NDArray[np.int_], # noqa: ARG001 - *functions: npt.NDArray[np.complex_ | np.float_], + *functions: npt.NDArray[np.complex128 | np.float64], ) -> float: """Compute the integral of a region of functions on the vertices.""" multiplied_inputs = _multiply_args(*functions) diff --git a/src/sleplet/_mask_methods.py b/src/sleplet/_mask_methods.py index 929dea839..14e134352 100644 --- a/src/sleplet/_mask_methods.py +++ b/src/sleplet/_mask_methods.py @@ -24,7 +24,7 @@ def create_mask_region( L: int, region: "sleplet.slepian.region.Region", -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """ Create a mask of a region of interested, the output will be based on the value of the provided L. The mask could be either: @@ -67,7 +67,7 @@ def create_mask_region( return mask -def _load_mask(L: int, mask_name: str) -> npt.NDArray[np.float_]: +def _load_mask(L: int, mask_name: str) -> npt.NDArray[np.float64]: """Attempt to read the mask from the config file.""" mask = sleplet._data.setup_pooch.find_on_pooch_then_local( f"slepian_masks_{mask_name}", @@ -76,13 +76,13 @@ def _load_mask(L: int, mask_name: str) -> npt.NDArray[np.float_]: def ensure_masked_flm_bandlimited( - flm: npt.NDArray[np.complex_], + flm: npt.NDArray[np.complex128], L: int, region: "sleplet.slepian.region.Region", *, reality: bool, spin: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Ensure the coefficients is bandlimited for a given region.""" field = ssht.inverse( flm, @@ -116,7 +116,7 @@ def create_default_region() -> "sleplet.slepian.region.Region": def create_mesh_region( mesh_config: dict[str, typing.Any], - vertices: npt.NDArray[np.float_], + vertices: npt.NDArray[np.float64], ) -> npt.NDArray[np.bool_]: """Create a boolean region for the given mesh.""" return ( @@ -131,8 +131,8 @@ def create_mesh_region( def ensure_masked_bandlimit_mesh_signal( mesh: "sleplet.meshes.mesh.Mesh", - u_i: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.float_]: + u_i: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.float64]: """Ensure that signal in pixel space is bandlimited.""" field = sleplet.harmonic_methods.mesh_inverse(mesh, u_i) masked_field = np.where(mesh.mesh_region, field, 0) @@ -141,7 +141,7 @@ def ensure_masked_bandlimit_mesh_signal( def convert_region_on_vertices_to_faces( mesh: "sleplet.meshes.mesh.Mesh", -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Convert the region on vertices to faces.""" region_reshape = np.argwhere(mesh.mesh_region).reshape(-1) faces_in_region = np.isin(mesh.faces, region_reshape).all(axis=1) @@ -152,8 +152,8 @@ def convert_region_on_vertices_to_faces( def _create_africa_mask( L: int, - earth_flm: npt.NDArray[np.complex_], -) -> npt.NDArray[np.float_]: + earth_flm: npt.NDArray[np.complex128], +) -> npt.NDArray[np.float64]: """Create the Africa region mask.""" rot_flm = sleplet.harmonic_methods.rotate_earth_to_africa(earth_flm, L) earth_f = ssht.inverse( @@ -172,8 +172,8 @@ def _create_africa_mask( def _create_south_america_mask( L: int, - earth_flm: npt.NDArray[np.complex_], -) -> npt.NDArray[np.float_]: + earth_flm: npt.NDArray[np.complex128], +) -> npt.NDArray[np.float64]: """Create the Africa region mask.""" rot_flm = sleplet.harmonic_methods.rotate_earth_to_south_america(earth_flm, L) earth_f = ssht.inverse( @@ -190,7 +190,7 @@ def _create_south_america_mask( return (thetas <= _SOUTH_AMERICA_RANGE) & (earth_f >= 0) -def create_mask(L: int, mask_name: str) -> npt.NDArray[np.float_]: +def create_mask(L: int, mask_name: str) -> npt.NDArray[np.float64]: """Create the South America region mask.""" earth_flm = sleplet._data.create_earth_flm.create_flm(L) if mask_name == f"africa_L{L}.npy": diff --git a/src/sleplet/_mesh_methods.py b/src/sleplet/_mesh_methods.py index e3debe859..1adabb9b7 100644 --- a/src/sleplet/_mesh_methods.py +++ b/src/sleplet/_mesh_methods.py @@ -18,8 +18,8 @@ def average_functions_on_vertices_to_faces( faces: npt.NDArray[np.int_], - functions_on_vertices: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.float_]: + functions_on_vertices: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.float64]: """ Require all functions to be defined on faces this method handles an arbitrary number of functions. @@ -42,7 +42,7 @@ def average_functions_on_vertices_to_faces( def create_mesh_region( mesh_config: dict[str, typing.Any], - vertices: npt.NDArray[np.float_], + vertices: npt.NDArray[np.float64], ) -> npt.NDArray[np.bool_]: """Create a boolean region for the given mesh.""" return ( @@ -66,11 +66,11 @@ def extract_mesh_config(mesh_name: str) -> dict[str, float | int | str]: def mesh_eigendecomposition( name: str, - vertices: npt.NDArray[np.float_], + vertices: npt.NDArray[np.float64], faces: npt.NDArray[np.int_], *, number_basis_functions: int | None = None, -) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.float_], int]: +) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64], int]: """ Compute the eigendecomposition of the mesh represented as a graph if already computed then it loads the data. @@ -113,7 +113,7 @@ def mesh_eigendecomposition( def read_mesh( mesh_config: dict[str, float | int | str], -) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.int_]]: +) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.int_]]: """Read in the given mesh.""" vertices, faces = igl.read_triangle_mesh( str(_data_path / f"meshes_polygons_{mesh_config['FILENAME']}"), @@ -122,18 +122,18 @@ def read_mesh( def _mesh_laplacian( - vertices: npt.NDArray[np.float_], + vertices: npt.NDArray[np.float64], faces: npt.NDArray[np.int_], -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute the cotagent mesh laplacian.""" return -igl.cotmatrix(vertices, faces) def _orthonormalise_basis_functions( - vertices: npt.NDArray[np.float_], + vertices: npt.NDArray[np.float64], faces: npt.NDArray[np.int_], - basis_functions: npt.NDArray[np.float_], -) -> npt.NDArray[np.float_]: + basis_functions: npt.NDArray[np.float64], +) -> npt.NDArray[np.float64]: """For computing the Slepian D matrix the basis functions must be orthonormal.""" _logger.info("orthonormalising basis functions") factor = np.zeros(basis_functions.shape[0]) diff --git a/src/sleplet/_parallel_methods.py b/src/sleplet/_parallel_methods.py index 4101b32b9..3fab8d16c 100644 --- a/src/sleplet/_parallel_methods.py +++ b/src/sleplet/_parallel_methods.py @@ -12,14 +12,14 @@ def split_arr_into_chunks(arr_max: int, ncpu: int) -> list[npt.NDArray[np.int_]] def create_shared_memory_array( - array: npt.NDArray[np.float_], -) -> tuple[npt.NDArray[np.float_], multiprocess.shared_memory.SharedMemory]: + array: npt.NDArray[np.float64], +) -> tuple[npt.NDArray[np.float64], multiprocess.shared_memory.SharedMemory]: """Create a shared memory array to be used in a parallel function.""" ext_shared_memory = multiprocess.shared_memory.SharedMemory( create=True, size=array.nbytes, ) - array_ext: npt.NDArray[np.float_] = np.ndarray( + array_ext: npt.NDArray[np.float64] = np.ndarray( array.shape, dtype=array.dtype, buffer=ext_shared_memory.buf, @@ -28,14 +28,14 @@ def create_shared_memory_array( def attach_to_shared_memory_block( - array: npt.NDArray[np.float_], + array: npt.NDArray[np.float64], ext_shared_memory: multiprocess.shared_memory.SharedMemory, -) -> tuple[npt.NDArray[np.float_], multiprocess.shared_memory.SharedMemory]: +) -> tuple[npt.NDArray[np.float64], multiprocess.shared_memory.SharedMemory]: """Attach an array to the shared memory within the parallel function.""" int_shared_memory = multiprocess.shared_memory.SharedMemory( name=ext_shared_memory.name, ) - array_int: npt.NDArray[np.float_] = np.ndarray( + array_int: npt.NDArray[np.float64] = np.ndarray( array.shape, dtype=array.dtype, buffer=int_shared_memory.buf, diff --git a/src/sleplet/_scripts/plotting_on_sphere.py b/src/sleplet/_scripts/plotting_on_sphere.py index cc3f46228..1b0d9839c 100644 --- a/src/sleplet/_scripts/plotting_on_sphere.py +++ b/src/sleplet/_scripts/plotting_on_sphere.py @@ -271,7 +271,7 @@ def _rotation_helper( alpha_pi_frac: float, beta_pi_frac: float, gamma_pi_frac: float, -) -> tuple[npt.NDArray[np.complex_], str]: +) -> tuple[npt.NDArray[np.complex128], str]: """Perform the rotation specific steps.""" msg = ( "angles: (alpha, beta, gamma) = " @@ -302,7 +302,7 @@ def _translation_helper( alpha_pi_frac: float, beta_pi_frac: float, shannon: int | None, -) -> tuple[npt.NDArray[np.complex_ | np.float_], str, dict[str, float | int]]: +) -> tuple[npt.NDArray[np.complex128 | np.float64], str, dict[str, float | int]]: """Perform the translation specific steps.""" msg = f"angles: (alpha, beta) = ({alpha_pi_frac}, {beta_pi_frac})" _logger.info(msg) @@ -336,10 +336,10 @@ def _translation_helper( def _convolution_helper( f: sleplet.functions.coefficients.Coefficients, g: sleplet.functions.coefficients.Coefficients, - coefficients: npt.NDArray[np.complex_ | np.float_], + coefficients: npt.NDArray[np.complex128 | np.float64], shannon: int | None, filename: str, -) -> tuple[npt.NDArray[np.complex_ | np.float_], str]: +) -> tuple[npt.NDArray[np.complex128 | np.float64], str]: """Perform the convolution specific steps.""" g_coefficients = ( sleplet.slepian_methods.slepian_forward(f.L, f.slepian, flm=g.coefficients) diff --git a/src/sleplet/_slepian_arbitrary_methods.py b/src/sleplet/_slepian_arbitrary_methods.py index 81a72b36e..3e87451a6 100644 --- a/src/sleplet/_slepian_arbitrary_methods.py +++ b/src/sleplet/_slepian_arbitrary_methods.py @@ -10,8 +10,8 @@ def clean_evals_and_evecs( - eigendecomposition: tuple[npt.NDArray[np.complex_], npt.NDArray[np.complex_]], -) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + eigendecomposition: tuple[npt.NDArray[np.complex128], npt.NDArray[np.complex128]], +) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Need eigenvalues and eigenvectors to be in a certain format.""" # access values eigenvalues_complex, eigenvectors = eigendecomposition diff --git a/src/sleplet/_smoothing.py b/src/sleplet/_smoothing.py index 03ff24f14..206be8752 100644 --- a/src/sleplet/_smoothing.py +++ b/src/sleplet/_smoothing.py @@ -9,10 +9,10 @@ def apply_gaussian_smoothing( - flm: npt.NDArray[np.complex_], + flm: npt.NDArray[np.complex128], L: int, smoothing_factor: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Apply Gaussian smoothing to the given signal. diff --git a/src/sleplet/functions/africa.py b/src/sleplet/functions/africa.py index c8feb9c4a..e1bdf227a 100644 --- a/src/sleplet/functions/africa.py +++ b/src/sleplet/functions/africa.py @@ -28,7 +28,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet.harmonic_methods._ensure_f_bandlimited( self._grid_fun, self.L, @@ -54,9 +54,9 @@ def _setup_args(self: typing_extensions.Self) -> None: def _grid_fun( self: typing_extensions.Self, - theta: npt.NDArray[np.float_], # noqa: ARG002 - phi: npt.NDArray[np.float_], # noqa: ARG002 - ) -> npt.NDArray[np.float_]: + theta: npt.NDArray[np.float64], # noqa: ARG002 + phi: npt.NDArray[np.float64], # noqa: ARG002 + ) -> npt.NDArray[np.float64]: """Define the function on the grid.""" earth_flm = sleplet._data.create_earth_flm.create_flm( self.L, diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py index 005ecb8b3..ec5b11c1f 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py @@ -40,7 +40,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -71,7 +71,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.complex128], npt.NDArray[np.complex128]]: """Compute wavelet coefficients of Africa.""" wavelets = sleplet.wavelet_methods._create_axisymmetric_wavelets( self.L, diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py index 9b688ab3c..ae4f410ab 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py @@ -40,7 +40,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -71,7 +71,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.complex128], npt.NDArray[np.complex128]]: """Compute wavelet coefficients of the Earth.""" wavelets = sleplet.wavelet_methods._create_axisymmetric_wavelets( self.L, diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py index edad61fc3..4a2ee796b 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py @@ -39,7 +39,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -70,7 +70,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.complex128], npt.NDArray[np.complex128]]: """Compute wavelet coefficients of South America.""" wavelets = sleplet.wavelet_methods._create_axisymmetric_wavelets( self.L, diff --git a/src/sleplet/functions/axisymmetric_wavelets.py b/src/sleplet/functions/axisymmetric_wavelets.py index 94d9b4009..ee2cf387c 100644 --- a/src/sleplet/functions/axisymmetric_wavelets.py +++ b/src/sleplet/functions/axisymmetric_wavelets.py @@ -36,7 +36,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelets") self.wavelets = self._create_wavelets() _logger.info("finish computing wavelets") @@ -65,7 +65,7 @@ def _setup_args(self: typing_extensions.Self) -> None: raise ValueError(msg) self.B, self.j_min, self.j = self.extra_args - def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.complex_]: + def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.complex128]: """Compute all wavelets.""" return sleplet.wavelet_methods._create_axisymmetric_wavelets( self.L, diff --git a/src/sleplet/functions/coefficients.py b/src/sleplet/functions/coefficients.py index c3760e8b9..285bc0ee0 100644 --- a/src/sleplet/functions/coefficients.py +++ b/src/sleplet/functions/coefficients.py @@ -36,13 +36,13 @@ class Coefficients: smoothing: int | None = None """How much to smooth the topographic map of the Earth by.""" _unnoised_coefficients: ( - npt.NDArray[np.complex_ | np.float_] | None + npt.NDArray[np.complex128 | np.float64] | None ) = pydantic.Field( default=None, init_var=False, repr=False, ) - coefficients: npt.NDArray[np.complex_ | np.float_] = pydantic.Field( + coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -51,12 +51,12 @@ class Coefficients: reality: bool = pydantic.Field(default=False, init_var=False, repr=False) snr: float | None = pydantic.Field(default=None, init_var=False, repr=False) spin: int = pydantic.Field(default=0, init_var=False, repr=False) - wavelet_coefficients: npt.NDArray[np.complex_ | np.float_] = pydantic.Field( + wavelet_coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) - wavelets: npt.NDArray[np.complex_ | np.float_] = pydantic.Field( + wavelets: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -77,7 +77,7 @@ def translate( beta: float, *, shannon: int | None = None, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: r""" Perform the translation of the coefficients, used in the sifting convolution. @@ -98,11 +98,11 @@ def translate( def convolve( self: typing_extensions.Self, - f_coefficient: npt.NDArray[np.complex_ | np.float_], - g_coefficient: npt.NDArray[np.complex_ | np.float_], + f_coefficient: npt.NDArray[np.complex128 | np.float64], + g_coefficient: npt.NDArray[np.complex128 | np.float64], *, shannon: int | None = None, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """ Perform the sifting convolution of the two inputs. @@ -147,7 +147,7 @@ def rotate( beta: float, *, gamma: float = 0, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: r""" Rotates given flm on the sphere by alpha/beta/gamma. @@ -166,21 +166,21 @@ def _translation_helper( self: typing_extensions.Self, alpha: float, beta: float, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: """Compute the basis function at omega' for translation.""" raise NotImplementedError @abc.abstractmethod def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise to the signal.""" raise NotImplementedError @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Create the flm on the north pole.""" raise NotImplementedError diff --git a/src/sleplet/functions/dirac_delta.py b/src/sleplet/functions/dirac_delta.py index d623e4a6a..2124c7ee6 100644 --- a/src/sleplet/functions/dirac_delta.py +++ b/src/sleplet/functions/dirac_delta.py @@ -20,8 +20,8 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: - flm = np.zeros(self.L**2, dtype=np.complex_) + ) -> npt.NDArray[np.complex128 | np.float64]: + flm = np.zeros(self.L**2, dtype=np.complex128) for ell in range(self.L): ind = ssht.elm2ind(ell, 0) flm[ind] = np.sqrt((2 * ell + 1) / (4 * np.pi)) diff --git a/src/sleplet/functions/earth.py b/src/sleplet/functions/earth.py index 270b72b88..8966a7f38 100644 --- a/src/sleplet/functions/earth.py +++ b/src/sleplet/functions/earth.py @@ -19,7 +19,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet._data.create_earth_flm.create_flm( self.L, smoothing=self.smoothing, diff --git a/src/sleplet/functions/elongated_gaussian.py b/src/sleplet/functions/elongated_gaussian.py index 84cff16a6..e7935fccf 100644 --- a/src/sleplet/functions/elongated_gaussian.py +++ b/src/sleplet/functions/elongated_gaussian.py @@ -29,7 +29,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet.harmonic_methods._ensure_f_bandlimited( self._grid_fun, self.L, @@ -62,9 +62,9 @@ def _setup_args(self: typing_extensions.Self) -> None: def _grid_fun( self: typing_extensions.Self, - theta: npt.NDArray[np.float_], - phi: npt.NDArray[np.float_], - ) -> npt.NDArray[np.float_]: + theta: npt.NDArray[np.float64], + phi: npt.NDArray[np.float64], + ) -> npt.NDArray[np.float64]: """Define the function on the grid.""" return np.exp( -( diff --git a/src/sleplet/functions/flm.py b/src/sleplet/functions/flm.py index 4233173ba..442f09d12 100644 --- a/src/sleplet/functions/flm.py +++ b/src/sleplet/functions/flm.py @@ -26,21 +26,21 @@ def rotate( # noqa: D102 beta: float, *, gamma: float = 0, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: return ssht.rotate_flms(self.coefficients, alpha, beta, gamma, self.L) def _translation_helper( self: typing_extensions.Self, alpha: float, beta: float, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: return ssht.create_ylm(beta, alpha, self.L).conj().flatten() def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise to the signal.""" - self.coefficients: npt.NDArray[np.complex_ | np.float_] + self.coefficients: npt.NDArray[np.complex128 | np.float64] if self.noise is not None: unnoised_coefficients = self.coefficients.copy() nlm = sleplet.noise._create_noise(self.L, self.coefficients, self.noise) @@ -52,7 +52,7 @@ def _add_noise_to_signal( @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: raise NotImplementedError @abc.abstractmethod diff --git a/src/sleplet/functions/fp.py b/src/sleplet/functions/fp.py index f36b1b9f1..077e7570a 100644 --- a/src/sleplet/functions/fp.py +++ b/src/sleplet/functions/fp.py @@ -44,7 +44,7 @@ def rotate( # noqa: D102 beta: float, # noqa: ARG002 *, gamma: float = 0, # noqa: ARG002 - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: msg = "Slepian rotation is not defined" raise NotImplementedError(msg) @@ -52,7 +52,7 @@ def _translation_helper( self: typing_extensions.Self, alpha: float, beta: float, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: return sleplet.slepian_methods._compute_s_p_omega_prime( self.L, alpha, @@ -62,9 +62,9 @@ def _translation_helper( def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise converted to Slepian space.""" - self.coefficients: npt.NDArray[np.complex_ | np.float_] + self.coefficients: npt.NDArray[np.complex128 | np.float64] if self.noise is not None: unnoised_coefficients = self.coefficients.copy() n_p = sleplet.noise._create_slepian_noise( @@ -81,7 +81,7 @@ def _add_noise_to_signal( @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: raise NotImplementedError @abc.abstractmethod diff --git a/src/sleplet/functions/gaussian.py b/src/sleplet/functions/gaussian.py index 0ffb2488a..565292b82 100644 --- a/src/sleplet/functions/gaussian.py +++ b/src/sleplet/functions/gaussian.py @@ -23,8 +23,8 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: - flm = np.zeros(self.L**2, dtype=np.complex_) + ) -> npt.NDArray[np.complex128 | np.float64]: + flm = np.zeros(self.L**2, dtype=np.complex128) for ell in range(self.L): ind = ssht.elm2ind(ell, 0) flm[ind] = np.exp(-ell * (ell + 1) / (2 * self.sigma**2)) diff --git a/src/sleplet/functions/harmonic_gaussian.py b/src/sleplet/functions/harmonic_gaussian.py index 786843c5c..1ad6bd6a8 100644 --- a/src/sleplet/functions/harmonic_gaussian.py +++ b/src/sleplet/functions/harmonic_gaussian.py @@ -29,8 +29,8 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: - flm = np.zeros(self.L**2, dtype=np.complex_) + ) -> npt.NDArray[np.complex128 | np.float64]: + flm = np.zeros(self.L**2, dtype=np.complex128) for ell in range(self.L): upsilon_l = np.exp(-((ell / self.l_sigma) ** 2) / 2) for m in range(-ell, ell + 1): diff --git a/src/sleplet/functions/identity.py b/src/sleplet/functions/identity.py index a70b066f8..68aa732f7 100644 --- a/src/sleplet/functions/identity.py +++ b/src/sleplet/functions/identity.py @@ -18,8 +18,8 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: - return np.ones(self.L**2, dtype=np.complex_) + ) -> npt.NDArray[np.complex128 | np.float64]: + return np.ones(self.L**2, dtype=np.complex128) def _create_name(self: typing_extensions.Self) -> str: return sleplet._string_methods._convert_camel_case_to_snake_case( diff --git a/src/sleplet/functions/noise_earth.py b/src/sleplet/functions/noise_earth.py index 4b76a074c..816ec6dae 100644 --- a/src/sleplet/functions/noise_earth.py +++ b/src/sleplet/functions/noise_earth.py @@ -24,7 +24,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: earth = sleplet.functions.earth.Earth(self.L, smoothing=self.smoothing) noise = sleplet.noise._create_noise(self.L, earth.coefficients, self.SNR) sleplet.noise.compute_snr(earth.coefficients, noise, "Harmonic") diff --git a/src/sleplet/functions/ridgelets.py b/src/sleplet/functions/ridgelets.py index 359d49194..d4b46f58e 100644 --- a/src/sleplet/functions/ridgelets.py +++ b/src/sleplet/functions/ridgelets.py @@ -40,7 +40,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelets") self.wavelets = self._create_wavelets() _logger.info("finish computing wavelets") @@ -70,20 +70,20 @@ def _setup_args(self: typing_extensions.Self) -> None: raise ValueError(msg) self.B, self.j_min, self.spin, self.j = self.extra_args - def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.complex_]: + def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.complex128]: """Compute all wavelets.""" ring_lm = self._compute_ring() kappas = sleplet.wavelet_methods.create_kappas(self.L, self.B, self.j_min) - wavelets = np.zeros((kappas.shape[0], self.L**2), dtype=np.complex_) + wavelets = np.zeros((kappas.shape[0], self.L**2), dtype=np.complex128) for ell in range(self.L): ind = ssht.elm2ind(ell, 0) wavelets[0, ind] = kappas[0, ell] * ring_lm[ind] wavelets[1:, ind] = kappas[1:, ell] * ring_lm[ind] / np.sqrt(2 * np.pi) return wavelets - def _compute_ring(self: typing_extensions.Self) -> npt.NDArray[np.complex_]: + def _compute_ring(self: typing_extensions.Self) -> npt.NDArray[np.complex128]: """Compute ring in harmonic space.""" - ring_lm = np.zeros(self.L**2, dtype=np.complex_) + ring_lm = np.zeros(self.L**2, dtype=np.complex128) for ell in range(abs(self.spin), self.L): logp2 = ( scipy.special.gammaln(ell + self.spin + 1) diff --git a/src/sleplet/functions/slepian.py b/src/sleplet/functions/slepian.py index e130f40a4..c72afabc9 100644 --- a/src/sleplet/functions/slepian.py +++ b/src/sleplet/functions/slepian.py @@ -42,7 +42,7 @@ def _create_name(self: typing_extensions.Self) -> str: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: msg = ( f"Shannon number: {self.slepian.N}\n" f"Eigenvalue {self.rank}: {self.slepian.eigenvalues[self.rank]:e}" diff --git a/src/sleplet/functions/slepian_africa.py b/src/sleplet/functions/slepian_africa.py index f08143263..c0b257349 100644 --- a/src/sleplet/functions/slepian_africa.py +++ b/src/sleplet/functions/slepian_africa.py @@ -30,7 +30,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: a = sleplet.functions.africa.Africa(self.L, smoothing=self.smoothing) return sleplet.slepian_methods.slepian_forward( self.L, diff --git a/src/sleplet/functions/slepian_dirac_delta.py b/src/sleplet/functions/slepian_dirac_delta.py index 8acbc2fd6..2d27666c4 100644 --- a/src/sleplet/functions/slepian_dirac_delta.py +++ b/src/sleplet/functions/slepian_dirac_delta.py @@ -29,7 +29,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: self._compute_angles() return sleplet.slepian_methods._compute_s_p_omega_prime( self.L, diff --git a/src/sleplet/functions/slepian_identity.py b/src/sleplet/functions/slepian_identity.py index cb6cd3787..1c5d94011 100644 --- a/src/sleplet/functions/slepian_identity.py +++ b/src/sleplet/functions/slepian_identity.py @@ -18,8 +18,8 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: - return np.ones(self.L**2, dtype=np.complex_) + ) -> npt.NDArray[np.complex128 | np.float64]: + return np.ones(self.L**2, dtype=np.complex128) def _create_name(self: typing_extensions.Self) -> str: return ( diff --git a/src/sleplet/functions/slepian_noise_africa.py b/src/sleplet/functions/slepian_noise_africa.py index 4a4f528e7..9bdbfa65f 100644 --- a/src/sleplet/functions/slepian_noise_africa.py +++ b/src/sleplet/functions/slepian_noise_africa.py @@ -34,7 +34,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: sa = sleplet.functions.slepian_africa.SlepianAfrica( self.L, region=self.region, diff --git a/src/sleplet/functions/slepian_noise_south_america.py b/src/sleplet/functions/slepian_noise_south_america.py index fbd027b9f..d0f0b4f86 100644 --- a/src/sleplet/functions/slepian_noise_south_america.py +++ b/src/sleplet/functions/slepian_noise_south_america.py @@ -34,7 +34,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: sa = sleplet.functions.slepian_south_america.SlepianSouthAmerica( self.L, region=self.region, diff --git a/src/sleplet/functions/slepian_south_america.py b/src/sleplet/functions/slepian_south_america.py index bb5b8dd98..f06401342 100644 --- a/src/sleplet/functions/slepian_south_america.py +++ b/src/sleplet/functions/slepian_south_america.py @@ -29,7 +29,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: sa = sleplet.functions.south_america.SouthAmerica( self.L, smoothing=self.smoothing, diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py index 1180f646b..7dafded6c 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py @@ -42,7 +42,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -73,7 +73,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_ | np.float_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128 | np.float64]]: """Compute wavelet coefficients in Slepian space.""" sw = sleplet.functions.slepian_wavelets.SlepianWavelets( self.L, diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py index fa8fc74ee..794a9b892 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py @@ -42,7 +42,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -73,7 +73,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_ | np.float_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128 | np.float64]]: """Compute wavelet coefficients in Slepian space.""" sw = sleplet.functions.slepian_wavelets.SlepianWavelets( self.L, diff --git a/src/sleplet/functions/slepian_wavelets.py b/src/sleplet/functions/slepian_wavelets.py index 489f93552..cc956da4f 100644 --- a/src/sleplet/functions/slepian_wavelets.py +++ b/src/sleplet/functions/slepian_wavelets.py @@ -33,7 +33,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelets") self.wavelets = self._create_wavelets() _logger.info("finish computing wavelets") @@ -63,7 +63,7 @@ def _setup_args(self: typing_extensions.Self) -> None: raise ValueError(msg) self.B, self.j_min, self.j = self.extra_args - def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float64]: """Compute wavelets in Slepian space.""" return sleplet.wavelet_methods.create_kappas(self.L**2, self.B, self.j_min) diff --git a/src/sleplet/functions/south_america.py b/src/sleplet/functions/south_america.py index 600aa6846..8a5965290 100644 --- a/src/sleplet/functions/south_america.py +++ b/src/sleplet/functions/south_america.py @@ -25,7 +25,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet.harmonic_methods._ensure_f_bandlimited( self._grid_fun, self.L, @@ -51,9 +51,9 @@ def _setup_args(self: typing_extensions.Self) -> None: def _grid_fun( self: typing_extensions.Self, - theta: npt.NDArray[np.float_], # noqa: ARG002 - phi: npt.NDArray[np.float_], # noqa: ARG002 - ) -> npt.NDArray[np.float_]: + theta: npt.NDArray[np.float64], # noqa: ARG002 + phi: npt.NDArray[np.float64], # noqa: ARG002 + ) -> npt.NDArray[np.float64]: """Define the function on the grid.""" earth_flm = sleplet._data.create_earth_flm.create_flm( self.L, diff --git a/src/sleplet/functions/spherical_harmonic.py b/src/sleplet/functions/spherical_harmonic.py index 907db76cb..1317251c9 100644 --- a/src/sleplet/functions/spherical_harmonic.py +++ b/src/sleplet/functions/spherical_harmonic.py @@ -23,7 +23,7 @@ class SphericalHarmonic(Flm): def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: ind = ssht.elm2ind(self.ell, self.m) return sleplet.harmonic_methods._create_spherical_harmonic(self.L, ind) diff --git a/src/sleplet/functions/squashed_gaussian.py b/src/sleplet/functions/squashed_gaussian.py index a772810d5..dd99ea891 100644 --- a/src/sleplet/functions/squashed_gaussian.py +++ b/src/sleplet/functions/squashed_gaussian.py @@ -29,7 +29,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet.harmonic_methods._ensure_f_bandlimited( self._grid_fun, self.L, @@ -60,9 +60,9 @@ def _setup_args(self: typing_extensions.Self) -> None: def _grid_fun( self: typing_extensions.Self, - theta: npt.NDArray[np.float_], - phi: npt.NDArray[np.float_], - ) -> npt.NDArray[np.float_]: + theta: npt.NDArray[np.float64], + phi: npt.NDArray[np.float64], + ) -> npt.NDArray[np.float64]: """Define the function on the grid.""" return np.exp( -(((theta - sleplet._vars.THETA_0) / self.t_sigma) ** 2) / 2, diff --git a/src/sleplet/functions/wmap.py b/src/sleplet/functions/wmap.py index aabdbb661..de12286be 100644 --- a/src/sleplet/functions/wmap.py +++ b/src/sleplet/functions/wmap.py @@ -19,7 +19,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: return sleplet._data.create_wmap_flm.create_flm(self.L) def _create_name(self: typing_extensions.Self) -> str: diff --git a/src/sleplet/harmonic_methods.py b/src/sleplet/harmonic_methods.py index fb2741126..dd3aabc1f 100644 --- a/src/sleplet/harmonic_methods.py +++ b/src/sleplet/harmonic_methods.py @@ -19,9 +19,9 @@ _SOUTH_AMERICA_GAMMA = np.deg2rad(63) -def _create_spherical_harmonic(L: int, ind: int) -> npt.NDArray[np.complex_]: +def _create_spherical_harmonic(L: int, ind: int) -> npt.NDArray[np.complex128]: """Create a spherical harmonic in harmonic space for the given index.""" - flm = np.zeros(L**2, dtype=np.complex_) + flm = np.zeros(L**2, dtype=np.complex128) flm[ind] = 1 return flm @@ -35,13 +35,13 @@ def _boost_coefficient_resolution( def invert_flm_boosted( - flm: npt.NDArray[np.complex_], + flm: npt.NDArray[np.complex128], L: int, resolution: int, *, reality: bool = False, spin: int = 0, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """ Upsamples the signal and performs the inverse harmonic transform . @@ -68,14 +68,14 @@ def invert_flm_boosted( def _ensure_f_bandlimited( grid_fun: collections.abc.Callable[ - [npt.NDArray[np.float_], npt.NDArray[np.float_]], - npt.NDArray[np.float_], + [npt.NDArray[np.float64], npt.NDArray[np.float64]], + npt.NDArray[np.float64], ], L: int, *, reality: bool, spin: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ If the function created is created in pixel space rather than harmonic space then need to transform it into harmonic space first before using it. @@ -95,7 +95,7 @@ def _ensure_f_bandlimited( ) -def _create_emm_vector(L: int) -> npt.NDArray[np.float_]: +def _create_emm_vector(L: int) -> npt.NDArray[np.float64]: """Create vector of m values for a given L.""" emm = np.zeros(2 * L * 2 * L) k = 0 @@ -112,7 +112,7 @@ def compute_random_signal( rng: np.random.Generator, *, var_signal: float, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Generate a normally distributed random signal of a complex signal with mean `0` and variance `1`. @@ -132,8 +132,8 @@ def compute_random_signal( def mesh_forward( mesh: "sleplet.meshes.mesh.Mesh", - u: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.float_]: + u: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.float64]: """ Compute the mesh forward transform from pixel space to Fourier space. @@ -157,8 +157,8 @@ def mesh_forward( def mesh_inverse( mesh: "sleplet.meshes.mesh.Mesh", - u_i: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.complex_ | np.float_]: + u_i: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.complex128 | np.float64]: """ Compute the mesh inverse transform from Fourier space to pixel space. @@ -173,9 +173,9 @@ def mesh_inverse( def rotate_earth_to_south_america( - earth_flm: npt.NDArray[np.complex_ | np.float_], + earth_flm: npt.NDArray[np.complex128 | np.float64], L: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Rotates the harmonic coefficients of the Earth to a view centered on South America. @@ -196,9 +196,9 @@ def rotate_earth_to_south_america( def rotate_earth_to_africa( - earth_flm: npt.NDArray[np.complex_ | np.float_], + earth_flm: npt.NDArray[np.complex128 | np.float64], L: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Rotates the harmonic coefficients of the Earth to a view centered on Africa. diff --git a/src/sleplet/meshes/_mesh_slepian_decomposition.py b/src/sleplet/meshes/_mesh_slepian_decomposition.py index baf9c50a2..3809b9f72 100644 --- a/src/sleplet/meshes/_mesh_slepian_decomposition.py +++ b/src/sleplet/meshes/_mesh_slepian_decomposition.py @@ -19,8 +19,8 @@ class MeshSlepianDecomposition: mesh_slepian: MeshSlepian _: dataclasses.KW_ONLY mask: bool = False - u_i: npt.NDArray[np.complex_ | np.float_] | None = None - u: npt.NDArray[np.complex_ | np.float_] | None = None + u_i: npt.NDArray[np.complex128 | np.float64] | None = None + u: npt.NDArray[np.complex128 | np.float64] | None = None _method: str = pydantic.Field(default="", init_var=False, repr=False) def __post_init__(self: typing_extensions.Self) -> None: @@ -44,7 +44,7 @@ def decompose(self: typing_extensions.Self, rank: int) -> float: def decompose_all( self: typing_extensions.Self, n_coefficients: int, - ) -> npt.NDArray[np.float_]: + ) -> npt.NDArray[np.float64]: """Decompose all ranks of the Slepian coefficients.""" coefficients = np.zeros(n_coefficients) for rank in range(n_coefficients): diff --git a/src/sleplet/meshes/mesh.py b/src/sleplet/meshes/mesh.py index 2eaa1be9d..636f829b1 100644 --- a/src/sleplet/meshes/mesh.py +++ b/src/sleplet/meshes/mesh.py @@ -32,17 +32,17 @@ class Mesh: repr=False, ) _colourbar_pos: float = pydantic.Field(default=0, init_var=False, repr=False) - basis_functions: npt.NDArray[np.float_] = pydantic.Field( + basis_functions: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) - faces: npt.NDArray[np.float_] = pydantic.Field( + faces: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) - mesh_eigenvalues: npt.NDArray[np.float_] = pydantic.Field( + mesh_eigenvalues: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -52,7 +52,7 @@ class Mesh: init_var=False, repr=False, ) - vertices: npt.NDArray[np.float_] = pydantic.Field( + vertices: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, diff --git a/src/sleplet/meshes/mesh_basis_functions.py b/src/sleplet/meshes/mesh_basis_functions.py index 5c93477b6..ff3b9b300 100644 --- a/src/sleplet/meshes/mesh_basis_functions.py +++ b/src/sleplet/meshes/mesh_basis_functions.py @@ -27,7 +27,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Compute field on the vertices of the mesh.""" msg = ( f"Mesh eigenvalue {self.rank}: " diff --git a/src/sleplet/meshes/mesh_coefficients.py b/src/sleplet/meshes/mesh_coefficients.py index 3cec06790..6e81451d6 100644 --- a/src/sleplet/meshes/mesh_coefficients.py +++ b/src/sleplet/meshes/mesh_coefficients.py @@ -31,25 +31,25 @@ class MeshCoefficients: region: bool = False """Whether to set a region or not, used in the Slepian case.""" _unnoised_coefficients: ( - npt.NDArray[np.complex_ | np.float_] | None + npt.NDArray[np.complex128 | np.float64] | None ) = pydantic.Field( default=None, init_var=False, repr=False, ) - coefficients: npt.NDArray[np.complex_ | np.float_] = pydantic.Field( + coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) name: str = pydantic.Field(default="", init_var=False, repr=False) snr: float | None = pydantic.Field(default=None, init_var=False, repr=False) - wavelet_coefficients: npt.NDArray[np.complex_ | np.float_] = pydantic.Field( + wavelet_coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) - wavelets: npt.NDArray[np.float_] = pydantic.Field( + wavelets: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -74,14 +74,14 @@ def _add_details_to_name(self: typing_extensions.Self) -> None: @abc.abstractmethod def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise to the signal.""" raise NotImplementedError @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Create the flm on the north pole.""" raise NotImplementedError diff --git a/src/sleplet/meshes/mesh_field.py b/src/sleplet/meshes/mesh_field.py index 508b3c12a..9f747e7d6 100644 --- a/src/sleplet/meshes/mesh_field.py +++ b/src/sleplet/meshes/mesh_field.py @@ -19,7 +19,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Compute field on the vertices of the mesh.""" field = igl.per_vertex_normals(self.mesh.vertices, self.mesh.faces)[:, 1] return sleplet.harmonic_methods.mesh_forward(self.mesh, field) diff --git a/src/sleplet/meshes/mesh_harmonic_coefficients.py b/src/sleplet/meshes/mesh_harmonic_coefficients.py index 8bc276687..6b5482939 100644 --- a/src/sleplet/meshes/mesh_harmonic_coefficients.py +++ b/src/sleplet/meshes/mesh_harmonic_coefficients.py @@ -20,9 +20,9 @@ def __post_init__(self: typing_extensions.Self) -> None: def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise to the signal.""" - self.coefficients: npt.NDArray[np.complex_ | np.float_] + self.coefficients: npt.NDArray[np.complex128 | np.float64] if self.noise is not None: unnoised_coefficients = self.coefficients.copy() nlm = sleplet.noise._create_mesh_noise(self.coefficients, self.noise) @@ -34,7 +34,7 @@ def _add_noise_to_signal( @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: raise NotImplementedError @abc.abstractmethod diff --git a/src/sleplet/meshes/mesh_noise_field.py b/src/sleplet/meshes/mesh_noise_field.py index f79a6021d..039fddfaf 100644 --- a/src/sleplet/meshes/mesh_noise_field.py +++ b/src/sleplet/meshes/mesh_noise_field.py @@ -24,7 +24,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: mf = sleplet.meshes.mesh_slepian.MeshField(self.mesh) noise = sleplet.noise._create_mesh_noise(mf.coefficients, self.SNR) sleplet.noise.compute_snr(mf.coefficients, noise, "Harmonic") diff --git a/src/sleplet/meshes/mesh_slepian.py b/src/sleplet/meshes/mesh_slepian.py index 9b69d11bc..37fd36d4e 100644 --- a/src/sleplet/meshes/mesh_slepian.py +++ b/src/sleplet/meshes/mesh_slepian.py @@ -28,12 +28,12 @@ class MeshSlepian: mesh: Mesh """A mesh object.""" N: int = pydantic.Field(default=0, init_var=False, repr=False) - slepian_eigenvalues: npt.NDArray[np.float_] = pydantic.Field( + slepian_eigenvalues: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, ) - slepian_functions: npt.NDArray[np.float_] = pydantic.Field( + slepian_functions: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -94,7 +94,7 @@ def _compute_slepian_functions_from_scratch( def _create_D_matrix( # noqa: N802 self: typing_extensions.Self, - ) -> npt.NDArray[np.float_]: + ) -> npt.NDArray[np.float64]: """Compute the D matrix for the mesh eigenfunctions.""" D = np.zeros( (self.mesh.mesh_eigenvalues.shape[0], self.mesh.mesh_eigenvalues.shape[0]), @@ -141,7 +141,7 @@ def func(chunk: list[int]) -> None: def _fill_D_elements( # noqa: N802 self: typing_extensions.Self, - D: npt.NDArray[np.float_], + D: npt.NDArray[np.float64], i: int, ) -> None: """Fill in the D matrix elements using symmetries.""" @@ -161,8 +161,8 @@ def _integral(self: typing_extensions.Self, i: int, j: int) -> float: @staticmethod def _clean_evals_and_evecs( - eigendecomposition: tuple[npt.NDArray[np.float_], npt.NDArray[np.float_]], - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.float_]]: + eigendecomposition: tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]], + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: """Need eigenvalues and eigenvectors to be in a certain format.""" # access values eigenvalues, eigenvectors = eigendecomposition diff --git a/src/sleplet/meshes/mesh_slepian_coefficients.py b/src/sleplet/meshes/mesh_slepian_coefficients.py index 39b0f08f6..62f3539de 100644 --- a/src/sleplet/meshes/mesh_slepian_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_coefficients.py @@ -28,9 +28,9 @@ def __post_init__(self: typing_extensions.Self) -> None: def _add_noise_to_signal( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.complex_ | np.float_] | None, float | None]: + ) -> tuple[npt.NDArray[np.complex128 | np.float64] | None, float | None]: """Add Gaussian white noise converted to Slepian space.""" - self.coefficients: npt.NDArray[np.complex_ | np.float_] + self.coefficients: npt.NDArray[np.complex128 | np.float64] if self.noise is not None: unnoised_coefficients = self.coefficients.copy() n_p = sleplet.noise._create_slepian_mesh_noise( @@ -46,7 +46,7 @@ def _add_noise_to_signal( @abc.abstractmethod def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: raise NotImplementedError @abc.abstractmethod diff --git a/src/sleplet/meshes/mesh_slepian_field.py b/src/sleplet/meshes/mesh_slepian_field.py index 659a40e32..ade2d7d21 100644 --- a/src/sleplet/meshes/mesh_slepian_field.py +++ b/src/sleplet/meshes/mesh_slepian_field.py @@ -22,7 +22,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Compute field on the vertices of the mesh.""" mf = sleplet.meshes.mesh_field.MeshField( self.mesh, diff --git a/src/sleplet/meshes/mesh_slepian_functions.py b/src/sleplet/meshes/mesh_slepian_functions.py index 78f9ad705..ebfed3051 100644 --- a/src/sleplet/meshes/mesh_slepian_functions.py +++ b/src/sleplet/meshes/mesh_slepian_functions.py @@ -26,7 +26,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: """Compute field on the vertices of the mesh.""" msg = ( f"Slepian eigenvalue {self.rank}: " diff --git a/src/sleplet/meshes/mesh_slepian_noise_field.py b/src/sleplet/meshes/mesh_slepian_noise_field.py index 693d2402f..d02f726df 100644 --- a/src/sleplet/meshes/mesh_slepian_noise_field.py +++ b/src/sleplet/meshes/mesh_slepian_noise_field.py @@ -27,7 +27,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: smf = sleplet.meshes.mesh_slepian_field.MeshSlepianField( self.mesh, region=True, diff --git a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py index daab80e94..5a6d6b9cf 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py @@ -35,7 +35,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelet coefficients") self.wavelets, self.wavelet_coefficients = self._create_wavelet_coefficients() _logger.info("finish computing wavelet coefficients") @@ -60,7 +60,7 @@ def _setup_args(self: typing_extensions.Self) -> None: def _create_wavelet_coefficients( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_ | np.float_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128 | np.float64]]: """Compute wavelet coefficients in Slepian space.""" smw = sleplet.meshes.mesh_slepian_wavelets.MeshSlepianWavelets( self.mesh, diff --git a/src/sleplet/meshes/mesh_slepian_wavelets.py b/src/sleplet/meshes/mesh_slepian_wavelets.py index 6f24bed6f..13c26dacb 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelets.py +++ b/src/sleplet/meshes/mesh_slepian_wavelets.py @@ -33,7 +33,7 @@ def __post_init__(self: typing_extensions.Self) -> None: def _create_coefficients( self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_ | np.float_]: + ) -> npt.NDArray[np.complex128 | np.float64]: _logger.info("start computing wavelets") self.wavelets = self._create_wavelets() _logger.info("finish computing wavelets") @@ -56,7 +56,7 @@ def _setup_args(self: typing_extensions.Self) -> None: raise ValueError(msg) self.B, self.j_min, self.j = self.extra_args - def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float64]: """Create Slepian wavelets of the mesh.""" return sleplet.wavelet_methods.create_kappas( self.mesh.mesh_eigenvalues.shape[0], diff --git a/src/sleplet/noise.py b/src/sleplet/noise.py index 803330774..deb6742c1 100644 --- a/src/sleplet/noise.py +++ b/src/sleplet/noise.py @@ -15,14 +15,14 @@ _logger = logging.getLogger(__name__) -def _signal_power(signal: npt.NDArray[np.complex_ | np.float_]) -> float: +def _signal_power(signal: npt.NDArray[np.complex128 | np.float64]) -> float: """Compute the power of the signal.""" return (np.abs(signal) ** 2).sum() def compute_snr( - signal: npt.NDArray[np.complex_ | np.float_], - noise: npt.NDArray[np.complex_ | np.float_], + signal: npt.NDArray[np.complex128 | np.float64], + noise: npt.NDArray[np.complex128 | np.float64], signal_type: str, ) -> float: """ @@ -43,7 +43,7 @@ def compute_snr( def compute_sigma_noise( - signal: npt.NDArray[np.complex_ | np.float_], + signal: npt.NDArray[np.complex128 | np.float64], snr_in: float, *, denominator: int | None = None, @@ -66,15 +66,15 @@ def compute_sigma_noise( def _create_noise( L: int, - signal: npt.NDArray[np.complex_ | np.float_], + signal: npt.NDArray[np.complex128 | np.float64], snr_in: float, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Compute Gaussian white noise.""" # set random seed rng = np.random.default_rng(sleplet._vars.RANDOM_SEED) # initialise - nlm = np.zeros(L**2, dtype=np.complex_) + nlm = np.zeros(L**2, dtype=np.complex128) # std dev of the noise sigma_noise = compute_sigma_noise(signal, snr_in) @@ -97,10 +97,10 @@ def _create_noise( def _create_slepian_noise( L: int, - slepian_signal: npt.NDArray[np.complex_ | np.float_], + slepian_signal: npt.NDArray[np.complex128 | np.float64], slepian: SlepianFunctions, snr_in: float, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Compute Gaussian white noise in Slepian space.""" flm = ssht.forward( sleplet.slepian_methods.slepian_inverse(slepian_signal, L, slepian), @@ -112,10 +112,10 @@ def _create_slepian_noise( def _perform_hard_thresholding( - f: npt.NDArray[np.complex_ | np.float_], - sigma_j: float | npt.NDArray[np.float_], + f: npt.NDArray[np.complex128 | np.float64], + sigma_j: float | npt.NDArray[np.float64], n_sigma: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Set pixels in pixel space to zero if the magnitude is less than the threshold.""" threshold = n_sigma * sigma_j return np.where(np.abs(f) < threshold, 0, f) @@ -123,10 +123,10 @@ def _perform_hard_thresholding( def harmonic_hard_thresholding( L: int, - wav_coeffs: npt.NDArray[np.complex_], - sigma_j: npt.NDArray[np.float_], + wav_coeffs: npt.NDArray[np.complex128], + sigma_j: npt.NDArray[np.float64], n_sigma: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: r""" Perform thresholding in harmonic space. @@ -155,11 +155,11 @@ def harmonic_hard_thresholding( def slepian_wavelet_hard_thresholding( L: int, - wav_coeffs: npt.NDArray[np.complex_ | np.float_], - sigma_j: npt.NDArray[np.float_], + wav_coeffs: npt.NDArray[np.complex128 | np.float64], + sigma_j: npt.NDArray[np.float64], n_sigma: int, slepian: SlepianFunctions, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: r""" Perform thresholding in Slepian wavelet space. @@ -189,11 +189,11 @@ def slepian_wavelet_hard_thresholding( def slepian_function_hard_thresholding( L: int, - coefficients: npt.NDArray[np.complex_ | np.float_], + coefficients: npt.NDArray[np.complex128 | np.float64], sigma: float, n_sigma: int, slepian: SlepianFunctions, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: r""" Perform thresholding in Slepian space. @@ -214,10 +214,10 @@ def slepian_function_hard_thresholding( def _compute_sigma_j( - signal: npt.NDArray[np.complex_ | np.float_], - psi_j: npt.NDArray[np.complex_], + signal: npt.NDArray[np.complex128 | np.float64], + psi_j: npt.NDArray[np.complex128], snr_in: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute sigma_j for wavelets used in denoising the signal.""" sigma_noise = compute_sigma_noise(signal, snr_in) wavelet_power = (np.abs(psi_j) ** 2).sum(axis=1) @@ -226,11 +226,11 @@ def _compute_sigma_j( def _compute_slepian_sigma_j( L: int, - signal: npt.NDArray[np.complex_ | np.float_], - psi_j: npt.NDArray[np.float_], + signal: npt.NDArray[np.complex128 | np.float64], + psi_j: npt.NDArray[np.float64], snr_in: float, slepian: SlepianFunctions, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute sigma_j for wavelets used in denoising the signal.""" sigma_noise = compute_sigma_noise(signal, snr_in, denominator=L**2) s_p = sleplet.slepian_methods.compute_s_p_omega(L, slepian) @@ -240,9 +240,9 @@ def _compute_slepian_sigma_j( def _create_mesh_noise( - u_i: npt.NDArray[np.complex_ | np.float_], + u_i: npt.NDArray[np.complex128 | np.float64], snr_in: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute Gaussian white noise.""" # set random seed rng = np.random.default_rng(sleplet._vars.RANDOM_SEED) @@ -261,9 +261,9 @@ def _create_mesh_noise( def _create_slepian_mesh_noise( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", - slepian_signal: npt.NDArray[np.complex_ | np.float_], + slepian_signal: npt.NDArray[np.complex128 | np.float64], snr_in: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Compute Gaussian white noise in Slepian space.""" u_i = sleplet.harmonic_methods.mesh_forward( mesh_slepian.mesh, @@ -281,10 +281,10 @@ def _create_slepian_mesh_noise( def compute_slepian_mesh_sigma_j( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", - signal: npt.NDArray[np.complex_ | np.float_], - psi_j: npt.NDArray[np.float_], + signal: npt.NDArray[np.complex128 | np.float64], + psi_j: npt.NDArray[np.float64], snr_in: float, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: r""" Compute \(\sigma_{j}\) for wavelets used in denoising the signal. @@ -310,10 +310,10 @@ def compute_slepian_mesh_sigma_j( def slepian_mesh_hard_thresholding( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", - wav_coeffs: npt.NDArray[np.complex_ | np.float_], - sigma_j: npt.NDArray[np.float_], + wav_coeffs: npt.NDArray[np.complex128 | np.float64], + sigma_j: npt.NDArray[np.float64], n_sigma: int, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: r""" Perform thresholding in Slepian space of the mesh. diff --git a/src/sleplet/plot_methods.py b/src/sleplet/plot_methods.py index 2123c4d5f..f14332bd7 100644 --- a/src/sleplet/plot_methods.py +++ b/src/sleplet/plot_methods.py @@ -126,9 +126,9 @@ def find_max_amplitude( def _create_plot_type( - field: npt.NDArray[np.complex_ | np.float_], + field: npt.NDArray[np.complex128 | np.float64], plot_type: str, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Get the given plot type of the field.""" msg = f"plotting type: '{plot_type}'" _logger.info(msg) @@ -142,10 +142,10 @@ def _create_plot_type( def _set_outside_region_to_minimum( - f_plot: npt.NDArray[np.float_], + f_plot: npt.NDArray[np.float64], L: int, region: sleplet.slepian.region.Region, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """ For the Slepian region set the outside area to negative infinity hence it is clear we are only interested in the coloured region. @@ -162,10 +162,10 @@ def _set_outside_region_to_minimum( def _normalise_function( - f: npt.NDArray[np.float_], + f: npt.NDArray[np.float64], *, normalise: bool, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Normalise function between 0 and 1 for visualisation.""" if not normalise: return f @@ -177,14 +177,14 @@ def _normalise_function( def _boost_field( # noqa: PLR0913 - field: npt.NDArray[np.complex_ | np.float_], + field: npt.NDArray[np.complex128 | np.float64], L: int, resolution: int, *, reality: bool, spin: int, upsample: bool, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """Inverts and then boosts the field before plotting.""" if not upsample: return field @@ -225,8 +225,8 @@ def compute_amplitude_for_noisy_mesh_plots( def _coefficients_to_field_mesh( f: sleplet.meshes.mesh_coefficients.MeshCoefficients, - coefficients: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.complex_ | np.float_]: + coefficients: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.complex128 | np.float64]: """Compute the field over the whole mesh from the harmonic/Slepian coefficients.""" return ( sleplet.slepian_methods.slepian_mesh_inverse(f.mesh_slepian, coefficients) @@ -256,8 +256,8 @@ def compute_amplitude_for_noisy_sphere_plots( def _coefficients_to_field_sphere( f: sleplet.functions.coefficients.Coefficients, - coefficients: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.complex_ | np.float_]: + coefficients: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.complex128 | np.float64]: """Compute the field over the samples from the harmonic/Slepian coefficients.""" return ( sleplet.slepian_methods.slepian_inverse(coefficients, f.L, f.slepian) diff --git a/src/sleplet/plotting/_create_plot_mesh.py b/src/sleplet/plotting/_create_plot_mesh.py index add1c2b49..2fa348660 100644 --- a/src/sleplet/plotting/_create_plot_mesh.py +++ b/src/sleplet/plotting/_create_plot_mesh.py @@ -32,7 +32,7 @@ class PlotMesh: """The given mesh object.""" filename: str """The output filename of the plot.""" - f: npt.NDArray[np.complex_ | np.float_] + f: npt.NDArray[np.complex128 | np.float64] """The field value sampled on the mesh.""" _: dataclasses.KW_ONLY amplitude: float | None = None @@ -106,8 +106,8 @@ def execute( def _prepare_field( self: typing_extensions.Self, - f: npt.NDArray[np.complex_ | np.float_], - ) -> npt.NDArray[np.float_]: + f: npt.NDArray[np.complex128 | np.float64], + ) -> npt.NDArray[np.float64]: """Scales the field before plotting.""" return sleplet.plot_methods._normalise_function( sleplet._mesh_methods.average_functions_on_vertices_to_faces( @@ -119,8 +119,8 @@ def _prepare_field( def _set_outside_region_to_minimum( self: typing_extensions.Self, - f: npt.NDArray[np.float_], - ) -> npt.NDArray[np.float_]: + f: npt.NDArray[np.float64], + ) -> npt.NDArray[np.float64]: """ For the Slepian region set the outside area to negative infinity hence it is clear we are only interested in the coloured region. diff --git a/src/sleplet/plotting/_create_plot_sphere.py b/src/sleplet/plotting/_create_plot_sphere.py index 24aa697c0..e829c6807 100644 --- a/src/sleplet/plotting/_create_plot_sphere.py +++ b/src/sleplet/plotting/_create_plot_sphere.py @@ -24,7 +24,7 @@ class PlotSphere: """Create surface sphere plot via `plotly`.""" - f: npt.NDArray[np.complex_ | np.float_] + f: npt.NDArray[np.complex128 | np.float64] """The field value sampled on the sphere.""" L: int """The spherical harmonic bandlimit.""" @@ -122,7 +122,7 @@ def execute(self: typing_extensions.Self) -> None: @staticmethod def _setup_plot( # noqa: PLR0913 - f: npt.NDArray[np.float_], + f: npt.NDArray[np.float64], resolution: int, *, method: str = "MW", @@ -131,10 +131,10 @@ def _setup_plot( # noqa: PLR0913 parametric_scaling: list[float] | None = None, color_range: list[float] | None = None, ) -> tuple[ - npt.NDArray[np.float_], - npt.NDArray[np.float_], - npt.NDArray[np.float_], - npt.NDArray[np.float_], + npt.NDArray[np.float64], + npt.NDArray[np.float64], + npt.NDArray[np.float64], + npt.NDArray[np.float64], float, float, ]: @@ -196,8 +196,8 @@ def _setup_plot( # noqa: PLR0913 def _prepare_field( self: typing_extensions.Self, - f: npt.NDArray[np.complex_ | np.float_], - ) -> npt.NDArray[np.float_]: + f: npt.NDArray[np.complex128 | np.float64], + ) -> npt.NDArray[np.float64]: """Boosts, forces plot type and then scales the field before plotting.""" boosted_field = sleplet.plot_methods._boost_field( f, diff --git a/src/sleplet/slepian/_slepian_decomposition.py b/src/sleplet/slepian/_slepian_decomposition.py index 9f909e4e6..ee14ed4c3 100644 --- a/src/sleplet/slepian/_slepian_decomposition.py +++ b/src/sleplet/slepian/_slepian_decomposition.py @@ -21,9 +21,9 @@ class SlepianDecomposition: L: int slepian: SlepianFunctions _: dataclasses.KW_ONLY - f: npt.NDArray[np.complex_] | None = None - flm: npt.NDArray[np.complex_ | np.float_] | None = None - mask: npt.NDArray[np.float_] | None = None + f: npt.NDArray[np.complex128] | None = None + flm: npt.NDArray[np.complex128 | np.float64] | None = None + mask: npt.NDArray[np.float64] | None = None _method: str = pydantic.Field(default="", init_var=False, repr=False) def __post_init__(self: typing_extensions.Self) -> None: @@ -47,9 +47,9 @@ def decompose(self: typing_extensions.Self, rank: int) -> complex: def decompose_all( self: typing_extensions.Self, n_coefficients: int, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: """Decompose all ranks of the Slepian coefficients.""" - coefficients = np.zeros(n_coefficients, dtype=np.complex_) + coefficients = np.zeros(n_coefficients, dtype=np.complex128) for rank in range(n_coefficients): coefficients[rank] = self.decompose(rank) return coefficients diff --git a/src/sleplet/slepian/slepian_arbitrary.py b/src/sleplet/slepian/slepian_arbitrary.py index 741861ba9..e819f0a5d 100644 --- a/src/sleplet/slepian/slepian_arbitrary.py +++ b/src/sleplet/slepian/slepian_arbitrary.py @@ -34,7 +34,7 @@ class SlepianArbitrary(SlepianFunctions): mask_name: str """The name of the mask of the arbitrary region.""" - _weight: npt.NDArray[np.float_] = pydantic.Field( + _weight: npt.NDArray[np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), init_var=False, repr=False, @@ -50,7 +50,7 @@ def _create_fn_name(self: typing_extensions.Self) -> str: def _create_region(self: typing_extensions.Self) -> "sleplet.slepian.region.Region": return sleplet.slepian.region.Region(mask_name=self.mask_name) - def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float64]: return sleplet._mask_methods.create_mask_region(self._resolution, self.region) def _calculate_area(self: typing_extensions.Self) -> float: @@ -64,7 +64,7 @@ def _create_matrix_location(self: typing_extensions.Self) -> str: def _solve_eigenproblem( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: eval_loc = f"{self.matrix_location}_eigenvalues.npy" evec_loc = f"{self.matrix_location}_eigenvectors.npy" @@ -83,7 +83,7 @@ def _solve_D_matrix( # noqa: N802 self: typing_extensions.Self, eval_loc: str, evec_loc: str, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: D = self._create_D_matrix() # fill in remaining triangle section @@ -100,10 +100,10 @@ def _solve_D_matrix( # noqa: N802 def _create_D_matrix( # noqa: N802 self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: """Compute the D matrix in parallel.""" # create dictionary for the integrals - self._fields: dict[int, npt.NDArray[np.complex_ | np.float_]] = {} + self._fields: dict[int, npt.NDArray[np.complex128 | np.float64]] = {} # initialise real and imaginary matrices D_r = np.zeros((self.L**2, self.L**2)) @@ -155,8 +155,8 @@ def func(chunk: list[int]) -> None: def _matrix_helper( self: typing_extensions.Self, - D_r: npt.NDArray[np.float_], - D_i: npt.NDArray[np.float_], + D_r: npt.NDArray[np.float64], + D_i: npt.NDArray[np.float64], i: int, ) -> None: """ diff --git a/src/sleplet/slepian/slepian_functions.py b/src/sleplet/slepian/slepian_functions.py index 5d791374b..36131f26c 100644 --- a/src/sleplet/slepian/slepian_functions.py +++ b/src/sleplet/slepian/slepian_functions.py @@ -20,17 +20,17 @@ class SlepianFunctions: L: int """The spherical harmonic bandlimit.""" - eigenvalues: npt.NDArray[np.float_] = dataclasses.field( + eigenvalues: npt.NDArray[np.float64] = dataclasses.field( default_factory=lambda: np.empty(0), kw_only=True, repr=True, ) - eigenvectors: npt.NDArray[np.complex_] = dataclasses.field( - default_factory=lambda: np.empty(0, dtype=np.complex_), + eigenvectors: npt.NDArray[np.complex128] = dataclasses.field( + default_factory=lambda: np.empty(0, dtype=np.complex128), kw_only=True, repr=True, ) - mask: npt.NDArray[np.float_] = dataclasses.field( + mask: npt.NDArray[np.float64] = dataclasses.field( default_factory=lambda: np.empty(0), kw_only=True, repr=False, @@ -73,7 +73,7 @@ def _create_region(self: typing_extensions.Self) -> "sleplet.slepian.region.Regi raise NotImplementedError @abc.abstractmethod - def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float64]: """Create a mask of the region of interest.""" raise NotImplementedError @@ -90,6 +90,6 @@ def _create_matrix_location(self: typing_extensions.Self) -> str: @abc.abstractmethod def _solve_eigenproblem( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Solve the eigenproblem for the given function.""" raise NotImplementedError diff --git a/src/sleplet/slepian/slepian_limit_lat_lon.py b/src/sleplet/slepian/slepian_limit_lat_lon.py index b54652734..654a67ad4 100644 --- a/src/sleplet/slepian/slepian_limit_lat_lon.py +++ b/src/sleplet/slepian/slepian_limit_lat_lon.py @@ -46,7 +46,7 @@ def _create_region(self: typing_extensions.Self) -> "sleplet.slepian.region.Regi phi_max=self.phi_max, ) - def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float64]: return sleplet._mask_methods.create_mask_region(self.L, self.region) def _calculate_area(self: typing_extensions.Self) -> float: @@ -61,7 +61,7 @@ def _create_matrix_location(self: typing_extensions.Self) -> str: def _solve_eigenproblem( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: eval_loc = f"{self.matrix_location}_eigenvalues.npy" evec_loc = f"{self.matrix_location}_eigenvectors.npy" try: @@ -80,7 +80,7 @@ def _solve_eigenproblem( def _create_K_matrix( # noqa: N802 self: typing_extensions.Self, - ) -> npt.NDArray[np.complex_]: + ) -> npt.NDArray[np.complex128]: """Compute the K matrix.""" # Compute sub-integral matrix G = self._slepian_integral() @@ -92,7 +92,7 @@ def _create_K_matrix( # noqa: N802 return K - def _slepian_integral(self: typing_extensions.Self) -> npt.NDArray[np.complex_]: + def _slepian_integral(self: typing_extensions.Self) -> npt.NDArray[np.complex128]: """ Syntax: G = _slepian_integral(). @@ -109,7 +109,7 @@ def _slepian_integral(self: typing_extensions.Self) -> npt.NDArray[np.complex_]: colatitude-longitude spatial region" by A. P. Bates, Z. Khalid and R. A. Kennedy. """ - G = np.zeros((4 * self.L - 3, 4 * self.L - 3), dtype=np.complex_) + G = np.zeros((4 * self.L - 3, 4 * self.L - 3), dtype=np.complex128) def helper(row: int, col: int, S: float) -> None: """Use conjugate symmetry property to reduce the number of iterations.""" @@ -151,11 +151,11 @@ def helper(row: int, col: int, S: float) -> None: @staticmethod @numba.njit(parallel=True, fastmath=True) def _slepian_matrix( - dl: npt.NDArray[np.float_], + dl: npt.NDArray[np.float64], L: int, N: int, - G: npt.NDArray[np.complex_], - ) -> npt.NDArray[np.complex_]: + G: npt.NDArray[np.complex128], + ) -> npt.NDArray[np.complex128]: """ Syntax: K = _slepian_matrix(dl, L, N, G). @@ -173,7 +173,7 @@ def _slepian_matrix( Analytical formulation for limited colatitude-longitude spatial region" by A. P. Bates, Z. Khalid and R. A. Kennedy. """ - K = np.zeros((L**2, L**2), dtype=np.complex_) + K = np.zeros((L**2, L**2), dtype=np.complex128) for ell in numba.prange(L): for p in range(ell + 1): @@ -205,8 +205,10 @@ def _slepian_matrix( @staticmethod def _clean_evals_and_evecs( - eigendecomposition: tuple[npt.NDArray[np.complex_], npt.NDArray[np.complex_]], - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + eigendecomposition: tuple[ + npt.NDArray[np.complex128], npt.NDArray[np.complex128] + ], + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Need eigenvalues and eigenvectors to be in a certain format.""" # access values eigenvalues_complex, eigenvectors = eigendecomposition diff --git a/src/sleplet/slepian/slepian_polar_cap.py b/src/sleplet/slepian/slepian_polar_cap.py index 9603aeafd..7a2b4887a 100644 --- a/src/sleplet/slepian/slepian_polar_cap.py +++ b/src/sleplet/slepian/slepian_polar_cap.py @@ -52,7 +52,7 @@ def _create_fn_name(self: typing_extensions.Self) -> str: def _create_region(self: typing_extensions.Self) -> "sleplet.slepian.region.Region": return sleplet.slepian.region.Region(gap=self.gap, theta_max=self.theta_max) - def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float_]: + def _create_mask(self: typing_extensions.Self) -> npt.NDArray[np.float64]: return sleplet._mask_methods.create_mask_region(self.L, self.region) def _calculate_area(self: typing_extensions.Self) -> float: @@ -65,7 +65,7 @@ def _create_matrix_location(self: typing_extensions.Self) -> str: def _solve_eigenproblem( self: typing_extensions.Self, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: eval_loc = f"{self.matrix_location}_eigenvalues.npy" evec_loc = f"{self.matrix_location}_eigenvectors.npy" order_loc = f"{self.matrix_location}_orders.npy" @@ -88,7 +88,7 @@ def _solve_eigenproblem_from_files( eval_loc: str, evec_loc: str, order_loc: str, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Solve eigenproblem with files already saved.""" eigenvalues = np.load( sleplet._data.setup_pooch.find_on_pooch_then_local(eval_loc), @@ -109,13 +109,13 @@ def _solve_eigenproblem_from_scratch( eval_loc: str, evec_loc: str, order_loc: str, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Solve eigenproblem from scratch and then saves the files.""" if isinstance(self.order, int): return self._solve_eigenproblem_order(self.order) evals_all = np.empty(0) - evecs_all = np.empty((0, self.L**2), dtype=np.complex_) + evecs_all = np.empty((0, self.L**2), dtype=np.complex128) emm = np.empty(0, dtype=int) for m in range(-(self.L - 1), self.L): evals_m, evecs_m = self._solve_eigenproblem_order(m) @@ -136,7 +136,7 @@ def _solve_eigenproblem_from_scratch( def _solve_eigenproblem_order( self: typing_extensions.Self, m: int, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Solve the eigenproblem for a given order m.""" emm = sleplet.harmonic_methods._create_emm_vector(self.L) Dm = self._create_Dm_matrix(abs(m), emm) @@ -146,10 +146,12 @@ def _solve_eigenproblem_order( def _sort_all_evals_and_evecs( self: typing_extensions.Self, - eigenvalues: npt.NDArray[np.float_], - eigenvectors: npt.NDArray[np.complex_], + eigenvalues: npt.NDArray[np.float64], + eigenvectors: npt.NDArray[np.complex128], orders: npt.NDArray[np.int_], - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_], npt.NDArray[np.int_]]: + ) -> tuple[ + npt.NDArray[np.float64], npt.NDArray[np.complex128], npt.NDArray[np.int_] + ]: """Sort all eigenvalues and eigenvectors for all orders.""" idx = eigenvalues.argsort()[::-1] eigenvalues = eigenvalues[idx] @@ -160,8 +162,8 @@ def _sort_all_evals_and_evecs( def _create_Dm_matrix( # noqa: N802 self: typing_extensions.Self, m: int, - emm: npt.NDArray[np.float_], - ) -> npt.NDArray[np.float_]: + emm: npt.NDArray[np.float64], + ) -> npt.NDArray[np.float64]: """ Syntax: Dm = _create_Dm_matrix(m, P). @@ -225,8 +227,8 @@ def func(chunk: list[int]) -> None: def _create_legendre_polynomials_table( self: typing_extensions.Self, - emm: npt.NDArray[np.float_], - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.int_]]: + emm: npt.NDArray[np.float64], + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.int_]]: """Create Legendre polynomials table for matrix calculation.""" Plm = ssht.create_ylm(self.theta_max, 0, 2 * self.L).real.reshape(-1) ind = emm == 0 @@ -236,11 +238,11 @@ def _create_legendre_polynomials_table( def _dm_matrix_helper( # noqa: PLR0913 self: typing_extensions.Self, - Dm: npt.NDArray[np.float_], + Dm: npt.NDArray[np.float64], i: int, m: int, lvec: npt.NDArray[np.int_], - Pl: npt.NDArray[np.float_], + Pl: npt.NDArray[np.float64], ell: npt.NDArray[np.int_], ) -> None: """Use in both serial and parallel calculations.""" @@ -368,11 +370,11 @@ def _polar_gap_modification( def _clean_evals_and_evecs( self: typing_extensions.Self, - eigenvalues: npt.NDArray[np.float_], - gl: npt.NDArray[np.float_], - emm: npt.NDArray[np.float_], + eigenvalues: npt.NDArray[np.float64], + gl: npt.NDArray[np.float64], + emm: npt.NDArray[np.float64], m: int, - ) -> tuple[npt.NDArray[np.float_], npt.NDArray[np.complex_]]: + ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex128]]: """Need eigenvalues and eigenvectors to be in a certain format.""" # Sort eigenvalues and eigenvectors in descending order of eigenvalues idx = eigenvalues.argsort()[::-1] @@ -382,7 +384,7 @@ def _clean_evals_and_evecs( # put back in full D space for harmonic transform emm = emm[: self.L**2] ind = np.tile(emm == m, (self.L - abs(m), 1)) - eigenvectors = np.zeros((self.L - abs(m), self.L**2), dtype=np.complex_) + eigenvectors = np.zeros((self.L - abs(m), self.L**2), dtype=np.complex128) eigenvectors[ind] = gl.T.flatten() # ensure first element of each eigenvector is positive diff --git a/src/sleplet/slepian_methods.py b/src/sleplet/slepian_methods.py index e9682f45a..284f58ab1 100644 --- a/src/sleplet/slepian_methods.py +++ b/src/sleplet/slepian_methods.py @@ -69,10 +69,10 @@ def choose_slepian_method( def slepian_inverse( - f_p: npt.NDArray[np.complex_ | np.float_], + f_p: npt.NDArray[np.complex128 | np.float64], L: int, slepian: SlepianFunctions, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Compute the Slepian inverse transform up to the Shannon number. @@ -93,11 +93,11 @@ def slepian_forward( # noqa: PLR0913 L: int, slepian: SlepianFunctions, *, - f: npt.NDArray[np.complex_] | None = None, - flm: npt.NDArray[np.complex_ | np.float_] | None = None, - mask: npt.NDArray[np.float_] | None = None, + f: npt.NDArray[np.complex128] | None = None, + flm: npt.NDArray[np.complex128 | np.float64] | None = None, + mask: npt.NDArray[np.float64] | None = None, n_coeffs: int | None = None, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """ Compute the Slepian forward transform for all coefficients. @@ -126,7 +126,7 @@ def slepian_forward( # noqa: PLR0913 def compute_s_p_omega( L: int, slepian: SlepianFunctions, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: r""" Compute \(S_{p}(\omega)\) for a given region. @@ -138,7 +138,7 @@ def compute_s_p_omega( The complex \(S_{p}(\omega)\) values. """ n_theta, n_phi = ssht.sample_shape(L, Method=sleplet._vars.SAMPLING_SCHEME) - sp = np.zeros((slepian.N, n_theta, n_phi), dtype=np.complex_) + sp = np.zeros((slepian.N, n_theta, n_phi), dtype=np.complex128) for p in range(slepian.N): if p % L == 0: msg = f"compute Sp(omega) p={p+1}/{slepian.N}" @@ -156,7 +156,7 @@ def _compute_s_p_omega_prime( alpha: float, beta: float, slepian: SlepianFunctions, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Pick out the desired angle from Sp(omega).""" sp_omega = compute_s_p_omega(L, slepian) p = ssht.theta_to_index(beta, L, Method=sleplet._vars.SAMPLING_SCHEME) @@ -170,11 +170,11 @@ def _compute_s_p_omega_prime( def slepian_mesh_forward( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", *, - u: npt.NDArray[np.complex_ | np.float_] | None = None, - u_i: npt.NDArray[np.complex_ | np.float_] | None = None, + u: npt.NDArray[np.complex128 | np.float64] | None = None, + u_i: npt.NDArray[np.complex128 | np.float64] | None = None, mask: bool = False, n_coeffs: int | None = None, -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """ Compute the Slepian forward transform for all coefficients on the mesh. @@ -200,8 +200,8 @@ def slepian_mesh_forward( def slepian_mesh_inverse( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", - f_p: npt.NDArray[np.complex_ | np.float_], -) -> npt.NDArray[np.complex_ | np.float_]: + f_p: npt.NDArray[np.complex128 | np.float64], +) -> npt.NDArray[np.complex128 | np.float64]: """ Compute the Slepian inverse transform on the mesh up to the Shannon number. @@ -219,7 +219,7 @@ def slepian_mesh_inverse( def _compute_mesh_s_p_pixel( mesh_slepian: "sleplet.meshes.mesh_slepian.MeshSlepian", -) -> npt.NDArray[np.float_]: +) -> npt.NDArray[np.float64]: """Calculate Sp(omega) for a given region.""" sp = np.zeros((mesh_slepian.N, mesh_slepian.mesh.vertices.shape[0])) for p in range(mesh_slepian.N): diff --git a/src/sleplet/wavelet_methods.py b/src/sleplet/wavelet_methods.py index 4d7101702..90b349852 100644 --- a/src/sleplet/wavelet_methods.py +++ b/src/sleplet/wavelet_methods.py @@ -10,10 +10,10 @@ def slepian_wavelet_forward( - f_p: npt.NDArray[np.complex_ | np.float_], - wavelets: npt.NDArray[np.float_], + f_p: npt.NDArray[np.complex128 | np.float64], + wavelets: npt.NDArray[np.float64], shannon: int, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """ Compute the coefficients of the given tiling function in Slepian space. @@ -36,10 +36,10 @@ def slepian_wavelet_forward( def slepian_wavelet_inverse( - wav_coeffs: npt.NDArray[np.complex_ | np.float_], - wavelets: npt.NDArray[np.float_], + wav_coeffs: npt.NDArray[np.complex128 | np.float64], + wavelets: npt.NDArray[np.float64], shannon: int, -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """ Compute the inverse wavelet transform in Slepian space. @@ -63,9 +63,9 @@ def slepian_wavelet_inverse( def axisymmetric_wavelet_forward( L: int, - flm: npt.NDArray[np.complex_ | np.float_], - wavelets: npt.NDArray[np.complex_], -) -> npt.NDArray[np.complex_]: + flm: npt.NDArray[np.complex128 | np.float64], + wavelets: npt.NDArray[np.complex128], +) -> npt.NDArray[np.complex128]: """ Compute the coefficients of the axisymmetric wavelets. @@ -77,7 +77,7 @@ def axisymmetric_wavelet_forward( Returns: Axisymmetric wavelets coefficients. """ - w = np.zeros(wavelets.shape, dtype=np.complex_) + w = np.zeros(wavelets.shape, dtype=np.complex128) for ell in range(L): ind_m0 = ssht.elm2ind(ell, 0) wav_0 = np.sqrt((4 * np.pi) / (2 * ell + 1)) * wavelets[:, ind_m0].conj() @@ -89,9 +89,9 @@ def axisymmetric_wavelet_forward( def axisymmetric_wavelet_inverse( L: int, - wav_coeffs: npt.NDArray[np.complex_], - wavelets: npt.NDArray[np.complex_], -) -> npt.NDArray[np.complex_]: + wav_coeffs: npt.NDArray[np.complex128], + wavelets: npt.NDArray[np.complex128], +) -> npt.NDArray[np.complex128]: """ Compute the inverse axisymmetric wavelet transform. @@ -103,7 +103,7 @@ def axisymmetric_wavelet_inverse( Returns: Spherical harmonic coefficients of the signal. """ - flm = np.zeros(L**2, dtype=np.complex_) + flm = np.zeros(L**2, dtype=np.complex128) for ell in range(L): ind_m0 = ssht.elm2ind(ell, 0) wav_0 = np.sqrt((4 * np.pi) / (2 * ell + 1)) * wavelets[:, ind_m0] @@ -117,10 +117,10 @@ def _create_axisymmetric_wavelets( L: int, B: int, j_min: int, -) -> npt.NDArray[np.complex_]: +) -> npt.NDArray[np.complex128]: """Compute the axisymmetric wavelets.""" kappas = create_kappas(L, B, j_min) - wavelets = np.zeros((kappas.shape[0], L**2), dtype=np.complex_) + wavelets = np.zeros((kappas.shape[0], L**2), dtype=np.complex128) for ell in range(L): factor = np.sqrt((2 * ell + 1) / (4 * np.pi)) ind = ssht.elm2ind(ell, 0) @@ -128,7 +128,7 @@ def _create_axisymmetric_wavelets( return wavelets -def create_kappas(xlim: int, B: int, j_min: int) -> npt.NDArray[np.float_]: +def create_kappas(xlim: int, B: int, j_min: int) -> npt.NDArray[np.float64]: r""" Compute the Slepian wavelets. @@ -145,10 +145,10 @@ def create_kappas(xlim: int, B: int, j_min: int) -> npt.NDArray[np.float_]: def find_non_zero_wavelet_coefficients( - wav_coeffs: npt.NDArray[np.complex_ | np.float_], + wav_coeffs: npt.NDArray[np.complex128 | np.float64], *, axis: int | tuple[int, ...], -) -> npt.NDArray[np.complex_ | np.float_]: +) -> npt.NDArray[np.complex128 | np.float64]: """ Find the coefficients within the shannon number to speed up computations. diff --git a/tests/conftest.py b/tests/conftest.py index 06c8cfc88..d64384e34 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -111,7 +111,7 @@ def slepian_wavelets_lim_lat_lon( @pytest.fixture(scope="session") -def random_flm() -> npt.NDArray[np.complex_]: +def random_flm() -> npt.NDArray[np.complex128]: """Create random flm.""" return sleplet.harmonic_methods.compute_random_signal(L, RNG, var_signal=1) diff --git a/tests/test_harmonic.py b/tests/test_harmonic.py index 5dceb0a04..60519edb3 100644 --- a/tests/test_harmonic.py +++ b/tests/test_harmonic.py @@ -9,7 +9,7 @@ L_SMALL = 16 -def test_harmonic_coefficients_padded(random_flm: npt.NDArray[np.complex_]) -> None: +def test_harmonic_coefficients_padded(random_flm: npt.NDArray[np.complex128]) -> None: """Test that harmonic coefficients are zero padded for plotting.""" boost = L_LARGE**2 - L_SMALL**2 flm_boosted = sleplet.harmonic_methods._boost_coefficient_resolution( @@ -19,7 +19,7 @@ def test_harmonic_coefficients_padded(random_flm: npt.NDArray[np.complex_]) -> N np.testing.assert_equal(len(flm_boosted), L_LARGE**2) -def test_invert_flm_and_boost(random_flm: npt.NDArray[np.complex_]) -> None: +def test_invert_flm_and_boost(random_flm: npt.NDArray[np.complex128]) -> None: """Test that the flm has been boosted and has right shape.""" n_theta, n_phi = ssht.sample_shape(L_LARGE, Method=sleplet._vars.SAMPLING_SCHEME) f = sleplet.harmonic_methods.invert_flm_boosted(random_flm, L_SMALL, L_LARGE) From 73cdf605a962070726889ec735fb1b5696a10c01 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Fri, 16 Feb 2024 16:29:24 +0000 Subject: [PATCH 04/13] Bump hooks (#355) --- .github/workflows/deploy.yml | 3 +-- .github/workflows/documentation.yml | 1 - .github/workflows/examples.yml | 3 +-- .github/workflows/licence.yml | 3 +-- .github/workflows/linting.yml | 3 +-- .github/workflows/paper.yml | 3 +-- .github/workflows/test.yml | 8 +++----- .pre-commit-config.yaml | 2 +- 8 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 27c9560c0..6366df006 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,10 @@ --- name: Deploy -# yamllint disable-line rule:truthy on: push: tags: - - "v*" + - v* jobs: deploy: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 48d9d2572..5b2e3d10b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,7 +1,6 @@ --- name: Documentation -# yamllint disable-line rule:truthy on: push: branches: diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 79bf77cc6..0f8d85c72 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,12 +1,11 @@ --- name: Examples -# yamllint disable-line rule:truthy on: push: branches: - main - - "renovate/**" + - renovate/** pull_request: concurrency: diff --git a/.github/workflows/licence.yml b/.github/workflows/licence.yml index 7e8afacf6..885d0e801 100644 --- a/.github/workflows/licence.yml +++ b/.github/workflows/licence.yml @@ -1,10 +1,9 @@ --- name: Update Copyright -# yamllint disable-line rule:truthy on: schedule: - - cron: "0 3 1 1 *" + - cron: 0 3 1 1 * jobs: update-licence-year: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 49a38ec1b..49204204e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,12 +1,11 @@ --- name: Linting -# yamllint disable-line rule:truthy on: push: branches: - main - - "renovate/**" + - renovate/** pull_request: jobs: diff --git a/.github/workflows/paper.yml b/.github/workflows/paper.yml index 5678f58b5..cfb78a924 100644 --- a/.github/workflows/paper.yml +++ b/.github/workflows/paper.yml @@ -1,14 +1,13 @@ --- name: Paper -# yamllint disable-line rule:truthy on: push: branches: - main pull_request: paths: - - "paper/**" + - paper/** jobs: paper: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9727555df..44ca63e47 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,11 @@ --- name: Test -# yamllint disable-line rule:truthy on: push: branches: - main - - "renovate/**" + - renovate/** pull_request: jobs: @@ -50,9 +49,8 @@ jobs: uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2 with: parallel-finished: true - carryforward: "\ + carryforward: \ run-macos-latest-3.10,\ run-ubuntu-latest-3.10,\ run-macos-latest-3.11,\ - run-ubuntu-latest-3.11\ - " + run-ubuntu-latest-3.11 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20b3a6164..f558ed1c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/paddyroddy/.github - rev: v0.134.0 + rev: v0.136.0 hooks: - id: general-hooks - id: python-hooks From cfdcf6fdf46549659f467e747fc510997091a49c Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Mon, 19 Feb 2024 21:15:08 +0000 Subject: [PATCH 05/13] Test with `uv` (#356) https://astral.sh/blog/uv --- .github/workflows/test.yml | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44ca63e47..7f562941e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - "3.11" steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/tox@5db0473ebf89b7132850d118505c172be8022f97 # v0 + - uses: paddyroddy/.github/actions/python/tox@2f931cd39ffb05f8f3a290179864e17ecd0845e4 # v0 with: cache-path: |- .tox diff --git a/pyproject.toml b/pyproject.toml index 1562c9421..0432c329a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,7 @@ optional-dependencies = {dev = [ "pytest", "ruff", "tox", + "tox-uv", "tuna", "twine", ], docs = [ From 179ca9d64acfd1902cd5b4202b5948168ebb8568 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:56:52 +0000 Subject: [PATCH 06/13] Renovate: actions/cache to ab5e6d0 (#357) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://togithub.com/actions/cache) | action | digest | `13aacd8` -> `ab5e6d0` | --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/astro-informatics/sleplet). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 0f8d85c72..723633e95 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -28,7 +28,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Cache pooch - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4 + uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 with: path: ~/.cache/sleplet key: readme-${{ hashFiles('pyproject.toml') }} @@ -53,7 +53,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Cache pooch - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4 + uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 with: path: ~/.cache/sleplet key: examples-${{ hashFiles('pyproject.toml') }} From 96fb91b47d7134a657f7e82177ab574bef4b3153 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:06:40 +0000 Subject: [PATCH 07/13] Renovate: paddyroddy/.github (minor) (#358) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [paddyroddy/.github](https://togithub.com/paddyroddy/.github) | repository | minor | `v0.136.0` -> `v0.146.0` | | [paddyroddy/.github](https://togithub.com/paddyroddy/.github) | action | digest | `2f931cd` -> `512a88e` | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://togithub.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes
paddyroddy/.github (paddyroddy/.github) ### [`v0.146.0`](https://togithub.com/paddyroddy/.github/compare/v0.145.0...v0.146.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.145.0...v0.146.0) ### [`v0.145.0`](https://togithub.com/paddyroddy/.github/compare/v0.144.0...v0.145.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.144.0...v0.145.0) ### [`v0.144.0`](https://togithub.com/paddyroddy/.github/compare/v0.143.0...v0.144.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.143.0...v0.144.0) ### [`v0.143.0`](https://togithub.com/paddyroddy/.github/compare/v0.142.0...v0.143.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.142.0...v0.143.0) ### [`v0.142.0`](https://togithub.com/paddyroddy/.github/compare/v0.141.0...v0.142.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.141.0...v0.142.0) ### [`v0.141.0`](https://togithub.com/paddyroddy/.github/compare/v0.140.0...v0.141.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.140.0...v0.141.0) ### [`v0.140.0`](https://togithub.com/paddyroddy/.github/compare/v0.139.0...v0.140.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.139.0...v0.140.0) ### [`v0.139.0`](https://togithub.com/paddyroddy/.github/compare/v0.138.0...v0.139.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.138.0...v0.139.0) ### [`v0.138.0`](https://togithub.com/paddyroddy/.github/compare/v0.137.0...v0.138.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.137.0...v0.138.0) ### [`v0.137.0`](https://togithub.com/paddyroddy/.github/compare/v0.136.0...v0.137.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.136.0...v0.137.0)
--- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/astro-informatics/sleplet). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/deploy.yml | 2 +- .github/workflows/documentation.yml | 2 +- .github/workflows/licence.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6366df006..ae30d739f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: id-token: write steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/deployment@5db0473ebf89b7132850d118505c172be8022f97 # v0 + - uses: paddyroddy/.github/actions/python/deployment@512a88ef0d35d185588d460030660a184fc2db36 # v0 with: pyproject-toml: ./pyproject.toml python-version: "3.11" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 5b2e3d10b..68c2ffc62 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/pdoc@5db0473ebf89b7132850d118505c172be8022f97 # v0 + - uses: paddyroddy/.github/actions/python/pdoc@512a88ef0d35d185588d460030660a184fc2db36 # v0 with: docs-dependency-section: .[docs] gh-pages-publish-directory: ./html/sleplet diff --git a/.github/workflows/licence.yml b/.github/workflows/licence.yml index 885d0e801..085190e19 100644 --- a/.github/workflows/licence.yml +++ b/.github/workflows/licence.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/licence@5db0473ebf89b7132850d118505c172be8022f97 # v0 + - uses: paddyroddy/.github/actions/licence@512a88ef0d35d185588d460030660a184fc2db36 # v0 with: github-token: ${{ secrets.GITHUB_TOKEN }} licence-file: ./LICENCE.txt diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 49204204e..af8dc775c 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -13,6 +13,6 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/linting@5db0473ebf89b7132850d118505c172be8022f97 # v0 + - uses: paddyroddy/.github/actions/linting@512a88ef0d35d185588d460030660a184fc2db36 # v0 with: pre-commit-config: ./.pre-commit-config.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f562941e..d214ea4ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - "3.11" steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/tox@2f931cd39ffb05f8f3a290179864e17ecd0845e4 # v0 + - uses: paddyroddy/.github/actions/python/tox@512a88ef0d35d185588d460030660a184fc2db36 # v0 with: cache-path: |- .tox diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f558ed1c6..4f7d239a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/paddyroddy/.github - rev: v0.136.0 + rev: v0.146.0 hooks: - id: general-hooks - id: python-hooks From 7aadfbd66e80f0d0d86f113ee48c92d4b15a17c8 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Tue, 5 Mar 2024 17:16:30 +0000 Subject: [PATCH 08/13] Force bump `pre-commit` hooks (#359) --- .pre-commit-config.yaml | 2 +- src/sleplet/_string_methods.py | 2 +- src/sleplet/functions/africa.py | 1 + .../axisymmetric_wavelet_coefficients_africa.py | 1 + .../axisymmetric_wavelet_coefficients_earth.py | 1 + ...isymmetric_wavelet_coefficients_south_america.py | 1 + src/sleplet/functions/axisymmetric_wavelets.py | 1 + src/sleplet/functions/coefficients.py | 13 +++++++------ src/sleplet/functions/dirac_delta.py | 1 + src/sleplet/functions/earth.py | 1 + src/sleplet/functions/elongated_gaussian.py | 1 + src/sleplet/functions/flm.py | 1 + src/sleplet/functions/fp.py | 1 + src/sleplet/functions/gaussian.py | 1 + src/sleplet/functions/harmonic_gaussian.py | 1 + src/sleplet/functions/identity.py | 1 + src/sleplet/functions/noise_earth.py | 1 + src/sleplet/functions/ridgelets.py | 1 + src/sleplet/functions/slepian.py | 1 + src/sleplet/functions/slepian_africa.py | 1 + src/sleplet/functions/slepian_dirac_delta.py | 1 + src/sleplet/functions/slepian_identity.py | 1 + src/sleplet/functions/slepian_noise_africa.py | 1 + .../functions/slepian_noise_south_america.py | 1 + src/sleplet/functions/slepian_south_america.py | 1 + .../slepian_wavelet_coefficients_africa.py | 1 + .../slepian_wavelet_coefficients_south_america.py | 1 + src/sleplet/functions/slepian_wavelets.py | 1 + src/sleplet/functions/south_america.py | 1 + src/sleplet/functions/spherical_harmonic.py | 1 + src/sleplet/functions/squashed_gaussian.py | 1 + src/sleplet/functions/wmap.py | 1 + src/sleplet/harmonic_methods.py | 1 + src/sleplet/meshes/mesh.py | 1 + src/sleplet/meshes/mesh_basis_functions.py | 1 + src/sleplet/meshes/mesh_coefficients.py | 13 +++++++------ src/sleplet/meshes/mesh_field.py | 1 + src/sleplet/meshes/mesh_harmonic_coefficients.py | 1 + src/sleplet/meshes/mesh_noise_field.py | 1 + src/sleplet/meshes/mesh_slepian.py | 1 + src/sleplet/meshes/mesh_slepian_coefficients.py | 1 + src/sleplet/meshes/mesh_slepian_field.py | 1 + src/sleplet/meshes/mesh_slepian_functions.py | 1 + src/sleplet/meshes/mesh_slepian_noise_field.py | 1 + .../meshes/mesh_slepian_wavelet_coefficients.py | 1 + src/sleplet/meshes/mesh_slepian_wavelets.py | 1 + src/sleplet/noise.py | 1 + src/sleplet/plot_methods.py | 1 + src/sleplet/slepian/region.py | 1 + src/sleplet/slepian/slepian_arbitrary.py | 1 + src/sleplet/slepian/slepian_functions.py | 1 + src/sleplet/slepian/slepian_polar_cap.py | 1 + src/sleplet/slepian_methods.py | 1 + src/sleplet/wavelet_methods.py | 1 + tests/test_strings.py | 2 +- 55 files changed, 67 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f7d239a7..d79b3224d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/paddyroddy/.github - rev: v0.146.0 + rev: v0.148.0 hooks: - id: general-hooks - id: python-hooks diff --git a/src/sleplet/_string_methods.py b/src/sleplet/_string_methods.py index 4a50402bd..31cdced15 100644 --- a/src/sleplet/_string_methods.py +++ b/src/sleplet/_string_methods.py @@ -70,7 +70,7 @@ def multiples_of_pi(angle: float) -> str: i.e. pi, 2pi, 3pi. """ multiple = int(angle / np.pi) - return f"{multiple if multiple != 1 else ''}\u03C0" + return f"{multiple if multiple != 1 else ''}\u03c0" def angle_as_degree(radian: float) -> int: diff --git a/src/sleplet/functions/africa.py b/src/sleplet/functions/africa.py index e1bdf227a..3b45c6d1e 100644 --- a/src/sleplet/functions/africa.py +++ b/src/sleplet/functions/africa.py @@ -1,4 +1,5 @@ """Contains the `Africa` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py index ec5b11c1f..c133bfbfc 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py @@ -1,4 +1,5 @@ """Contains the `AxisymmetricWaveletCoefficientsAfrica` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py index ae4f410ab..6dbbc6755 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py @@ -1,4 +1,5 @@ """Contains the `AxisymmetricWaveletCoefficientsEarth` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py index 4a2ee796b..4ca3f87f5 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py @@ -1,4 +1,5 @@ """Contains the `AxisymmetricWaveletCoefficientsSouthAmerica` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/axisymmetric_wavelets.py b/src/sleplet/functions/axisymmetric_wavelets.py index ee2cf387c..f733d1709 100644 --- a/src/sleplet/functions/axisymmetric_wavelets.py +++ b/src/sleplet/functions/axisymmetric_wavelets.py @@ -1,4 +1,5 @@ """Contains the `AxisymmetricWavelets` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/coefficients.py b/src/sleplet/functions/coefficients.py index 285bc0ee0..2093b2d29 100644 --- a/src/sleplet/functions/coefficients.py +++ b/src/sleplet/functions/coefficients.py @@ -1,4 +1,5 @@ """Contains the abstract `Coefficients` class.""" + import abc import dataclasses @@ -35,12 +36,12 @@ class Coefficients: """Whether to set a region or not, used in the Slepian case.""" smoothing: int | None = None """How much to smooth the topographic map of the Earth by.""" - _unnoised_coefficients: ( - npt.NDArray[np.complex128 | np.float64] | None - ) = pydantic.Field( - default=None, - init_var=False, - repr=False, + _unnoised_coefficients: npt.NDArray[np.complex128 | np.float64] | None = ( + pydantic.Field( + default=None, + init_var=False, + repr=False, + ) ) coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), diff --git a/src/sleplet/functions/dirac_delta.py b/src/sleplet/functions/dirac_delta.py index 2124c7ee6..012c98e82 100644 --- a/src/sleplet/functions/dirac_delta.py +++ b/src/sleplet/functions/dirac_delta.py @@ -1,4 +1,5 @@ """Contains the `DiracDelta` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/earth.py b/src/sleplet/functions/earth.py index 8966a7f38..a52dade7c 100644 --- a/src/sleplet/functions/earth.py +++ b/src/sleplet/functions/earth.py @@ -1,4 +1,5 @@ """Contains the `Earth` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/elongated_gaussian.py b/src/sleplet/functions/elongated_gaussian.py index e7935fccf..8aa54b1a9 100644 --- a/src/sleplet/functions/elongated_gaussian.py +++ b/src/sleplet/functions/elongated_gaussian.py @@ -1,4 +1,5 @@ """Contains the `ElongatedGaussian` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/flm.py b/src/sleplet/functions/flm.py index 442f09d12..fe17a1e64 100644 --- a/src/sleplet/functions/flm.py +++ b/src/sleplet/functions/flm.py @@ -1,4 +1,5 @@ """Contains the abstract `Flm` class.""" + import abc import numpy as np diff --git a/src/sleplet/functions/fp.py b/src/sleplet/functions/fp.py index 077e7570a..440dabcf5 100644 --- a/src/sleplet/functions/fp.py +++ b/src/sleplet/functions/fp.py @@ -1,4 +1,5 @@ """Contains the abstract `Fp` class.""" + import abc import numpy as np diff --git a/src/sleplet/functions/gaussian.py b/src/sleplet/functions/gaussian.py index 565292b82..71a48df11 100644 --- a/src/sleplet/functions/gaussian.py +++ b/src/sleplet/functions/gaussian.py @@ -1,4 +1,5 @@ """Contains the `Gaussian` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/harmonic_gaussian.py b/src/sleplet/functions/harmonic_gaussian.py index 1ad6bd6a8..37c3cae33 100644 --- a/src/sleplet/functions/harmonic_gaussian.py +++ b/src/sleplet/functions/harmonic_gaussian.py @@ -1,4 +1,5 @@ """Contains the `HarmonicGaussian` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/identity.py b/src/sleplet/functions/identity.py index 68aa732f7..d930104cb 100644 --- a/src/sleplet/functions/identity.py +++ b/src/sleplet/functions/identity.py @@ -1,4 +1,5 @@ """Contains the `Identity` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/noise_earth.py b/src/sleplet/functions/noise_earth.py index 816ec6dae..ee7cfb052 100644 --- a/src/sleplet/functions/noise_earth.py +++ b/src/sleplet/functions/noise_earth.py @@ -1,4 +1,5 @@ """Contains the `NoiseEarth` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/ridgelets.py b/src/sleplet/functions/ridgelets.py index d4b46f58e..126765c8d 100644 --- a/src/sleplet/functions/ridgelets.py +++ b/src/sleplet/functions/ridgelets.py @@ -1,4 +1,5 @@ """Contains the `Ridgelets` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/slepian.py b/src/sleplet/functions/slepian.py index c72afabc9..e5a579c1e 100644 --- a/src/sleplet/functions/slepian.py +++ b/src/sleplet/functions/slepian.py @@ -1,4 +1,5 @@ """Contains the `Slepian` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/slepian_africa.py b/src/sleplet/functions/slepian_africa.py index c0b257349..63f215a02 100644 --- a/src/sleplet/functions/slepian_africa.py +++ b/src/sleplet/functions/slepian_africa.py @@ -1,4 +1,5 @@ """Contains the `SlepianAfrica` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/slepian_dirac_delta.py b/src/sleplet/functions/slepian_dirac_delta.py index 2d27666c4..b4b40cff3 100644 --- a/src/sleplet/functions/slepian_dirac_delta.py +++ b/src/sleplet/functions/slepian_dirac_delta.py @@ -1,4 +1,5 @@ """Contains the `SlepianDiracDelta` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/slepian_identity.py b/src/sleplet/functions/slepian_identity.py index 1c5d94011..44dda60be 100644 --- a/src/sleplet/functions/slepian_identity.py +++ b/src/sleplet/functions/slepian_identity.py @@ -1,4 +1,5 @@ """Contains the `SlepianIdentity` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/slepian_noise_africa.py b/src/sleplet/functions/slepian_noise_africa.py index 9bdbfa65f..b58ca5892 100644 --- a/src/sleplet/functions/slepian_noise_africa.py +++ b/src/sleplet/functions/slepian_noise_africa.py @@ -1,4 +1,5 @@ """Contains the `SlepianNoiseAfrica` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/slepian_noise_south_america.py b/src/sleplet/functions/slepian_noise_south_america.py index d0f0b4f86..d43f9160c 100644 --- a/src/sleplet/functions/slepian_noise_south_america.py +++ b/src/sleplet/functions/slepian_noise_south_america.py @@ -1,4 +1,5 @@ """Contains the `SlepianNoiseSouthAmerica` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/slepian_south_america.py b/src/sleplet/functions/slepian_south_america.py index f06401342..1eb2729a3 100644 --- a/src/sleplet/functions/slepian_south_america.py +++ b/src/sleplet/functions/slepian_south_america.py @@ -1,4 +1,5 @@ """Contains the `SlepianSouthAmerica` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py index 7dafded6c..012e6d62d 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py @@ -1,4 +1,5 @@ """Contains the `SlepianWaveletCoefficientsAfrica` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py index 794a9b892..80d007c35 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py @@ -1,4 +1,5 @@ """Contains the `SlepianWaveletCoefficientsSouthAmerica` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/slepian_wavelets.py b/src/sleplet/functions/slepian_wavelets.py index cc956da4f..c57273d22 100644 --- a/src/sleplet/functions/slepian_wavelets.py +++ b/src/sleplet/functions/slepian_wavelets.py @@ -1,4 +1,5 @@ """Contains the `SlepianWavelets` class.""" + import logging import numpy as np diff --git a/src/sleplet/functions/south_america.py b/src/sleplet/functions/south_america.py index 8a5965290..303150bbc 100644 --- a/src/sleplet/functions/south_america.py +++ b/src/sleplet/functions/south_america.py @@ -1,4 +1,5 @@ """Contains the `SouthAmerica` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/spherical_harmonic.py b/src/sleplet/functions/spherical_harmonic.py index 1317251c9..8f01c6e59 100644 --- a/src/sleplet/functions/spherical_harmonic.py +++ b/src/sleplet/functions/spherical_harmonic.py @@ -1,4 +1,5 @@ """Contains the `SphericalHarmonic` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/squashed_gaussian.py b/src/sleplet/functions/squashed_gaussian.py index dd99ea891..99bde1d62 100644 --- a/src/sleplet/functions/squashed_gaussian.py +++ b/src/sleplet/functions/squashed_gaussian.py @@ -1,4 +1,5 @@ """Contains the `SquashedGaussian` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/functions/wmap.py b/src/sleplet/functions/wmap.py index de12286be..406f3e9d2 100644 --- a/src/sleplet/functions/wmap.py +++ b/src/sleplet/functions/wmap.py @@ -1,4 +1,5 @@ """Contains the `Wmap` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/harmonic_methods.py b/src/sleplet/harmonic_methods.py index dd3aabc1f..15abdcd9e 100644 --- a/src/sleplet/harmonic_methods.py +++ b/src/sleplet/harmonic_methods.py @@ -1,4 +1,5 @@ """Methods to perform operations in Fourier space of the sphere or mesh.""" + import collections import typing diff --git a/src/sleplet/meshes/mesh.py b/src/sleplet/meshes/mesh.py index 636f829b1..99c02caff 100644 --- a/src/sleplet/meshes/mesh.py +++ b/src/sleplet/meshes/mesh.py @@ -1,4 +1,5 @@ """Contains the `Mesh` class.""" + import dataclasses import numpy as np diff --git a/src/sleplet/meshes/mesh_basis_functions.py b/src/sleplet/meshes/mesh_basis_functions.py index ff3b9b300..a29d46d1c 100644 --- a/src/sleplet/meshes/mesh_basis_functions.py +++ b/src/sleplet/meshes/mesh_basis_functions.py @@ -1,4 +1,5 @@ """Contains the `MeshBasisFunctions` class.""" + import logging import numpy as np diff --git a/src/sleplet/meshes/mesh_coefficients.py b/src/sleplet/meshes/mesh_coefficients.py index 6e81451d6..965ab77a9 100644 --- a/src/sleplet/meshes/mesh_coefficients.py +++ b/src/sleplet/meshes/mesh_coefficients.py @@ -1,4 +1,5 @@ """Contains the abstract `MeshCoefficients` class.""" + import abc import dataclasses @@ -30,12 +31,12 @@ class MeshCoefficients: """How much to noise the data.""" region: bool = False """Whether to set a region or not, used in the Slepian case.""" - _unnoised_coefficients: ( - npt.NDArray[np.complex128 | np.float64] | None - ) = pydantic.Field( - default=None, - init_var=False, - repr=False, + _unnoised_coefficients: npt.NDArray[np.complex128 | np.float64] | None = ( + pydantic.Field( + default=None, + init_var=False, + repr=False, + ) ) coefficients: npt.NDArray[np.complex128 | np.float64] = pydantic.Field( default_factory=lambda: np.empty(0), diff --git a/src/sleplet/meshes/mesh_field.py b/src/sleplet/meshes/mesh_field.py index 9f747e7d6..a6b185eef 100644 --- a/src/sleplet/meshes/mesh_field.py +++ b/src/sleplet/meshes/mesh_field.py @@ -1,4 +1,5 @@ """Contains the `MeshField` class.""" + import igl import numpy as np import numpy.typing as npt diff --git a/src/sleplet/meshes/mesh_harmonic_coefficients.py b/src/sleplet/meshes/mesh_harmonic_coefficients.py index 6b5482939..0e2602542 100644 --- a/src/sleplet/meshes/mesh_harmonic_coefficients.py +++ b/src/sleplet/meshes/mesh_harmonic_coefficients.py @@ -1,4 +1,5 @@ """Contains the abstract `MeshHarmonicCoefficients` class.""" + import abc import numpy as np diff --git a/src/sleplet/meshes/mesh_noise_field.py b/src/sleplet/meshes/mesh_noise_field.py index 039fddfaf..9e3f85346 100644 --- a/src/sleplet/meshes/mesh_noise_field.py +++ b/src/sleplet/meshes/mesh_noise_field.py @@ -1,4 +1,5 @@ """Contains the `MeshNoiseField` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/meshes/mesh_slepian.py b/src/sleplet/meshes/mesh_slepian.py index 37fd36d4e..51922a19b 100644 --- a/src/sleplet/meshes/mesh_slepian.py +++ b/src/sleplet/meshes/mesh_slepian.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepian` class.""" + import concurrent.futures import logging import os diff --git a/src/sleplet/meshes/mesh_slepian_coefficients.py b/src/sleplet/meshes/mesh_slepian_coefficients.py index 62f3539de..8a14276b0 100644 --- a/src/sleplet/meshes/mesh_slepian_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_coefficients.py @@ -1,4 +1,5 @@ """Contains the abstract `MeshSlepianCoefficients` class.""" + import abc import numpy as np diff --git a/src/sleplet/meshes/mesh_slepian_field.py b/src/sleplet/meshes/mesh_slepian_field.py index ade2d7d21..356e86c0f 100644 --- a/src/sleplet/meshes/mesh_slepian_field.py +++ b/src/sleplet/meshes/mesh_slepian_field.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepianField` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/meshes/mesh_slepian_functions.py b/src/sleplet/meshes/mesh_slepian_functions.py index ebfed3051..1bd29a732 100644 --- a/src/sleplet/meshes/mesh_slepian_functions.py +++ b/src/sleplet/meshes/mesh_slepian_functions.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepianFunctions` class.""" + import logging import numpy as np diff --git a/src/sleplet/meshes/mesh_slepian_noise_field.py b/src/sleplet/meshes/mesh_slepian_noise_field.py index d02f726df..80edd284b 100644 --- a/src/sleplet/meshes/mesh_slepian_noise_field.py +++ b/src/sleplet/meshes/mesh_slepian_noise_field.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepianNoiseField` class.""" + import numpy as np import numpy.typing as npt import pydantic diff --git a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py index 5a6d6b9cf..6931ce2da 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepianWaveletCoefficients` class.""" + import logging import numpy as np diff --git a/src/sleplet/meshes/mesh_slepian_wavelets.py b/src/sleplet/meshes/mesh_slepian_wavelets.py index 13c26dacb..a3ac07b3e 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelets.py +++ b/src/sleplet/meshes/mesh_slepian_wavelets.py @@ -1,4 +1,5 @@ """Contains the `MeshSlepianWavelets` class.""" + import logging import numpy as np diff --git a/src/sleplet/noise.py b/src/sleplet/noise.py index deb6742c1..282a441df 100644 --- a/src/sleplet/noise.py +++ b/src/sleplet/noise.py @@ -1,4 +1,5 @@ """Methods to handle noise in Fourier or wavelet space.""" + import logging import numpy as np diff --git a/src/sleplet/plot_methods.py b/src/sleplet/plot_methods.py index f14332bd7..661f7927b 100644 --- a/src/sleplet/plot_methods.py +++ b/src/sleplet/plot_methods.py @@ -1,4 +1,5 @@ """Methods to help in creating plots.""" + import logging import matplotlib as mpl diff --git a/src/sleplet/slepian/region.py b/src/sleplet/slepian/region.py index a96309157..63c2f3b98 100644 --- a/src/sleplet/slepian/region.py +++ b/src/sleplet/slepian/region.py @@ -1,4 +1,5 @@ """Contains the `Region` class.""" + import logging import pydantic diff --git a/src/sleplet/slepian/slepian_arbitrary.py b/src/sleplet/slepian/slepian_arbitrary.py index e819f0a5d..0f44e29a1 100644 --- a/src/sleplet/slepian/slepian_arbitrary.py +++ b/src/sleplet/slepian/slepian_arbitrary.py @@ -1,4 +1,5 @@ """Contains the `SlepianArbitrary` class.""" + import concurrent.futures import logging import os diff --git a/src/sleplet/slepian/slepian_functions.py b/src/sleplet/slepian/slepian_functions.py index 36131f26c..9d0da8085 100644 --- a/src/sleplet/slepian/slepian_functions.py +++ b/src/sleplet/slepian/slepian_functions.py @@ -1,4 +1,5 @@ """Contains the abstract `SlepianFunctions` class.""" + import abc import dataclasses import logging diff --git a/src/sleplet/slepian/slepian_polar_cap.py b/src/sleplet/slepian/slepian_polar_cap.py index 7a2b4887a..a73882323 100644 --- a/src/sleplet/slepian/slepian_polar_cap.py +++ b/src/sleplet/slepian/slepian_polar_cap.py @@ -1,4 +1,5 @@ """Contains the `SlepianPolarCap` class.""" + import concurrent.futures import dataclasses import logging diff --git a/src/sleplet/slepian_methods.py b/src/sleplet/slepian_methods.py index 284f58ab1..bdd3f1ce5 100644 --- a/src/sleplet/slepian_methods.py +++ b/src/sleplet/slepian_methods.py @@ -1,4 +1,5 @@ """Methods to work with Slepian coefficients.""" + import logging import numpy as np diff --git a/src/sleplet/wavelet_methods.py b/src/sleplet/wavelet_methods.py index 90b349852..7a35862ae 100644 --- a/src/sleplet/wavelet_methods.py +++ b/src/sleplet/wavelet_methods.py @@ -1,4 +1,5 @@ """Methods to work with wavelet and wavelet coefficients.""" + import numpy as np import numpy.typing as npt diff --git a/tests/test_strings.py b/tests/test_strings.py index 03606eab4..2734b1ca2 100644 --- a/tests/test_strings.py +++ b/tests/test_strings.py @@ -39,7 +39,7 @@ def test_add_angle_to_filename() -> None: def test_print_multiple_of_pi() -> None: """Test that the pi prefix is added.""" arguments = [0, 1, 2, 2.5] - output = ["0\u03C0", "\u03C0", "2\u03C0", "2\u03C0"] + output = ["0\u03c0", "\u03c0", "2\u03c0", "2\u03c0"] for c, arg in enumerate(arguments): np.testing.assert_equal( sleplet._string_methods.multiples_of_pi(arg * np.pi), From e3dec589a7f9803100c9aff6bdefa7ef76a6aa52 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Wed, 20 Mar 2024 16:46:55 +0000 Subject: [PATCH 09/13] Add repostatus.org badge (#360) Mentioned in review of pyOpenSci/software-submission#149 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 360936f29..691ee1810 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ [![Coverage Status](https://coveralls.io/repos/github/astro-informatics/sleplet/badge.svg?branch=main)](https://coveralls.io/github/astro-informatics/sleplet?branch=main) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Renovate](https://img.shields.io/badge/renovate-enabled-orange?logo=renovatebot)](https://renovatebot.com) +[![repostatus](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) `SLEPLET` is a Python package for the construction of Slepian wavelets in the spherical and manifold (via meshes) settings. The API of `SLEPLET` has been From b08f737b6f1f0b082f3fd24630381fea4cc9007f Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Wed, 27 Mar 2024 15:33:43 +0000 Subject: [PATCH 10/13] Fix quoted string error (#361) See adrienverge/yamllint#663 --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d214ea4ad..1f0560e57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,8 +49,10 @@ jobs: uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2 with: parallel-finished: true - carryforward: \ + # yamllint disable-line rule:quoted-strings + carryforward: "\ run-macos-latest-3.10,\ run-ubuntu-latest-3.10,\ run-macos-latest-3.11,\ - run-ubuntu-latest-3.11 + run-ubuntu-latest-3.11\ + " From 9b0fc40a2b1c0c288d59b17322a3ace2032ecf69 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:48:35 +0100 Subject: [PATCH 11/13] Renovate: actions/cache to 0c45773 (#362) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://togithub.com/actions/cache) | action | digest | `ab5e6d0` -> `0c45773` | --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/astro-informatics/sleplet). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 723633e95..51c3c9278 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -28,7 +28,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Cache pooch - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: ~/.cache/sleplet key: readme-${{ hashFiles('pyproject.toml') }} @@ -53,7 +53,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Cache pooch - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: ~/.cache/sleplet key: examples-${{ hashFiles('pyproject.toml') }} From 3198b7583beb6ab2f3aa7ad3d587cb68e7d491d0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:49:24 +0100 Subject: [PATCH 12/13] Renovate: actions/setup-python to 82c7e63 (#363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-python](https://togithub.com/actions/setup-python) | action | digest | `0a5c615` -> `82c7e63` | --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/astro-informatics/sleplet). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 51c3c9278..86e7b6d11 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Set up python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: python-version: "3.11" cache: pip @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Set up python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: python-version: "3.11" cache: pip From 9eb9bd2ad1452cf966fb69e8d7c58f625583bdf2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:53:02 +0100 Subject: [PATCH 13/13] Renovate: paddyroddy/.github (minor) (#364) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [paddyroddy/.github](https://togithub.com/paddyroddy/.github) | repository | minor | `v0.148.0` -> `v0.157.0` | | [paddyroddy/.github](https://togithub.com/paddyroddy/.github) | action | digest | `512a88e` -> `be31e8f` | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://togithub.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes
paddyroddy/.github (paddyroddy/.github) ### [`v0.157.0`](https://togithub.com/paddyroddy/.github/compare/v0.156.0...v0.157.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.156.0...v0.157.0) ### [`v0.156.0`](https://togithub.com/paddyroddy/.github/compare/v0.155.0...v0.156.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.155.0...v0.156.0) ### [`v0.155.0`](https://togithub.com/paddyroddy/.github/compare/v0.154.0...v0.155.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.154.0...v0.155.0) ### [`v0.154.0`](https://togithub.com/paddyroddy/.github/compare/v0.153.0...v0.154.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.153.0...v0.154.0) ### [`v0.153.0`](https://togithub.com/paddyroddy/.github/compare/v0.152.0...v0.153.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.152.0...v0.153.0) ### [`v0.152.0`](https://togithub.com/paddyroddy/.github/compare/v0.151.0...v0.152.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.151.0...v0.152.0) ### [`v0.151.0`](https://togithub.com/paddyroddy/.github/compare/v0.150.0...v0.151.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.150.0...v0.151.0) ### [`v0.150.0`](https://togithub.com/paddyroddy/.github/compare/v0.149.0...v0.150.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.149.0...v0.150.0) ### [`v0.149.0`](https://togithub.com/paddyroddy/.github/compare/v0.148.0...v0.149.0) [Compare Source](https://togithub.com/paddyroddy/.github/compare/v0.148.0...v0.149.0)
--- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/astro-informatics/sleplet). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/deploy.yml | 2 +- .github/workflows/documentation.yml | 2 +- .github/workflows/licence.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ae30d739f..4a7f1f109 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: id-token: write steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/deployment@512a88ef0d35d185588d460030660a184fc2db36 # v0 + - uses: paddyroddy/.github/actions/python/deployment@be31e8f5758700dafb58c5852530e750f1ea69d8 # v0 with: pyproject-toml: ./pyproject.toml python-version: "3.11" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 68c2ffc62..b6c3a84cc 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/pdoc@512a88ef0d35d185588d460030660a184fc2db36 # v0 + - uses: paddyroddy/.github/actions/python/pdoc@be31e8f5758700dafb58c5852530e750f1ea69d8 # v0 with: docs-dependency-section: .[docs] gh-pages-publish-directory: ./html/sleplet diff --git a/.github/workflows/licence.yml b/.github/workflows/licence.yml index 085190e19..f970a894c 100644 --- a/.github/workflows/licence.yml +++ b/.github/workflows/licence.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/licence@512a88ef0d35d185588d460030660a184fc2db36 # v0 + - uses: paddyroddy/.github/actions/licence@be31e8f5758700dafb58c5852530e750f1ea69d8 # v0 with: github-token: ${{ secrets.GITHUB_TOKEN }} licence-file: ./LICENCE.txt diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index af8dc775c..402642136 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -13,6 +13,6 @@ jobs: runs-on: ubuntu-latest steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/linting@512a88ef0d35d185588d460030660a184fc2db36 # v0 + - uses: paddyroddy/.github/actions/linting@be31e8f5758700dafb58c5852530e750f1ea69d8 # v0 with: pre-commit-config: ./.pre-commit-config.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f0560e57..009d84a3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - "3.11" steps: # yamllint disable-line rule:line-length - - uses: paddyroddy/.github/actions/python/tox@512a88ef0d35d185588d460030660a184fc2db36 # v0 + - uses: paddyroddy/.github/actions/python/tox@be31e8f5758700dafb58c5852530e750f1ea69d8 # v0 with: cache-path: |- .tox diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d79b3224d..163556d05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/paddyroddy/.github - rev: v0.148.0 + rev: v0.157.0 hooks: - id: general-hooks - id: python-hooks