From 30b86d8d3f85aacb4e5be00be5290984e525d645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 18 May 2024 14:15:51 -0400 Subject: [PATCH] STYLE: Fix function definition loop variable binding warning Fix function definition loop variable binding warning. Fixes: ``` dipy/reconst/csdeconv.py:531:31: B023 Function definition does not bind loop variable `j` dipy/reconst/csdeconv.py:540:31: B023 Function definition does not bind loop variable `j` ``` raised for example in: https://github.com/dipy/dipy/actions/runs/9141052535/job/25135036670?pr=3228#step:4:114 --- dipy/reconst/csdeconv.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dipy/reconst/csdeconv.py b/dipy/reconst/csdeconv.py index 36dec34b50..151ed26888 100644 --- a/dipy/reconst/csdeconv.py +++ b/dipy/reconst/csdeconv.py @@ -528,7 +528,7 @@ def forward_sdt_deconv_mat(ratio, l_values, r2_term=False): for j in np.arange(0, n_orders * 2, 2): if r2_term: sharp = quad( - lambda z: lpn(j, z)[0][-1] + lambda z, j=j: lpn(j, z)[0][-1] * gamma(1.5) * np.sqrt(ratio / (4 * np.pi**3)) / np.power((1 - (1 - ratio) * z**2), 1.5), @@ -537,7 +537,8 @@ def forward_sdt_deconv_mat(ratio, l_values, r2_term=False): ) else: sharp = quad( - lambda z: lpn(j, z)[0][-1] * np.sqrt(1 / (1 - (1 - ratio) * z * z)), + lambda z, j=j: lpn(j, z)[0][-1] + * np.sqrt(1 / (1 - (1 - ratio) * z * z)), -1.0, 1.0, )