save_dataclass_npz

save_dataclass_npz#

Class method.

do_dpc.utils.serialization.save_dataclass_npz(obj, filename)[source]#

Saves a dataclass object as a .npz file, supporting NumPy arrays, floats, and integers.

Parameters:
  • obj (T) – The dataclass object to save.

  • filename (str) – The file path where the object should be stored.

Raises:

ValueError – If any field in the dataclass is not a numpy.ndarray, float, or int.

Note

  • This function only supports numerical attributes (np.ndarray, float, int).

  • Non-supported types (e.g., strings, lists, dictionaries) will raise an error.

  • Data is stored in a compressed .npz format to optimize storage.