Skip to content

Feature/zeroth mesh edge#58

Merged
Jammy2211 merged 6 commits into
mainfrom
feature/zeroth_mesh_edge
Mar 24, 2023
Merged

Feature/zeroth mesh edge#58
Jammy2211 merged 6 commits into
mainfrom
feature/zeroth_mesh_edge

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

An experimental regularization scheme which applies adaptive zeroth-order regularization to the exterior regions of a inversion mesh (e.g. the regions of the source-plane that dont contain the source).

If this works, we will want to adjust PyAutoFit to allow a galaxy object to have multiple regularization schemes, which each lead to the summation of their regularization matrices.

Comment on lines +204 to +228
def test__brightness_zeroth_regularization_weights_from():

pixel_signals = np.array([1.0, 1.0, 1.0])

weight_list = aa.util.regularization.brightness_zeroth_regularization_weights_from(
coefficient=1.0, pixel_signals=pixel_signals
)

assert (weight_list == np.array([0.0, 0.0, 0.0])).all()

pixel_signals = np.array([0.25, 0.5, 0.75])

weight_list = aa.util.regularization.brightness_zeroth_regularization_weights_from(
coefficient=1.0, pixel_signals=pixel_signals
)

assert (weight_list == np.array([0.75, 0.5, 0.25])).all()

pixel_signals = np.array([0.25, 0.5, 0.75])

weight_list = aa.util.regularization.brightness_zeroth_regularization_weights_from(
coefficient=2.0, pixel_signals=pixel_signals
)

assert (weight_list == np.array([1.5, 1.0, 0.5])).all()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parametrize

Comment on lines +517 to +541
def test__brightness_zeroth_regularization_matrix_from():

regularization_weights = np.ones(shape=(3,))

regularization_matrix = (
aa.util.regularization.brightness_zeroth_regularization_matrix_from(
regularization_weights=regularization_weights,
)
)

assert regularization_matrix == pytest.approx(
np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]), 1.0e-4
)

regularization_weights = np.array([1.0, 2.0, 3.0])

regularization_matrix = (
aa.util.regularization.brightness_zeroth_regularization_matrix_from(
regularization_weights=regularization_weights,
)
)

assert regularization_matrix == pytest.approx(
np.array([[1.0, 0.0, 0.0], [0.0, 4.0, 0.0], [0.0, 0.0, 9.0]]), 1.0e-4
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

@Jammy2211 Jammy2211 merged commit e707f89 into main Mar 24, 2023
@Jammy2211 Jammy2211 deleted the feature/zeroth_mesh_edge branch June 12, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants