Skip to content

Commit

Permalink
Merge pull request lenstronomy#608 from sibirrer/main
Browse files Browse the repository at this point in the history
bug fix in analytical lens equation solver when using SIE+CONVERGENCE
  • Loading branch information
sibirrer committed May 15, 2024
2 parents 58ce503 + 1f493f2 commit 70f1bc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lenstronomy/LensModel/Solver/lens_equation_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def image_position_analytical(
# lens mapping
# power-law scaling with mst
# alpha = theta_E * (r2 / theta_E**2) ** (1 - gamma / 2.0)
gamma = kwargs_lens[0]["gamma"] if "gamma" in kwargs_lens[0] else 1
gamma = kwargs_lens[0]["gamma"] if "gamma" in kwargs_lens[0] else 2

kwargs_lens_[0]["theta_E"] /= lambda_mst ** (1.0 / (gamma - 1))
if "SHEAR" in lens_model_list:
Expand Down
3 changes: 2 additions & 1 deletion test/test_LensModel/test_Solver/test_lens_equation_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,11 @@ def test_analytical_sie(self):
sourcePos_x = 0.03
sourcePos_y = 0.0

lensModel = LensModel(["SIE"])
lensModel = LensModel(["SIE", "CONVERGENCE"])
lensEquationSolver = LensEquationSolver(lensModel)
kwargs_lens = [
{"theta_E": 1.0, "center_x": 0.0, "center_y": 0.0, "e1": 0.5, "e2": 0.05},
{"kappa": 0.2, "ra_0": 0, "dec_0": 0},
]

x_pos, y_pos = lensEquationSolver.image_position_from_source(
Expand Down

0 comments on commit 70f1bc4

Please sign in to comment.