mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
feat: derived_observable now uses covobs when an input is not an Obs.
This should result in a small speedup for all operations as one iteration over all data can be dropped.
This commit is contained in:
parent
ea237ed849
commit
1db59a9fdc
1 changed files with 1 additions and 9 deletions
|
@ -1053,17 +1053,9 @@ def derived_observable(func, data, array_mode=False, **kwargs):
|
|||
raveled_data = data.ravel()
|
||||
|
||||
# Workaround for matrix operations containing non Obs data
|
||||
# TODO: Find more elegant solution here.
|
||||
for i_data in raveled_data:
|
||||
if isinstance(i_data, Obs):
|
||||
first_name = i_data.names[0]
|
||||
first_shape = i_data.shape[first_name]
|
||||
first_idl = i_data.idl[first_name]
|
||||
break
|
||||
|
||||
for i in range(len(raveled_data)):
|
||||
if isinstance(raveled_data[i], (int, float)):
|
||||
raveled_data[i] = Obs([raveled_data[i] + np.zeros(first_shape)], [first_name], idl=[first_idl])
|
||||
raveled_data[i] = cov_Obs(raveled_data[i], 0.0, "~#dummy_data#~")
|
||||
|
||||
allcov = {}
|
||||
for o in raveled_data:
|
||||
|
|
Loading…
Add table
Reference in a new issue