Skip to content

Commit

Permalink
Merge pull request lenstronomy#576 from sibirrer/main
Browse files Browse the repository at this point in the history
ready for release 1.11.6 with docstrings updated
  • Loading branch information
sibirrer authored Jan 25, 2024
2 parents 406ad38 + ba2d612 commit 8600471
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 36 deletions.
12 changes: 11 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,14 @@ History
1.11.5 (2023-09-28)
+++++++++++++++++++
* bug fix in findOverlap function
* bug fix in luminosity-0weighted celocity dispersion calculation
* bug fix in luminosity-0weighted velocity dispersion calculation

1.11.6 (2024-01-24)
+++++++++++++++++++
* bug fix with partial kwargs in kwargs_tracer mode
* stability and documentation improvements
* name change from GNFW -> PSEUDO_DPL
* improved plotting of point sources and caustics on top of pixelated images
* RADIAL_INTERPOL lens profile
* improved description of how to add new lenses
* Debug findOverlap parantheses of image_util.py
62 changes: 59 additions & 3 deletions docs/lenstronomy.LensModel.Profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ lenstronomy.LensModel.Profiles.base\_profile module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.blank\_plane module
--------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.blank_plane
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.chameleon module
-----------------------------------------------

Expand Down Expand Up @@ -180,6 +188,14 @@ lenstronomy.LensModel.Profiles.epl module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.epl\_boxydisky module
----------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.epl_boxydisky
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.epl\_numba module
------------------------------------------------

Expand Down Expand Up @@ -244,10 +260,10 @@ lenstronomy.LensModel.Profiles.gaussian\_potential module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.general\_nfw module
--------------------------------------------------
lenstronomy.LensModel.Profiles.gnfw module
------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.general_nfw
.. automodule:: lenstronomy.LensModel.Profiles.gnfw
:members:
:undoc-members:
:show-inheritance:
Expand Down Expand Up @@ -316,6 +332,14 @@ lenstronomy.LensModel.Profiles.nfw module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.nfw\_core\_truncated module
----------------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.nfw_core_truncated
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.nfw\_ellipse module
--------------------------------------------------

Expand All @@ -340,6 +364,14 @@ lenstronomy.LensModel.Profiles.nfw\_mass\_concentration module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.nfw\_mass\_concentration\_ellipse module
-----------------------------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.nfw_mass_concentration_ellipse
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.nfw\_vir\_trunc module
-----------------------------------------------------

Expand Down Expand Up @@ -404,6 +436,22 @@ lenstronomy.LensModel.Profiles.point\_mass module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.pseudo\_double\_powerlaw module
--------------------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.pseudo_double_powerlaw
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.radial\_interpolated module
----------------------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.radial_interpolated
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.sersic module
--------------------------------------------

Expand Down Expand Up @@ -516,6 +564,14 @@ lenstronomy.LensModel.Profiles.spp module
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.synthesis module
-----------------------------------------------

.. automodule:: lenstronomy.LensModel.Profiles.synthesis
:members:
:undoc-members:
:show-inheritance:

lenstronomy.LensModel.Profiles.tnfw module
------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions lenstronomy/Analysis/kinematics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def __init__(
lenstronomy.Galkin.aperture for options
:param kwargs_seeing: seeing condition of spectroscopic observation, corresponds
to kwargs_psf in the GalKin module specified in lenstronomy.GalKin.psf
:param cosmo: astropy.cosmology instance, if None then will be set to the
:param cosmo: ~astropy.cosmology instance, if None then will be set to the
default cosmology
:param lens_model_kinematics_bool: bool list of length of the lens model. Only
takes a subset of all the models as part of the kinematics computation (
can be used to ignore substructure, shear etc that do not describe the
main deflector potential
:param light_model_kinematics_bool: bool list of length of the light model. Only
takes a subset of all the models as part of the kinematics computation (can
be used to ignore light components that do not describe the main deflector
be used to ignore light components that do not describe the main deflector)
:param multi_observations: bool, if True uses multi-observation to predict a set
of different observations with the GalkinMultiObservation() class.
kwargs_aperture and kwargs_seeing require to be lists of the individual
Expand All @@ -69,7 +69,7 @@ def __init__(
MamonLokasAnisotropy() class of lenstronomy.GalKin.anisotropy
:param analytic_kinematics: boolean, if True, used the analytic JAM modeling for
a power-law profile on top of a Hernquist light profile
ATTENTION: This may not be accurate for your specific problem!
ATTENTION: This may not be accurate for your specific problem!
:param Hernquist_approx: bool, if True, uses a Hernquist light profile matched
to the half light radius of the deflector light profile to compute the
kinematics
Expand Down
8 changes: 4 additions & 4 deletions lenstronomy/LensModel/MultiPlane/multi_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def __init__(
:param ignore_observed_positions: bool, if True, will ignore the conversion between observed to physical
position of deflectors
:param z_source_convention: float, redshift of a source to define the reduced deflection angles of the lens
models. If None, 'z_source' is used.
models. If None, 'z_source' is used.
:param z_lens_convention: float, redshift of a lens plane to define the
effective time-delay distance. Only needed if distance ratios are
sampled. If None, the first lens redshift is used.
effective time-delay distance. Only needed if distance ratios are
sampled. If None, the first lens redshift is used.
:param kwargs_synthesis: keyword arguments for the 'SYNTHESIS' lens model, if applicable
:param distance_ratio_sampling: bool, if True, will use sampled
distance ratios to update T_ij value in multi-lens plane computation.
distance ratios to update T_ij value in multi-lens plane computation.
"""

if z_source_convention is None:
Expand Down
8 changes: 5 additions & 3 deletions lenstronomy/LensModel/Profiles/base_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class LensProfileBase(object):
1. make a new python file in this folder
2. create a class inheriting this class; YourModel(LensProfileBase)
3. write new definitions following the same input and output conventions as this base class
function(x, y, <other parameters>)
derivatives(x, y, <other parameters>)
hessian(x, y, <other parameters>)
- function(x, y, <other parameters>)
- derivatives(x, y, <other parameters>)
- hessian(x, y, <other parameters>)
4. set the variables for sampling the new profile
param_names = ["param1", "param2", ...]
lower_limit_default = {"param1": value, "param2: value, ...}
upper_limit_default = {"param1": value, "param2: value, ...}
5. give the new profile a meaningful name and add it in the LensModel.profile_list_base class
6. write test functions in the test/test_LensModel/test_Profiles folder with a new file with test_<profile name>.py
Expand Down
4 changes: 2 additions & 2 deletions lenstronomy/LensModel/Profiles/epl_boxydisky.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class EPL_BOXYDISKY(LensProfileBase):
:param center_x: center of distortion
:param center_y: center of distortion
:param a4_a: Strength of the deviation of multipole order 4 of the elliptical isodensity contours,
which is translated into the multipole strength from the MULTIPOLE class through a rescaling by theta_E / sqrt(q).
Profile is disky when a4_a>0 and boxy when a4_a<0.
which is translated into the multipole strength from the MULTIPOLE class through a rescaling by theta_E / sqrt(q).
Profile is disky when a4_a>0 and boxy when a4_a<0.
"""

param_names = ["theta_E", "gamma", "e1", "e2", "center_x", "center_y", "a4_a"]
Expand Down
13 changes: 7 additions & 6 deletions lenstronomy/LensModel/Profiles/gnfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class GNFW(LensProfileBase):
This class computes the lensing quantities of a generalized NFW profile:
.. math::
\rho(r) = \frac{\rho_{\rm s}} { (r/r_{\rm s}})^{\gamma_{\rm in}} * (1 + r/r_{\rm
s})^{3 - {\gamma_{\rm in}}}
\\rho(r) = \\frac{\\rho_{\\rm s}} { (r/r_{\\rm s}})^{\\gamma_{\\rm in}} * (1 + r/r_{\\rm
s})^{3 - {\\gamma_{\\rm in}}}
This class uses the normalization parameter `kappa_s` defined as:
.. math::
kappas_{\rm s} = \frac{\rho_{\rm s} r_{\rm s}}{\Sigma_{\rm crit}}
kappas_{\\rm s} = \\frac{\\rho_{\\rm s} r_{\\rm s}}{\\Sigma_{\\rm crit}}
Some expressions are obtained from Keeton 2001 (
https://ui.adsabs.harvard.edu/abs/2001astro.ph..2341K/abstract). See and cite the
Some expressions are obtained from Keeton 2001
https://ui.adsabs.harvard.edu/abs/2001astro.ph..2341K/abstract. See and cite the
references therein.
"""

Expand All @@ -46,8 +46,9 @@ class GNFW(LensProfileBase):

def __init__(self, trapezoidal_integration=False, integration_steps=1000):
"""
:param trapezoidal_integrate: bool, if True, the numerical integral is performed
with the trapezoidal rule, otherwise with scipy.integrate.quad
with the trapezoidal rule, otherwise with ~scipy.integrate.quad
:param integration_steps: number of steps in the trapezoidal integral
"""
super(GNFW, self).__init__()
Expand Down
12 changes: 6 additions & 6 deletions lenstronomy/LensModel/Profiles/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class SynthesisProfile(LensProfileBase):
"""A general class which describes a linear sum of many simple profiles to
approximate a target profile.
Example: Mimic an NFW profile with many CSE profiles. In this case, you could use LensModel(['SYNTHESIS'],kwargs_synthesis=kwargs_synthesis) with
kwargs_synthesis={'target_lens_model': 'NFW',
'component_lens_model': 'CSE',
'kwargs_list': kwargs_list,
'lin_fit_hyperparams':{'lower_log_bound':-6, 'upper_log_bound':3, 'num_r_evals':100, 'sigma':0.01} (default values)
}
Example: Mimic an NFW profile with many CSE profiles. In this case, you could use LensModel(['SYNTHESIS'],
kwargs_synthesis=kwargs_synthesis)
with
kwargs_synthesis={'target_lens_model': 'NFW', 'component_lens_model': 'CSE', 'kwargs_list': kwargs_list,
'lin_fit_hyperparams':{'lower_log_bound':-6, 'upper_log_bound':3, 'num_r_evals':100, 'sigma':0.01} (default values)
}
where kwargs_list would be a list of input CSE kwargs (where the amplitude will be re-adjusted).
"""

Expand Down
4 changes: 2 additions & 2 deletions lenstronomy/LensModel/lens_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def __init__(
:param z_interp_stop: (only in multi-plane with cosmo_interp=True); maximum redshift for distance interpolation
This number should be higher or equal the maximum of the source redshift and/or the z_source_convention
:param num_z_interp: (only in multi-plane with cosmo_interp=True); number of redshift bins for interpolating
distances
distances
:param distance_ratio_sampling: bool, if True, will use sampled
distance ratios to update T_ij value in multi-lens plane computation.
distance ratios to update T_ij value in multi-lens plane computation.
"""
self.lens_model_list = lens_model_list
self.z_lens = z_lens
Expand Down
8 changes: 5 additions & 3 deletions lenstronomy/Sampling/special_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class SpecialParam(object):
"""Class that handles special parameters that are not directly part of a specific
model component.
These includes cosmology relevant parameters, astrometric errors and overall scaling
These include cosmology relevant parameters, astrometric errors and overall scaling
parameters.
"""

Expand Down Expand Up @@ -235,9 +235,11 @@ def __init__(
Warning: this is only defined for pixel-based source modelling (e.g. 'SLIT_STARLETS' light profile)
:param kinematic_sampling: bool, if True, samples the kinematic parameters b_ani, incli, with cosmography
D_dt (overrides _D_dt_sampling) and Dd
:param distance_ratio_sampling: bool, if True, the distance ratios will be sampled. Only applicable for multi-plane case, will turn-off Ddt_sampling by default as Ddt will be sampled as a ratio with a fiducial value in this option.
:param distance_ratio_sampling: bool, if True, the distance ratios will be sampled.
Only applicable for multi-plane case, will turn-off Ddt_sampling by default as Ddt will be sampled as a
ratio with a fiducial value in this option.
:param num_lens_planes: integer, number of lens planes when `distance_ratio_sampling` is True
sampled
sampled
"""
self._num_lens_planes = num_lens_planes
self._distance_ratio_sampling = DistanceRatioFactorsAB(
Expand Down
2 changes: 1 addition & 1 deletion lenstronomy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "lenstronomy developers"
__email__ = "lenstronomy-dev@googlegroups.com"
__version__ = "1.11.5"
__version__ = "1.11.6"
__credits__ = "ETH Zurich, UCLA, Stanford, Stony Brook"

from .Util.package_util import short, laconic
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def run_tests(self):

setup(
name="lenstronomy",
version="1.11.5",
version="1.11.6",
description="Strong lens modeling package.",
long_description=desc,
author="lenstronomy developers",
author_email="lenstronomy-dev@googlegroups.com",
url="https://github.com/lenstronomy/lenstronomy",
download_url="https://github.com/lenstronomy/lenstronomy/archive/1.11.5.tar.gz",
download_url="https://github.com/lenstronomy/lenstronomy/archive/1.11.6.tar.gz",
packages=find_packages(PACKAGE_PATH, "test"),
package_dir={"lenstronomy": "lenstronomy"},
include_package_data=True,
Expand Down

0 comments on commit 8600471

Please sign in to comment.