Skip to content

Commit 8fd6961

Browse files
Jammy2211Jammy2211
authored andcommitted
another test
1 parent 065009c commit 8fd6961

1 file changed

Lines changed: 23 additions & 26 deletions

File tree

autoarray/inversion/pixelization/border_relocator.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -287,34 +287,31 @@ def relocated_grid_via_ellipse_border_from(grid, origin, a, b, phi, xp=np, eps=1
287287
# shift to origin
288288
dy = grid[:, 0] - origin[0]
289289
dx = grid[:, 1] - origin[1]
290-
291-
c = xp.cos(phi)
292-
s = xp.sin(phi)
293-
294-
# rotate into ellipse-aligned frame
295-
xprime = c * dx + s * dy
296-
yprime = -s * dx + c * dy
297-
298-
# ellipse radius in normalized coords
299-
q = (xprime / a) ** 2 + (yprime / b) ** 2
290+
#
291+
# c = xp.cos(phi)
292+
# s = xp.sin(phi)
293+
#
294+
# # rotate into ellipse-aligned frame
295+
# xprime = c * dx + s * dy
296+
# yprime = -s * dx + c * dy
297+
#
298+
# # ellipse radius in normalized coords
299+
# q = (xprime / a) ** 2 + (yprime / b) ** 2
300300

301301
outside = q > 1.0
302-
scale = 1.0 / xp.sqrt(xp.maximum(q, 1.0 + eps))
303-
304-
# scale back to boundary
305-
xprime2 = xprime * scale
306-
yprime2 = yprime * scale
307-
308-
# rotate back to original frame
309-
dx2 = c * xprime2 - s * yprime2
310-
dy2 = s * xprime2 + c * yprime2
311-
312-
moved = xp.stack([origin[0] + dy2, origin[1] + dx2], axis=1)
313-
314-
# return xp.where(outside[:, None], moved, grid)
315-
316-
return grid + (moved - grid) * outside.astype(grid.dtype)[:, None]
317-
302+
# scale = 1.0 / xp.sqrt(xp.maximum(q, 1.0 + eps))
303+
#
304+
# # scale back to boundary
305+
# xprime2 = xprime * scale
306+
# yprime2 = yprime * scale
307+
#
308+
# # rotate back to original frame
309+
# dx2 = c * xprime2 - s * yprime2
310+
# dy2 = s * xprime2 + c * yprime2
311+
312+
moved = xp.stack([origin[0] + dy, origin[1] + dx], axis=1)
313+
314+
return xp.where(outside[:, None], moved, grid)
318315

319316

320317
class BorderRelocator:

0 commit comments

Comments
 (0)