pynbody.util.set_array_if_not_same#
- pynbody.util.set_array_if_not_same(a_store, a_in, index=None)[source]#
Checks whether a_store and a_in ultimately point to the same buffer; if not, copy a_in into a_store.
Optionally an index or slice can be specified to specify a sub-region of a_store to copy into.
If a_store has units, they are copied from a_in if they are present.
- Parameters:
a_store (array-like) – The array to copy into
a_in (array-like) – The array to copy from
index (slice | array-like, optional) – The slice or index within a_store to copy into. If None, the target is the whole array of
a_store.