Skip to content

Commit 1041709

Browse files
Jammy2211Jammy2211
authored andcommitted
remove numba relocated jit
1 parent d00977f commit 1041709

File tree

2 files changed

+1
-68
lines changed

2 files changed

+1
-68
lines changed

autoarray/inversion/inversion/imaging_numba/inversion_imaging_numba_util.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -803,74 +803,6 @@ def mapped_reconstructed_data_via_image_to_pix_unique_from(
803803
return mapped_reconstructed_data
804804

805805

806-
@numba_util.jit()
807-
def relocated_grid_via_jit_from(grid, border_grid):
808-
"""
809-
Relocate the coordinates of a grid to its border if they are outside the border, where the border is
810-
defined as all pixels at the edge of the grid's mask (see *mask._border_1d_indexes*).
811-
812-
This is performed as follows:
813-
814-
1: Use the mean value of the grid's y and x coordinates to determine the origin of the grid.
815-
2: Compute the radial distance of every grid coordinate from the origin.
816-
3: For every coordinate, find its nearest pixel in the border.
817-
4: Determine if it is outside the border, by comparing its radial distance from the origin to its paired
818-
border pixel's radial distance.
819-
5: If its radial distance is larger, use the ratio of radial distances to move the coordinate to the
820-
border (if its inside the border, do nothing).
821-
822-
The method can be used on uniform or irregular grids, however for irregular grids the border of the
823-
'image-plane' mask is used to define border pixels.
824-
825-
Parameters
826-
----------
827-
grid
828-
The grid (uniform or irregular) whose pixels are to be relocated to the border edge if outside it.
829-
border_grid : Grid2D
830-
The grid of border (y,x) coordinates.
831-
"""
832-
833-
grid_relocated = np.zeros(grid.shape)
834-
grid_relocated[:, :] = grid[:, :]
835-
836-
border_origin = np.zeros(2)
837-
border_origin[0] = np.mean(border_grid[:, 0])
838-
border_origin[1] = np.mean(border_grid[:, 1])
839-
border_grid_radii = np.sqrt(
840-
np.add(
841-
np.square(np.subtract(border_grid[:, 0], border_origin[0])),
842-
np.square(np.subtract(border_grid[:, 1], border_origin[1])),
843-
)
844-
)
845-
border_min_radii = np.min(border_grid_radii)
846-
847-
grid_radii = np.sqrt(
848-
np.add(
849-
np.square(np.subtract(grid[:, 0], border_origin[0])),
850-
np.square(np.subtract(grid[:, 1], border_origin[1])),
851-
)
852-
)
853-
854-
for pixel_index in range(grid.shape[0]):
855-
if grid_radii[pixel_index] > border_min_radii:
856-
closest_pixel_index = np.argmin(
857-
np.square(grid[pixel_index, 0] - border_grid[:, 0])
858-
+ np.square(grid[pixel_index, 1] - border_grid[:, 1])
859-
)
860-
861-
move_factor = (
862-
border_grid_radii[closest_pixel_index] / grid_radii[pixel_index]
863-
)
864-
865-
if move_factor < 1.0:
866-
grid_relocated[pixel_index, :] = (
867-
move_factor * (grid[pixel_index, :] - border_origin[:])
868-
+ border_origin[:]
869-
)
870-
871-
return grid_relocated
872-
873-
874806
class SparseLinAlgImagingNumba:
875807
def __init__(
876808
self,

autoarray/inversion/pixelization/border_relocator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def ellipse_params_via_border_pca_from(border_grid, xp=np, eps=1e-12):
262262

263263
return origin, a, b, phi
264264

265+
265266
def relocated_grid_via_ellipse_border_from(grid, origin, a, b, phi, xp=np, eps=1e-12):
266267
"""
267268
Rotated ellipse centered at origin with semi-axes a (major, x'), b (minor, y'),

0 commit comments

Comments
 (0)