rsqsim_api.io.compressed_pickle

Utilities for saving and loading Python objects as bz2-compressed pickles.

Functions

compressed_pickle(title, data)

Serialise and compress a Python object to a bz2 pickle file.

decompress_pickle(file)

Load and decompress a Python object from a bz2 pickle file.

Module Contents

rsqsim_api.io.compressed_pickle.compressed_pickle(title, data)[source]

Serialise and compress a Python object to a bz2 pickle file.

Parameters:
  • title (str) – Output file path without extension. The suffix .pbz2 is appended automatically.

  • data – Any picklable Python object to serialise.

rsqsim_api.io.compressed_pickle.decompress_pickle(file)[source]

Load and decompress a Python object from a bz2 pickle file.

Parameters:

file (str) – Path to the .pbz2 file to read.

Returns:

The deserialised Python object stored in the file.

Return type:

object