Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include a magnification limit to remove highly de-magnified images #59

Merged
merged 8 commits into from
Sep 13, 2023
11 changes: 11 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ Finally add the ``sim-pipeline-project`` repository as a *remote*. This will all
git remote add sim-pipeline-project https://github.com/LSST-strong-lensing/sim-pipeline.git


Install sim-pipeline in development mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To run your own version of sim-pipeline and making sure that your own development changes are reflected (as well as switcing branches),
install the sim-pipeline package in development mode with

::

cd sim-pipeline
python setup.py develop --user


Create a branch for your new feature
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
14 changes: 11 additions & 3 deletions sim_pipeline/galaxy_galaxy_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(
mixgauss_means=None,
mixgauss_stds=None,
mixgauss_weights=None,
magnification_limit=0.01
):
"""

Expand All @@ -39,6 +40,9 @@ def __init__(
:type mixgauss_weights: list of float
:type mixgauss_stds: list of float
:type mixgauss_means: list of float
:param magnification_limit: absolute lensing magnification lower limit to
register a point source (ignore highly de-magnified images)
:type magnification_limit: float >= 0
"""
self._source_dict = source_dict
self._lens_dict = deflector_dict
Expand All @@ -48,6 +52,7 @@ def __init__(
self._mixgauss_means = mixgauss_means
self._mixgauss_stds = mixgauss_stds
self._mixgauss_weights = mixgauss_weights
self._magnification_limit = magnification_limit
if self._lens_dict["z"] >= self._source_dict["z"]:
self._theta_E_sis = 0
else:
Expand Down Expand Up @@ -97,8 +102,8 @@ def source_position(self):

def image_positions(self):
"""Return image positions by solving the lens equation. These are either the
centers of the extended source, or the point sources in case of (added) point-
like sources, such as quasars or SNe.
centers of the extended source, or the point sources in case of (added)
point-like sources, such as quasars or SNe.

:return: x-pos, y-pos
"""
Expand All @@ -119,6 +124,7 @@ def image_positions(self):
solver="lenstronomy",
search_window=self.einstein_radius * 6,
min_distance=self.einstein_radius * 6 / 100,
magnification_limit=self._magnification_limit
)
return self._image_positions

Expand Down Expand Up @@ -172,7 +178,9 @@ def validity_test(
# Criteria 6: (optional)
# compute the magnified brightness of the lensed extended arc for different
# bands at least in one band, the magnitude has to be brighter than the limit
if mag_arc_limit is not None:
if mag_arc_limit is not None and self._source_type in ['extended']:
# makes sure magnification of extended source is only used when there is
# an extended source
bool_mag_limit = False
host_mag = self.host_magnification()
for band, mag_limit_band in mag_arc_limit.items():
Expand Down