Skip to content

Commit 8e8d240

Browse files
authored
Merge pull request #507 from PyAutoLabs/feature/positions_threshold
Feature/positions threshold
2 parents b585794 + e8ee745 commit 8e8d240

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

autolens/analysis/result.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)