Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion autoarray/dataset/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ def blurring(self):
if self.psf is None:
self._blurring = None
else:

blurring_mask = self.mask.derive_mask.blurring_from(
kernel_shape_native=self.psf.kernel.shape_native
)

self._blurring = Grid2D.from_mask(
mask=self.psf._state.blurring_mask,
mask=blurring_mask,
over_sample_size=1,
)

Expand Down
18 changes: 8 additions & 10 deletions autoarray/operators/convolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import warnings

from autoconf import conf
from autoconf.fitsable import header_obj_from

from autoarray.structures.arrays.uniform_2d import AbstractArray2D
from autoarray.structures.arrays.uniform_2d import Array2D
from autoarray.structures.grids.uniform_2d import Grid2D
from autoarray.structures.header import Header
Expand Down Expand Up @@ -123,10 +120,6 @@ class determines how masked real-space data are embedded into a padded array,
)
fft_shape = tuple(scipy.fft.next_fast_len(s, real=True) for s in full_shape)

# make fft_shape odd x odd to avoid wrap-around artefacts with even kernels
# TODO : Fix this so it pads corrrectly internally
fft_shape = tuple(s + 1 if s % 2 == 0 else s for s in fft_shape)

self.fft_shape = fft_shape
self.mask = mask.resized_from(self.fft_shape, pad_value=1)
self.blurring_mask = self.mask.derive_mask.blurring_from(
Expand Down Expand Up @@ -248,11 +241,16 @@ def use_fft(self):
return self._use_fft

@property
def normalized(self) -> "Kernel2D":
def normalized(self) -> "Convolver":
"""
Normalize the Kernel2D such that its data_vector values sum to unity.
Normalize the Convolver such that its data_vector values sum to unity.

A copy of the kernel is used to avoid mutating the original kernel instance,
and no existing state is reused so that any cached FFTs are recomputed for
the normalized kernel.
"""
return Convolver(kernel=self.kernel, state=self._state, normalize=True)
kernel_copy = self.kernel.copy()
return Convolver(kernel=kernel_copy, state=None, normalize=True)

@classmethod
def no_blur(cls, pixel_scales):
Expand Down
7 changes: 2 additions & 5 deletions autoarray/plot/wrap/two_d/delaunay_drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ def draw_delaunay_pixels(
"""

if pixel_values is None:
raise ValueError(
"pixel_values input to DelaunayPlotter are None and thus cannot be plotted."
)
pixel_values = np.zeros(shape=mapper.source_plane_mesh_grid.shape[0])

if pixel_values is not None:
pixel_values = np.asarray(pixel_values)
pixel_values = np.asarray(pixel_values)

if ax is None:
ax = plt.gca()
Expand Down
Loading