From 157905760aa0baefb81e90670e99c449c93972d9 Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Wed, 30 Oct 2024 15:31:02 -0700 Subject: [PATCH] added ability to change step size on the fly --- augur/analyze.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/augur/analyze.py b/augur/analyze.py index c137730..c6c5391 100644 --- a/augur/analyze.py +++ b/augur/analyze.py @@ -212,7 +212,7 @@ def f(self, x, labels, pars_fid, sys_fid): f_out.append(self.lk.compute_theory_vector(self.tools)) return np.array(f_out) - def get_derivatives(self, force=False, method='5pt_stencil'): + def get_derivatives(self, force=False, method='5pt_stencil', step=None): """ Auxiliary function to compute numerical derivatives of the helper function `f` @@ -223,9 +223,12 @@ def get_derivatives(self, force=False, method='5pt_stencil'): method : str Method to compute derivatives, currently only `5pt_stencil` or `numdifftools` are allowed. + step : float + Step size for numerical differentiation """ - step = float(self.config['step']) + if step is None: + step = float(self.config['step']) # Compute the derivatives with respect to the parameters in var_pars at x if (self.derivatives is None) or (force): if '5pt_stencil' in method: