gists/misc.py
2016-05-24 20:15:26 -07:00

18 lines
506 B
Python
Executable file

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('_')]