Skip to content

Commit 5392111

Browse files
committed
attempt to fix theta bcast bug
1 parent eda585c commit 5392111

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/aspire/image/rotation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ def sp_rotate(img, theta, **kwargs):
223223

224224
# Scipy accepts a single scalar theta in degrees.
225225
# Handle array of thetas and scalar case by expanding to flat array of img.shape
226-
# Flatten all inputs
226+
# Flatten all inputs, becomes 2d stack
227227
theta = np.rad2deg(np.array(theta)).reshape(-1, 1)
228-
# Expand scalar input
229-
if theta.shape[0] == 1:
228+
# Expand single scalar input
229+
if np.size(theta) == 1:
230230
theta = np.full(img.shape[0], theta, img.dtype)
231-
# Check we have an array matching `img`
232-
if theta.shape != img.shape[:1]:
231+
# Check we have an array matching `img`, both should be (n,1)
232+
if theta.shape[0] != img.shape[0]:
233233
raise RuntimeError("Inconsistent `theta` and `img` shapes.")
234234

235235
# Create result array and rotate images via loop

0 commit comments

Comments
 (0)