zokyo.utils.misc module

zokyo.utils.misc.from_float(img, dtype, max_value=None)[source]
zokyo.utils.misc.get_git_revision_short_hash()[source]

Get the short revision hash of a git commit

zokyo.utils.misc.get_or_set_env(env_var, default_value)[source]

Return either a environment variable or default value for the variable if the value is either None or an empty string.

zokyo.utils.misc.is_iterable(x)[source]

Determine whether x is a non-string iterable

zokyo.utils.misc.str_to_random_state(x, first_n=9)[source]

Seed a Numpy random state from a seed

Hashes the string, takes the first N characters of the absolute value of the integer hash result (since numpy random state seeds must be < 2**32-1) and seeds a random state. This allows us to create reproducible random states given a string as input (particularly for data creation).

zokyo.utils.misc.to_float(img, max_value=None)[source]