diff --git a/autolens/analysis/result.py b/autolens/analysis/result.py index 185aa98ab..b3b8fb21f 100644 --- a/autolens/analysis/result.py +++ b/autolens/analysis/result.py @@ -197,6 +197,7 @@ def positions_threshold_from( self, factor=1.0, minimum_threshold=None, + maximum_threshold=None, positions: Optional[aa.Grid2DIrregular] = None, plane_redshift: Optional[float] = None, ) -> float: @@ -224,6 +225,9 @@ def positions_threshold_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. @@ -257,6 +261,10 @@ def positions_threshold_from( if threshold < minimum_threshold: return minimum_threshold + if maximum_threshold is not None: + if threshold > maximum_threshold: + return maximum_threshold + return threshold def positions_likelihood_from( @@ -380,6 +388,7 @@ def positions_likelihood_from( threshold = self.positions_threshold_from( factor=factor, minimum_threshold=minimum_threshold, + maximum_threshold=maximum_threshold, positions=positions, plane_redshift=plane_redshift, )