Skip to content

Commit

Permalink
Added option to free clump centres in clump model
Browse files Browse the repository at this point in the history
  • Loading branch information
samlange04 committed Aug 30, 2023
1 parent d1a2e40 commit 5049bca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion autogalaxy/analysis/chaining_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def clean_clumps_of_adapt_images(clumps):


def clumps_from(
result: af.Result, light_as_model: bool = False, mass_as_model: bool = False
result: af.Result, light_as_model: bool = False, mass_as_model: bool = False, free_centre: bool = False,
) -> af.Collection:
"""
The clump API models the light and / or mass of additional galaxies surrouding the main galaxy or strong lens
Expand All @@ -212,6 +212,8 @@ def clumps_from(
If `True`, the clump light is passed as a model component, else it is a fixed instance.
mass_as_model
If `True`, the clump mass is passed as a model component, else it is a fixed instance.
free_centre
If `True`, the requested mass and/or light model centres are passed as a model, else they are fixed.
Returns
-------
Expand All @@ -233,6 +235,8 @@ def clumps_from(
clumps[clump_index].mass.einstein_radius = result.model.clumps[
clump_index
].mass.einstein_radius
if free_centre:
clumps[clump_index].mass.centre = result.model.clumps[clump_index].mass.centre

elif light_as_model:
clumps = result.instance.clumps.as_model((LightProfile,))
Expand All @@ -242,6 +246,8 @@ def clumps_from(
clumps[clump_index].light.centre = result.instance.clumps[
clump_index
].light.centre
if free_centre:
clumps[clump_index].light.centre = result.model.clumps[clump_index].light.centre

else:
clumps = result.instance.clumps.as_model(())
Expand Down

0 comments on commit 5049bca

Please sign in to comment.