import sys lament = lambda *args, **kwargs: print(*args, file=sys.stderr, **kwargs) def die(*args, **kwargs): lament(*args, **kwargs) sys.exit(1) def easytruncnorm(lower=0, upper=1, loc=0.5, scale=0.25): import scipy.stats as stats a = (lower - loc) / scale b = (upper - loc) / scale return stats.truncnorm(a=a, b=b, loc=loc, scale=scale) # only make some things visible to "from misc import *" __all__ = [o for o in locals() if type(o) != 'module' and not o.startswith('_')]