Serialize¶
The deserializer entrypoint for objects saved with the |
|
Save a serialized set of data to file for later deserialization. |
load¶
save¶
- mrmustard.utils.serialize.save(cls, filename=None, do_zip=True, arrays=None, **data)[source]¶
Save a serialized set of data to file for later deserialization.
This function can serialize any object that implements the MrMustard serialization interface, which is the following:
@classmethod def deserialize(cls, data: dict) -> cls
Though not required to satisfy the interface, it is conventional for a class to implement an instance method called
serializethat takes no arguments, calls this function with its data, and returns the Path result.- Parameters:
cls (type) – The object type being serialized
- Keyword Arguments:
filename (str) – A custom filename to save the data to
do_zip (bool) – If arrays are provided, zip results
arrays (Dict[str, NDArray]) – A dict of array-like objects to be serialized
data (Dict[Any, Any]) – A JSON-serializable dict of arbitrary data to save
- Returns:
the path to the saved object, to be retrieved later with
load- Return type:
Path