@@ -197,6 +197,7 @@ def positions_threshold_from(
197197 self ,
198198 factor = 1.0 ,
199199 minimum_threshold = None ,
200+ maximum_threshold = None ,
200201 positions : Optional [aa .Grid2DIrregular ] = None ,
201202 plane_redshift : Optional [float ] = None ,
202203 ) -> float :
@@ -224,6 +225,9 @@ def positions_threshold_from(
224225 minimum_threshold
225226 The output threshold is rounded up to this value if it is below it, to avoid extremely small threshold
226227 values.
228+ maximum_threshold
229+ The output threshold is rounded down to this value if it is above it, to avoid extremely large threshold
230+ values.
227231 positions
228232 If input, these positions are used instead of the computed multiple image positions from the lens mass
229233 model.
@@ -257,6 +261,10 @@ def positions_threshold_from(
257261 if threshold < minimum_threshold :
258262 return minimum_threshold
259263
264+ if maximum_threshold is not None :
265+ if threshold > maximum_threshold :
266+ return maximum_threshold
267+
260268 return threshold
261269
262270 def positions_likelihood_from (
@@ -380,6 +388,7 @@ def positions_likelihood_from(
380388 threshold = self .positions_threshold_from (
381389 factor = factor ,
382390 minimum_threshold = minimum_threshold ,
391+ maximum_threshold = maximum_threshold ,
383392 positions = positions ,
384393 plane_redshift = plane_redshift ,
385394 )
0 commit comments