You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be fine to have update_ancil method of change the behavior of the current set_anciil.
NB. Actually, the current implementation of the ancil property also allows me to do this and change the underlying ens._encil in the way I want, is it intentional?
ens.ancil['b'] ="hello world"
I would suggest to change the implementation to produce a shallow copy of the attribute so users do not have an access to the original data (but still could accidentally change content of the underlying numpy arrays):
@propertydefancil(self):
"""Return the ancillary data dictionary"""returnself._ancil.copy()
The text was updated successfully, but these errors were encountered:
Fixing this would also largely address LSSTDESC/rail_base#39, specifically the bits about copying over an ensemble's ancil when converting between parameterizations and the nonintuitive behavior of set_ancil and add_ancil, versus changing the value of the underlying _ancil attribute directly with =. Also, I'm happy to close that issue if folks agree it's appropriate to expand the scope of this one to add support for including ancil as a keyword argument upon instantiating a qp.Ensemble object, however, I'm probably not the best sole assignee due to unfamiliarity with the implications of the proposed design versus naive alternatives.
So, the add_to_ancil function does update() with the addition of shape checking. I suppose it could be called update_ancil, but I think the behavior should be pretty clear from the name.
And the set_ancil function set's the entire dictionary, which is pretty standard behavior for a function called 'set_xxx'.
Current
Ensemble.set_ancil
rewrites the ancil completely and doesn't preserve what is already there. So this fails:If I'd like to update it I could do something like this (in modern Python):
It would be fine to have
update_ancil
method of change the behavior of the currentset_anciil
.NB. Actually, the current implementation of the
ancil
property also allows me to do this and change the underlyingens._encil
in the way I want, is it intentional?I would suggest to change the implementation to produce a shallow copy of the attribute so users do not have an access to the original data (but still could accidentally change content of the underlying numpy arrays):
The text was updated successfully, but these errors were encountered: