velocyto.serialization module

velocyto.serialization.dump_hdf5(obj: object, filename: str, data_compression: int = 7, chunks: typing.Tuple = (2048, 2048), noarray_compression: int = 9, pickle_protocol: int = 2) → None[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: typing.Type[object]) → object[source]

Dump all attribute of a python object to hdf5

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