From 693f0b0b360bfa42e92b7ddd827597fa4921a83d Mon Sep 17 00:00:00 2001 From: Georgios Varnavides Date: Sat, 6 Jan 2024 12:54:13 -0800 Subject: [PATCH] broadcasting polar coordinates --- py4DSTEM/process/phase/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py4DSTEM/process/phase/utils.py b/py4DSTEM/process/phase/utils.py index b6e1657fe..ff49b735f 100644 --- a/py4DSTEM/process/phase/utils.py +++ b/py4DSTEM/process/phase/utils.py @@ -412,9 +412,9 @@ def get_spatial_frequencies(self): def polar_coordinates(self, x, y): """Calculate a polar grid for a given Cartesian grid.""" xp = self._xp - alpha = xp.sqrt(x.reshape((-1, 1)) ** 2 + y.reshape((1, -1)) ** 2) + alpha = xp.sqrt(x[:, None] ** 2 + y[None, :] ** 2) # phi = xp.arctan2(x.reshape((-1, 1)), y.reshape((1, -1))) # bug in abtem-legacy and py4DSTEM<=0.14.9 - phi = xp.arctan2(y.reshape((1, -1)), x.reshape((-1, 1))) + phi = xp.arctan2(y[None, :], x[:, None]) return alpha, phi def build(self):