From 6f82c7f4ad75abafc0356f404198727b49c9a718 Mon Sep 17 00:00:00 2001 From: Matt Wheeler Date: Sat, 23 Mar 2024 18:54:29 +0000 Subject: [PATCH 1/4] Chore: update pyproject.toml to include `black` in dev-dependencies --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ab3aa04..443dc8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ gpu = ["cupy"] [tool.poetry.group.dev.dependencies] pytest = "^7.4.4" +black = "^24.3.0" [build-system] requires = ["poetry-core"] From 59bd60408b9e1ad344d8b4399be8454654d6f459 Mon Sep 17 00:00:00 2001 From: Matt Wheeler Date: Sat, 23 Mar 2024 18:55:02 +0000 Subject: [PATCH 2/4] Fix: use 'ij' indexing to ensure consistency with anisotropic grids --- pygpe/shared/grid.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pygpe/shared/grid.py b/pygpe/shared/grid.py index c4c9901..72b1ee7 100644 --- a/pygpe/shared/grid.py +++ b/pygpe/shared/grid.py @@ -127,7 +127,7 @@ def _generate_2d_grids( cp.arange(-self.num_points_y // 2, self.num_points_y // 2) * self.grid_spacing_y ) - self.x_mesh, self.y_mesh = cp.meshgrid(x, y) + self.x_mesh, self.y_mesh = cp.meshgrid(x, y, indexing="ij") # Generate Fourier space variables self.fourier_spacing_x = cp.pi / (self.num_points_x // 2 * self.grid_spacing_x) @@ -142,7 +142,9 @@ def _generate_2d_grids( * self.fourier_spacing_y ) - self.fourier_x_mesh, self.fourier_y_mesh = cp.meshgrid(fourier_x, fourier_y) + self.fourier_x_mesh, self.fourier_y_mesh = cp.meshgrid( + fourier_x, fourier_y, indexing="ij" + ) self.fourier_x_mesh = cp.fft.fftshift(self.fourier_x_mesh) self.fourier_y_mesh = cp.fft.fftshift(self.fourier_y_mesh) @@ -181,7 +183,7 @@ def _generate_3d_grids( cp.arange(-self.num_points_z // 2, self.num_points_z // 2) * self.grid_spacing_z ) - self.x_mesh, self.y_mesh, self.z_mesh = cp.meshgrid(x, y, z) + self.x_mesh, self.y_mesh, self.z_mesh = cp.meshgrid(x, y, z, indexing="ij") # Generate Fourier space variables self.fourier_spacing_x = cp.pi / (self.num_points_x // 2 * self.grid_spacing_x) @@ -205,7 +207,7 @@ def _generate_3d_grids( self.fourier_x_mesh, self.fourier_y_mesh, self.fourier_z_mesh, - ) = cp.meshgrid(fourier_x, fourier_y, fourier_z) + ) = cp.meshgrid(fourier_x, fourier_y, fourier_z, indexing="ij") self.fourier_x_mesh = cp.fft.fftshift(self.fourier_x_mesh) self.fourier_y_mesh = cp.fft.fftshift(self.fourier_y_mesh) self.fourier_z_mesh = cp.fft.fftshift(self.fourier_z_mesh) From 853adf1a925eb32defa65971c3a4df8761f0bcec Mon Sep 17 00:00:00 2001 From: Matt Wheeler Date: Sat, 23 Mar 2024 18:56:07 +0000 Subject: [PATCH 3/4] Fix: update Fourier shift test to accommodate 'ij' indexing --- tests/shared/test_grids.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/shared/test_grids.py b/tests/shared/test_grids.py index fb89bf8..3e7b9af 100644 --- a/tests/shared/test_grids.py +++ b/tests/shared/test_grids.py @@ -59,9 +59,9 @@ def test_correct_fourier_shift_2d(): grid2d = grid.Grid((64, 64), (0.5, 0.5)) - for element in grid2d.fourier_x_mesh[:, 0]: + for element in grid2d.fourier_x_mesh[0, :]: assert element == 0 - for element in grid2d.fourier_y_mesh[0, :]: + for element in grid2d.fourier_y_mesh[:, 0]: assert element == 0 From 5bb25efd1b7b3b9b6ef329d04eda0856ae2a850c Mon Sep 17 00:00:00 2001 From: Matt Wheeler Date: Sat, 23 Mar 2024 19:05:03 +0000 Subject: [PATCH 4/4] Chore: update project version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 443dc8a..ab6e3bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pygpe" -version = "2.0.0" +version = "2.0.1" description = "A fast Gross-Pitaevskii equation solver for scalar, spin-1 and spin-2 BEC systems." authors = ["Matt Wheeler "] license = "MIT"