gists/misc.py
2016-05-25 07:31:48 -07:00

19 lines
545 B
Python
Executable file

import sys
lament = lambda *args, **kwargs: print(*args, file=sys.stderr, **kwargs)
def die(*args, **kwargs):
# just for ad-hoc debugging really
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('_')]