Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
rhayes777 committed Dec 18, 2023
2 parents 07db622 + 58110e1 commit 4cd3ace
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
21 changes: 11 additions & 10 deletions autoarray/fit/fit_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,18 @@ def chi_squared_with_mask_fast_from(
mask
The mask applied to the chi-squared-map, where `False` entries are included in the calculation.
"""

return np.sum(
np.square(
np.divide(
np.subtract(
data,
model_data,
),
noise_map,
return float(
np.sum(
np.square(
np.divide(
np.subtract(
data,
model_data,
)[np.asarray(mask) == 0],
noise_map[np.asarray(mask) == 0],
)
)
)[np.asarray(mask) == 0]
)
)


Expand Down
15 changes: 15 additions & 0 deletions autoarray/inversion/pixelization/mappers/mapper_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from scipy.spatial import cKDTree
from typing import Tuple

from autoconf import conf
Expand Down Expand Up @@ -172,6 +173,20 @@ def pix_indexes_for_sub_slim_index_delaunay_from(
return pix_indexes_for_sub_slim_index, pix_indexes_for_sub_slim_index_sizes


def nearest_pixelization_index_for_slim_index_from_kdtree(grid, mesh_grid):

kdtree = cKDTree(mesh_grid)

sparse_index_for_slim_index = []

for i in range(grid.shape[0]):

input_point = [grid[i, [0]], grid[i, 1]]
index = kdtree.query(input_point)[1]
sparse_index_for_slim_index.append(index)

return sparse_index_for_slim_index

@numba_util.jit()
def nearest_pixelization_index_for_slim_index_from(grid, mesh_grid):
"""
Expand Down
16 changes: 0 additions & 16 deletions autoarray/inversion/pixelization/mesh/mesh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,22 +469,6 @@ def voronoi_neighbors_from(
-------
The arrays containing the 1D index of every pixel's neighbors and the number of neighbors that each pixel has.
"""
"""
Returns the neighbors and total number of neighbors of every cell on a Voronoi mesh.
Neighbors are returned as an ndarray of shape [total_pixels, max_neighbors_in_a_given_voronoi pixel], where
entries have values of -1 if the pixel has no neighbor.
The number of neighbors of every pixel is also returned as an ndarray of shape [total_pixels], where the values
are integers between 0 and the total neighbors in a given Voronoi pixel.
Parameters
----------
pixels
The number of pixels on the Voronoi mesh
ridge_points
Contains the information on every Voronoi pixel and its neighbors.
"""
neighbors_sizes = np.zeros(shape=(pixels))

for ridge_index in range(ridge_points.shape[0]):
Expand Down
2 changes: 1 addition & 1 deletion autoarray/plot/mat_plot/one_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def plot_yx(
text_manual_dict_y=None,
bypass: bool = False,
):
if (y is None) or np.count_nonzero(y) == 0:
if (y is None) or np.count_nonzero(y) == 0 or np.isnan(y).all():
return

ax = None
Expand Down

0 comments on commit 4cd3ace

Please sign in to comment.