From 81ffb2e92dd64b706b1cb9b44ced8dbf9b4bdd7b Mon Sep 17 00:00:00 2001 From: Caitlyn Wolf Date: Tue, 27 Jun 2023 13:14:35 -0400 Subject: [PATCH 1/3] Fixed inverse q-spacing in the geometric extrapolation function --- sasmodels/resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sasmodels/resolution.py b/sasmodels/resolution.py index 27d7b255..24dc3bf8 100644 --- a/sasmodels/resolution.py +++ b/sasmodels/resolution.py @@ -500,7 +500,7 @@ def geometric_extrapolation(q, q_min, q_max, points_per_decade=None): if points_per_decade is None: log_delta_q = (len(q) - 1) / (log(q[-1]) - log(q[0])) else: - log_delta_q = log(10.) / points_per_decade + log_delta_q = points_per_decade / log(10.) if q_min < q[0]: if q_min < 0: q_min = q[0]*MINIMUM_ABSOLUTE_Q From f07dc5df87e9d7aabf9a36befcc2921acddf06ff Mon Sep 17 00:00:00 2001 From: Caitlyn Wolf Date: Tue, 27 Jun 2023 13:38:51 -0400 Subject: [PATCH 2/3] fixing typo from resolving merge conflict to ensure inverse term of log_delta_q is calculated when points_per_decade is specified --- sasmodels/resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sasmodels/resolution.py b/sasmodels/resolution.py index 05750718..2827ea3a 100644 --- a/sasmodels/resolution.py +++ b/sasmodels/resolution.py @@ -514,7 +514,7 @@ def geometric_extrapolation(q, q_min, q_max, points_per_decade=None): else: log_delta_q = DEFAULT_POINTS_PER_DECADE / log(10.) else: - points_per_decade / log_delta_q = log(10.) + log_delta_q = points_per_decade / log(10.) if q_min < data_min: if q_min < 0: q_min = data_min*MINIMUM_ABSOLUTE_Q From 98053f4fe246668e5247487785c0c7aeb4a1773b Mon Sep 17 00:00:00 2001 From: Caitlyn Wolf Date: Thu, 18 Jan 2024 11:09:48 -0500 Subject: [PATCH 3/3] switched the log_delta_q parameter in the first place so the variable name is accurate --- sasmodels/resolution.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sasmodels/resolution.py b/sasmodels/resolution.py index 2827ea3a..619296af 100644 --- a/sasmodels/resolution.py +++ b/sasmodels/resolution.py @@ -510,20 +510,20 @@ def geometric_extrapolation(q, q_min, q_max, points_per_decade=None): data_min, data_max = q[0], q[-1] if points_per_decade is None: if data_max > data_min: - log_delta_q = (len(q) - 1) / (log(data_max) - log(data_min)) + log_delta_q = (log(data_max) - log(data_min)) / (len(q) - 1) else: - log_delta_q = DEFAULT_POINTS_PER_DECADE / log(10.) + log_delta_q = log(10.) / DEFAULT_POINTS_PER_DECADE else: - log_delta_q = points_per_decade / log(10.) + log_delta_q = log(10.) / points_per_decade if q_min < data_min: if q_min < 0: q_min = data_min*MINIMUM_ABSOLUTE_Q - n_low = int(np.ceil(log_delta_q * (log(q[0])-log(q_min)))) + n_low = int(np.ceil((log(q[0])-log(q_min)) / log_delta_q)) q_low = np.logspace(log10(q_min), log10(q[0]), n_low+1)[:-1] else: q_low = [] if q_max > data_max: - n_high = int(np.ceil(log_delta_q * (log(q_max)-log(data_max)))) + n_high = int(np.ceil((log(q_max)-log(data_max)) / log_delta_q)) q_high = np.logspace(log10(data_max), log10(q_max), n_high+1)[1:] else: q_high = []