Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Dec 20, 2024
1 parent be571b5 commit 1d20dda
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 6 deletions.
4 changes: 2 additions & 2 deletions autoarray/config/visualize/plots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dataset: # Settings for plots of all datasets
data: false # Plot the individual data of every dataset?
noise_map: false # Plot the individual noise-map of every dataset?
signal_to_noise_map: false # Plot the individual signal-to-noise-map of every dataset?
over_sampling: false # Plot the over-sampling sub-size, used to evaluate light profiles, of every dataset?
over_sampling_pixelization: false # Plot the over-sampling sub-size, used to evaluate pixelizations, of every dataset?
over_sample_size_lp: false # Plot the over-sampling size, used to evaluate light profiles, of every dataset?
over_sample_size_pixelization: false # Plot the over-sampling size, used to evaluate pixelizations, of every dataset?
imaging: # Settings for plots of imaging datasets (e.g. ImagingPlotter)
psf: false
fit: # Settings for plots of all fits (e.g. FitImagingPlotter, FitInterferometerPlotter).
Expand Down
12 changes: 12 additions & 0 deletions autoarray/dataset/abstract/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,16 @@ def trimmed_after_convolution_from(self, kernel_shape) -> "AbstractDataset":
kernel_shape=kernel_shape
)

dataset.over_sample_size_lp = (
dataset.over_sample_size_lp.trimmed_after_convolution_from(
kernel_shape=kernel_shape
)
)

dataset.over_sample_size_pixelization = (
dataset.over_sample_size_pixelization.trimmed_after_convolution_from(
kernel_shape=kernel_shape
)
)

return dataset
23 changes: 23 additions & 0 deletions autoarray/dataset/imaging/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from autoarray import type as ty

from autoarray import exc
from autoarray.operators.over_sampling import over_sample_util
from autoarray.inversion.inversion.imaging import inversion_imaging_util

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -97,6 +98,28 @@ def __init__(
kernel_shape_native=psf.shape_native
)
except exc.MaskException:
over_sample_size_lp = (
over_sample_util.over_sample_size_convert_to_array_2d_from(
over_sample_size=over_sample_size_lp, mask=data.mask
)
)
over_sample_size_lp = (
over_sample_size_lp.padded_before_convolution_from(
kernel_shape=psf.shape_native, mask_pad_value=1
)
)
print(over_sample_size_lp.shape_native)
over_sample_size_pixelization = (
over_sample_util.over_sample_size_convert_to_array_2d_from(
over_sample_size=over_sample_size_pixelization, mask=data.mask
)
)
over_sample_size_pixelization = (
over_sample_size_pixelization.padded_before_convolution_from(
kernel_shape=psf.shape_native, mask_pad_value=1
)
)

data = data.padded_before_convolution_from(
kernel_shape=psf.shape_native, mask_pad_value=1
)
Expand Down
4 changes: 3 additions & 1 deletion autoarray/dataset/imaging/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def via_image_from(
)

if over_sample_size is not None:
dataset = dataset.apply_over_sampling(over_sample_size_lp=over_sample_size)
dataset = dataset.apply_over_sampling(
over_sample_size_lp=over_sample_size.native
)

return dataset
4 changes: 2 additions & 2 deletions autoarray/inversion/pixelization/border_relocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def sub_border_slim(self) -> np.ndarray:
print(derive_indexes_2d.sub_border_slim)
"""
return sub_border_pixel_slim_indexes_from(
mask_2d=np.array(self.mask), sub_size=self.sub_size
mask_2d=np.array(self.mask), sub_size=np.array(self.sub_size).astype("int")
).astype("int")

@cached_property
Expand All @@ -235,7 +235,7 @@ def sub_border_grid(self) -> np.ndarray:
sub_grid = over_sample_util.grid_2d_slim_over_sampled_via_mask_from(
mask_2d=np.array(self.mask),
pixel_scales=self.mask.pixel_scales,
sub_size=np.array(self.sub_size),
sub_size=np.array(self.sub_size).astype("int"),
origin=self.mask.origin,
)

Expand Down
2 changes: 1 addition & 1 deletion autoarray/inversion/pixelization/mappers/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def unique_mappings(self) -> UniqueMappings:
pix_sizes_for_sub_slim_index=self.pix_sizes_for_sub_slim_index,
pix_weights_for_sub_slim_index=self.pix_weights_for_sub_slim_index,
pix_pixels=self.params,
sub_size=np.array(self.over_sampler.sub_size),
sub_size=np.array(self.over_sampler.sub_size).astype("int"),
)

return UniqueMappings(
Expand Down

0 comments on commit 1d20dda

Please sign in to comment.