gustaf.helpers.data.make_tracked_array#

gustaf.helpers.data.make_tracked_array(array, dtype=None, copy=True)[source]#

Taken from nice implementations of trimesh (see LICENSE.txt). https://github.com/mikedh/trimesh/blob/main/trimesh/caching.py.

Properly subclass a numpy ndarray to track changes. Avoids some pitfalls of subclassing by forcing contiguous arrays and does a view into a TrackedArray.

Factory-like wrapper function for TrackedArray.

Parameters:
  • array (array- like object) – To be turned into a TrackedArray

  • dtype (np.dtype) – Which dtype to use for the array

  • copy (bool) – Default is True. copy if True.

Returns:

tracked – Contains input array data

Return type:

TrackedArray