velocyto.serialization module

velocyto.serialization.dump_hdf5()[source]

Dump all attribute of a python object to hdf5

Parameters:
  • obj (object) – a python object
  • filename (str) – the name of the file to be saved
  • data_compression (int) – the level of compression used by hdf5
  • chunks (Tuple, default=(2048, 2048)) – The size of the chunks to be used for compression/random access
  • noarray_compression (int, default=9) – the compression level of zlib, used when the attribute is not an array
  • pickle_protocol (int, default=2) – the protocol used by pickle.dumps when the attribute is not an array
Returns:

Return type:

Nothing but it creates a file filename

velocyto.serialization.load_hdf5(filename: str, obj_class: Type[object]) → object[source]

Load all attributes from a hdf5 encoded python object

Parameters:
  • filename – the name of the file to be loaded
  • obj_class – the type of object to be generated
Returns:

Return type:

An object that has been filled with the attributes stored in the hdf5 file

Note

The trick to create an empty object was adapted from Guido van Rossum answer: https://stackoverflow.com/questions/2168964/python-creating-class-instance-without-calling-initializer