From 481c4c6f4a1bbcdc238bc98cfe2e03a08d62b7a9 Mon Sep 17 00:00:00 2001 From: NiekWielders Date: Thu, 14 May 2026 10:01:46 +0100 Subject: [PATCH] added maximum threshold --- autolens/analysis/result.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autolens/analysis/result.py b/autolens/analysis/result.py index 4f806baef..185aa98ab 100644 --- a/autolens/analysis/result.py +++ b/autolens/analysis/result.py @@ -263,6 +263,7 @@ def positions_likelihood_from( self, factor=1.0, minimum_threshold=None, + maximum_threshold=None, positions: Optional[aa.Grid2DIrregular] = None, mass_centre_radial_distance_min: float = None, plane_redshift: Optional[float] = None, @@ -289,6 +290,9 @@ def positions_likelihood_from( minimum_threshold The output threshold is rounded up to this value if it is below it, to avoid extremely small threshold values. + maximum_threshold + The output threshold is rounded down to this value if it is above it, to avoid extremely large threshold + values. positions If input, these positions are used instead of the computed multiple image positions from the lens mass model. @@ -380,6 +384,9 @@ def positions_likelihood_from( plane_redshift=plane_redshift, ) + if maximum_threshold is not None: + threshold = min(threshold, maximum_threshold) + return PositionsLH( positions=positions, threshold=threshold, plane_redshift=plane_redshift )