mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
fix: Combined fit can now handle list and array inputs for y-values, test added.
This commit is contained in:
parent
140b626aae
commit
33ff2219ba
2 changed files with 12 additions and 15 deletions
|
@ -703,12 +703,8 @@ def _combined_fit(x, y, func, silent=False, **kwargs):
|
||||||
jacobian = auto_jacobian
|
jacobian = auto_jacobian
|
||||||
hessian = auto_hessian
|
hessian = auto_hessian
|
||||||
|
|
||||||
x_all = []
|
|
||||||
y_all = []
|
|
||||||
for key in x.keys():
|
|
||||||
y_all += y[key]
|
|
||||||
|
|
||||||
x_all = np.concatenate([np.array(o) for o in x.values()])
|
x_all = np.concatenate([np.array(o) for o in x.values()])
|
||||||
|
y_all = np.concatenate([np.array(o) for o in y.values()])
|
||||||
|
|
||||||
if len(x_all.shape) > 2:
|
if len(x_all.shape) > 2:
|
||||||
raise Exception('Unknown format for x values')
|
raise Exception('Unknown format for x values')
|
||||||
|
|
|
@ -610,7 +610,8 @@ def test_ks_test():
|
||||||
|
|
||||||
def test_combined_fit_list_v_array():
|
def test_combined_fit_list_v_array():
|
||||||
res = []
|
res = []
|
||||||
y_test = {'a': [pe.Obs([np.random.normal(i, 0.5, 1000)], ['ensemble1']) for i in range(1, 7)]}
|
for y_test in [{'a': [pe.Obs([np.random.normal(i, 0.5, 1000)], ['ensemble1']) for i in range(1, 7)]},
|
||||||
|
{'a': np.array([pe.Obs([np.random.normal(i, 0.5, 1000)], ['ensemble1']) for i in range(1, 7)])}]:
|
||||||
for x_test in [{'a': [0, 1, 2, 3, 4, 5]}, {'a': np.arange(6)}]:
|
for x_test in [{'a': [0, 1, 2, 3, 4, 5]}, {'a': np.arange(6)}]:
|
||||||
for key in y_test.keys():
|
for key in y_test.keys():
|
||||||
[item.gamma_method() for item in y_test[key]]
|
[item.gamma_method() for item in y_test[key]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue