def store_feature_array( feats: np.ndarray, storage: FeaturesWriter, ) -> str: """ Store ``feats`` array on disk, using ``lilcom`` compression by default. :param feats: a numpy ndarray containing features. :param storage: a ``FeaturesWriter`` object to use for array storage. :return: a path to the file containing the stored array. """ feats_id = str(uuid4()) storage_key = storage.write(feats_id, feats) return storage_key
def copy_feats(self, writer: FeaturesWriter) -> "Features": """ Read the referenced feature array and save it using ``writer``. Returns a copy of the manifest with updated fields related to the feature storage. """ feats = self.load() new_key = writer.write(self.storage_key, feats) item = fastcopy( self, storage_type=writer.name, storage_path=writer.storage_path, storage_key=new_key, ) return item