From 4f401efbb4998481c10c3f8f72b30d54754f9827 Mon Sep 17 00:00:00 2001 From: Simon Birrer Date: Wed, 15 May 2024 15:07:03 -0400 Subject: [PATCH] bug fix in analytical lens equation solver for SIE+CONVERGENCE --- lenstronomy/LensModel/Solver/lens_equation_solver.py | 2 +- test/test_LensModel/test_Solver/test_lens_equation_solver.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lenstronomy/LensModel/Solver/lens_equation_solver.py b/lenstronomy/LensModel/Solver/lens_equation_solver.py index 78280643f..e6897f710 100644 --- a/lenstronomy/LensModel/Solver/lens_equation_solver.py +++ b/lenstronomy/LensModel/Solver/lens_equation_solver.py @@ -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: diff --git a/test/test_LensModel/test_Solver/test_lens_equation_solver.py b/test/test_LensModel/test_Solver/test_lens_equation_solver.py index 2351cf1e1..8d4f2ca05 100644 --- a/test/test_LensModel/test_Solver/test_lens_equation_solver.py +++ b/test/test_LensModel/test_Solver/test_lens_equation_solver.py @@ -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(