Skip to content

Commit 0c6e25c

Browse files
authored
Merge pull request #1629 from FlorianPfaff/meshgrid
Explicitly specify meshgrid convention (can be different for different backends)
2 parents 21c9ae2 + b86b823 commit 0c6e25c

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

pyrecest/distributions/cart_prod/abstract_hypercylindrical_distribution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def plot(self, *args, **kwargs):
351351
m[self.bound_dim] + lin_size * sigma,
352352
100,
353353
)
354-
x, theta = meshgrid(x_vals, theta_vals)
354+
x, theta = meshgrid(x_vals, theta_vals, indexing="ij")
355355

356356
# Evaluate pdf at the grid points
357357
points = vstack((x.ravel(), theta.ravel())).T
@@ -398,7 +398,7 @@ def plot_cylinder(self, limits_linear=None):
398398

399399
phi = linspace(0.0, 2 * pi, 100)
400400
lin = linspace(limits_linear[0], limits_linear[1], 100)
401-
Phi, L = meshgrid(phi, lin)
401+
Phi, L = meshgrid(phi, lin, indexing="ij")
402402
points = vstack([Phi.ravel(), L.ravel()]).T
403403
C = self.pdf(points)
404404
C = C.reshape(Phi.shape)

pyrecest/distributions/cart_prod/partially_wrapped_normal_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def pdf(self, xs, m: Union[int, int32, int64] = 3):
7474
multiples = array(range(-m, m + 1)) * 2.0 * pi
7575

7676
# create meshgrid for all combinations of multiples
77-
mesh = array(meshgrid(*[multiples] * self.bound_dim)).reshape(
77+
mesh = array(meshgrid(*[multiples] * self.bound_dim, indexing="ij")).reshape(
7878
-1, self.bound_dim
7979
)
8080

pyrecest/distributions/hypersphere_subset/abstract_hyperhemispherical_distribution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def plot_hemisphere(resolution: Union[int, int32, int64] = 150):
182182
linspace(-1, 1, resolution),
183183
linspace(-1, 1, resolution),
184184
linspace(0, 1, resolution // 2),
185+
indexing="ij",
185186
)
186187
mask = (x**2 + y**2 + z**2 <= 1) & (z >= 0)
187188
x, y, z = x[mask].reshape(-1, 1), y[mask].reshape(-1, 1), z[mask].reshape(-1, 1)

pyrecest/distributions/hypertorus/abstract_hypertoroidal_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def plot(self, resolution=128, **kwargs):
203203
elif self.dim == 2:
204204
step = 2 * pi / resolution
205205
alpha, beta = meshgrid(
206-
arange(0.0, 2.0 * pi, step), arange(0.0, 2.0 * pi, step)
206+
arange(0.0, 2.0 * pi, step), arange(0.0, 2.0 * pi, step), indexing="ij"
207207
)
208208
f = self.pdf(column_stack((alpha.ravel(), beta.ravel())))
209209
f = f.reshape(alpha.shape)

pyrecest/distributions/nonperiodic/abstract_linear_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def plot(self, *args, plot_range=None, **kwargs):
314314
elif self.dim == 2:
315315
x = linspace(plot_range[0], plot_range[1], 100)
316316
y = linspace(plot_range[2], plot_range[3], 100)
317-
x_grid, y_grid = meshgrid(x, y)
317+
x_grid, y_grid = meshgrid(x, y, indexing="ij")
318318
z_grid = self.pdf(column_stack((x_grid.ravel(), y_grid.ravel())))
319319

320320
ax = plt.axes(projection="3d")

0 commit comments

Comments
 (0)