mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
speed up for derived_observable when applied to 1d observables
This commit is contained in:
parent
eacec6bfdc
commit
e73a99409c
1 changed files with 4 additions and 2 deletions
|
@ -758,8 +758,10 @@ def derived_observable(func, data, **kwargs):
|
||||||
else:
|
else:
|
||||||
if new_shape[name] != tmp:
|
if new_shape[name] != tmp:
|
||||||
raise Exception('Shapes of ensemble', name, 'do not match.')
|
raise Exception('Shapes of ensemble', name, 'do not match.')
|
||||||
|
if data.ndim == 1:
|
||||||
values = np.vectorize(lambda x: x.value)(data)
|
values = np.array([o.value for o in data])
|
||||||
|
else:
|
||||||
|
values = np.vectorize(lambda x: x.value)(data)
|
||||||
|
|
||||||
new_values = func(values, **kwargs)
|
new_values = func(values, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue