scedar.utils

scedar.utils.dict_str_key(d)[source]

Get a hash key for a dictionary, usually used for **kwargs.

Examples

>>> dict_str_key({"a": 1, "b": 2})
"[('a', 1), ('b', 2)]"
>>> dict_str_key({"b": 2, "a": 1})
"[('a', 1), ('b', 2)]"

Notes

Non-string keys will be converted to strings before sorting, but the original value is preserved in the generated key.

scedar.utils.load_gz_obj(path)[source]

Load gzipped python object with pickle.load

Parameters:path (str) – The path to the gzipped python object to be loaded.
scedar.utils.load_obj(path)[source]

Load python object with pickle.load

Parameters:path (str) – The path to the python object to be loaded.
scedar.utils.parmap(f, X, nprocs=1)[source]

parmap_fun() and parmap() are adapted from klaus se’s post on stackoverflow. https://stackoverflow.com/a/16071616/4638182

parmap allows map on lambda and class static functions.

Fall back to serial map when nprocs=1.

scedar.utils.remove_constant_features(sfm)[source]

Remove features that are constant across all samples

scedar.utils.save_obj(obj, path)[source]

Save python object with pickle.dump

Parameters:
  • obj (object) – The python object to be saved.
  • path (str) – The path to save the python object.