Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 4, 2024
1 parent b41215b commit e84214a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lenstronomy/Analysis/lens_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def profile_slope(
center_y=None,
model_list_bool=None,
num_points=10,
alpha_differentials=True
alpha_differentials=True,
):
"""Computes the logarithmic power-law slope of a profile. ATTENTION: this is not
an observable!
Expand All @@ -164,7 +164,8 @@ def profile_slope(
:param center_y: center of profile from where to compute the slope
:param model_list_bool: bool list, indicate which part of the model to consider
:param num_points: number of estimates around the Einstein radius
:param alpha_differentials: if True, uses the deflection angle differentials, else the convergence differentials
:param alpha_differentials: if True, uses the deflection angle differentials,
else the convergence differentials
:type alpha_differentials: bool
:return: logarithmic power-law slope
"""
Expand All @@ -184,7 +185,9 @@ def profile_slope(
center_x + x_dr, center_y + y_dr, kwargs_lens, k=model_list_bool
)
alpha_E_dr = np.sqrt(alpha_E_dr_x_i**2 + alpha_E_dr_y_i**2)
slope = np.mean(np.log(alpha_E_dr / alpha_E_r) / np.log((radius + dr) / radius))
slope = np.mean(
np.log(alpha_E_dr / alpha_E_r) / np.log((radius + dr) / radius)
)
gamma = -slope + 2
else:
kappa = self._lens_model.kappa(
Expand Down
8 changes: 6 additions & 2 deletions test/test_Analysis/test_lens_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ def test_profile_slope(self):
"gamma": gamma_in,
}
]
gamma_out = lens_model.profile_slope(kwargs_lens, radius=1.45, alpha_differentials=True)
gamma_out = lens_model.profile_slope(
kwargs_lens, radius=1.45, alpha_differentials=True
)
npt.assert_array_almost_equal(gamma_out, gamma_in, decimal=3)
gamma_out = lens_model.profile_slope(kwargs_lens, radius=1.45, alpha_differentials=False)
gamma_out = lens_model.profile_slope(
kwargs_lens, radius=1.45, alpha_differentials=False
)
npt.assert_array_almost_equal(gamma_out, gamma_in, decimal=3)

def test_effective_einstein_radius(self):
Expand Down

0 comments on commit e84214a

Please sign in to comment.