def instantiate_dist(name, *opts):
"""
Creates distribution for the given command-line arguments.
"""
try:
dist = getattr(stats, name)
except AttributeError:
raise ValueError("No such distribution {}".format(name))
opts = list(opts)
try:
loc = float(opts.pop(0))
except IndexError:
loc = 0
try:
scale = float(opts.pop(0))
except IndexError:
scale = 1
return dist(*map(float, opts), loc=loc, scale=scale)
评论列表
文章目录