|
12 | 12 | import warnings |
13 | 13 |
|
14 | 14 | from autoconf import conf |
15 | | -from autoconf.fitsable import header_obj_from |
16 | | - |
17 | | -from autoarray.structures.arrays.uniform_2d import AbstractArray2D |
18 | 15 | from autoarray.structures.arrays.uniform_2d import Array2D |
19 | 16 | from autoarray.structures.grids.uniform_2d import Grid2D |
20 | 17 | from autoarray.structures.header import Header |
@@ -123,10 +120,6 @@ class determines how masked real-space data are embedded into a padded array, |
123 | 120 | ) |
124 | 121 | fft_shape = tuple(scipy.fft.next_fast_len(s, real=True) for s in full_shape) |
125 | 122 |
|
126 | | - # make fft_shape odd x odd to avoid wrap-around artefacts with even kernels |
127 | | - # TODO : Fix this so it pads corrrectly internally |
128 | | - fft_shape = tuple(s + 1 if s % 2 == 0 else s for s in fft_shape) |
129 | | - |
130 | 123 | self.fft_shape = fft_shape |
131 | 124 | self.mask = mask.resized_from(self.fft_shape, pad_value=1) |
132 | 125 | self.blurring_mask = self.mask.derive_mask.blurring_from( |
@@ -248,11 +241,16 @@ def use_fft(self): |
248 | 241 | return self._use_fft |
249 | 242 |
|
250 | 243 | @property |
251 | | - def normalized(self) -> "Kernel2D": |
| 244 | + def normalized(self) -> "Convolver": |
252 | 245 | """ |
253 | | - Normalize the Kernel2D such that its data_vector values sum to unity. |
| 246 | + Normalize the Convolver such that its data_vector values sum to unity. |
| 247 | +
|
| 248 | + A copy of the kernel is used to avoid mutating the original kernel instance, |
| 249 | + and no existing state is reused so that any cached FFTs are recomputed for |
| 250 | + the normalized kernel. |
254 | 251 | """ |
255 | | - return Convolver(kernel=self.kernel, state=self._state, normalize=True) |
| 252 | + kernel_copy = self.kernel.copy() |
| 253 | + return Convolver(kernel=kernel_copy, state=None, normalize=True) |
256 | 254 |
|
257 | 255 | @classmethod |
258 | 256 | def no_blur(cls, pixel_scales): |
|
0 commit comments