mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 20:13:41 +02:00
fix: root module now also works with irregular monte carlo chains
This commit is contained in:
parent
f808c2243e
commit
b2a249302a
2 changed files with 16 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
import scipy.optimize
|
||||
from autograd import jacobian
|
||||
from .obs import derived_observable, pseudo_Obs
|
||||
from .obs import derived_observable
|
||||
|
||||
|
||||
def find_root(d, func, guess=1.0, **kwargs):
|
||||
|
@ -33,4 +33,6 @@ def find_root(d, func, guess=1.0, **kwargs):
|
|||
da = jacobian(lambda u, v: func(v, u))(d.value, root[0])
|
||||
deriv = - da / dx
|
||||
|
||||
return derived_observable(lambda x, **kwargs: x[0], [pseudo_Obs(root, 0.0, d.names[0], d.shape[d.names[0]]), d], man_grad=[0, deriv])
|
||||
res = derived_observable(lambda x, **kwargs: x[0], [d], man_grad=[deriv])
|
||||
res._value = root[0]
|
||||
return res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue