nispace.io.to_pickle

nispace.io.to_pickle(obj, filepath, use_dill=False)[source]

Pickle, compress, and save to a file.

Parameters:
  • obj (object) – Any python object to be pickled.

  • filepath (str) – File path destination; must end in .pkl, .pkl.gz, or .pkl.blosc (determines the compression method used).

  • use_dill (bool, default False) – Whether to pickle with dill instead of the standard pickle module (needed for objects pickle can’t handle, e.g. local functions/lambdas).

Raises:

ValueError – If filepath’s extension is not one of the supported formats.