From 375623e84acce5ca0f0384ac25be950f30e01d88 Mon Sep 17 00:00:00 2001 From: Felix Koehler Date: Thu, 5 Sep 2024 12:51:36 +0200 Subject: [PATCH] Tests helper utilities for fft setup --- tests/test_shape_utilties.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_shape_utilties.py diff --git a/tests/test_shape_utilties.py b/tests/test_shape_utilties.py new file mode 100644 index 0000000..61b3d6a --- /dev/null +++ b/tests/test_shape_utilties.py @@ -0,0 +1,23 @@ +import exponax as ex + + +def test_space_indices(): + assert ex.spectral.space_indices(1) == (-1,) + assert ex.spectral.space_indices(2) == (-2, -1) + assert ex.spectral.space_indices(3) == (-3, -2, -1) + + +def test_spatial_shape(): + assert ex.spectral.spatial_shape(1, 64) == (64,) + assert ex.spectral.spatial_shape(2, 64) == (64, 64) + assert ex.spectral.spatial_shape(3, 64) == (64, 64, 64) + + +def test_wavenumber_shape(): + assert ex.spectral.wavenumber_shape(1, 64) == (33,) + assert ex.spectral.wavenumber_shape(2, 64) == (64, 33) + assert ex.spectral.wavenumber_shape(3, 64) == (64, 64, 33) + + assert ex.spectral.wavenumber_shape(1, 65) == (33,) + assert ex.spectral.wavenumber_shape(2, 65) == (65, 33) + assert ex.spectral.wavenumber_shape(3, 65) == (65, 65, 33)