lenstronomy / lenstronomy

Multi-purpose lens modeling software package
https://lenstronomy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
183 stars 98 forks source link

Parameter bounds with image_plane_source list keyword argument #613

Closed dangilman closed 1 month ago

dangilman commented 4 months ago

When image_plane_source_list is specified for some source components, the input center_x and center_y parameters define the coordinate where the source component appears in the image plane. The upper and lower bounds therefore correspond to the upper and lower bounds of the lensed center_x and center_y positions. However, when lenstronomy checks for parameters that go out of bounds when calling the best_fit_likelihood method, the keyword arguments for center_x and center_y appear to have been transformed to the source plane, which causes a severe penalty in the likelihood if the resulting coordinate is outside the image-plane constraints on center_x and center_y. This only appears to be a problem when calculated the best fit likelihood, and does not affect the calculation of the likelihood during lens modeling.

sibirrer commented 4 months ago

ah I see. Does this appear when you do the plotting or what specific call of the best fit likelihood are you referring to?

dangilman commented 4 months ago

@sibirrer it appears when computing the BIC for a model. During the plotting routines and the lens modeling calculations themselves it doesn't cause an issue. I guess this is because the best_fit_likelihood function uses the stored self._kwargs_temp arguments in the UpdateManager class, which are recorded after mapping positions back to the source plane.

sibirrer commented 4 months ago

@dangilman should be fixed now. Let me know if you still have issues. Thank you!