mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01: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,7 +758,9 @@ def derived_observable(func, data, **kwargs):
|
|||
else:
|
||||
if new_shape[name] != tmp:
|
||||
raise Exception('Shapes of ensemble', name, 'do not match.')
|
||||
|
||||
if data.ndim == 1:
|
||||
values = np.array([o.value for o in data])
|
||||
else:
|
||||
values = np.vectorize(lambda x: x.value)(data)
|
||||
|
||||
new_values = func(values, **kwargs)
|
||||
|
|
Loading…
Add table
Reference in a new issue