Skip to content

Commit

Permalink
default relocate_pix_border value now comes from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Dec 20, 2023
1 parent d5d878f commit 3e33791
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions autoarray/config/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ inversion:
use_positive_only_solver: true # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion.
no_regularization_add_to_curvature_diag_value : 1.0e-3 # The default value added to the curvature matrix's diagonal when regularization is not applied to a linear object, which prevents inversion's failing due to the matrix being singular.
positive_only_uses_p_initial: true # If True, the positive-only solver of an inversion's uses an initial guess of the reconstructed data's values as which values should be positive, speeding up the solver.
relocate_pix_border: false # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border.
reconstruction_vmax_factor: 0.5 # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
numba:
use_numba: true
Expand Down
12 changes: 10 additions & 2 deletions autoarray/inversion/inversion/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(
use_w_tilde: bool = True,
use_positive_only_solver: Optional[bool] = None,
positive_only_uses_p_initial: Optional[bool] = None,
relocate_pix_border : bool = True,
relocate_pix_border : Optional[bool] = None,
force_edge_pixels_to_zeros: bool = True,
force_edge_image_pixels_to_zeros: bool = False,
image_pixels_source_zero=None,
Expand Down Expand Up @@ -64,7 +64,7 @@ def __init__(
self.use_w_tilde = use_w_tilde
self._use_positive_only_solver = use_positive_only_solver
self._positive_only_uses_p_initial = positive_only_uses_p_initial
self.relocate_pix_border = relocate_pix_border
self._relocate_pix_border = relocate_pix_border
self.use_linear_operators = use_linear_operators
self.force_edge_pixels_to_zeros = force_edge_pixels_to_zeros
self.force_edge_image_pixels_to_zeros = force_edge_image_pixels_to_zeros
Expand All @@ -91,6 +91,14 @@ def positive_only_uses_p_initial(self):

return self._positive_only_uses_p_initial

@property
def relocate_pix_border(self):

if self._relocate_pix_border is None:
return conf.instance["general"]["inversion"]["relocate_pix_border"]

return self._relocate_pix_border

@property
def no_regularization_add_to_curvature_diag_value(self):
if self._no_regularization_add_to_curvature_diag_value is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import autoarray as aa
import numpy as np
import pytest

import autoarray as aa

def test___preloads_used_for_relocated_grid(sub_grid_2d_7x7):
mesh = aa.mesh.Delaunay()
Expand Down

0 comments on commit 3e33791

Please sign in to comment.