Exemplo n.º 1
0
def get_prior(name, is_sigma=False):
    if name is None:
        return None
    prior_type = 'theta' if not is_sigma else 'sigma'
    path = join(priors_dir(), prior_type, name+'.txt')
    if isfile(path):
        if cfg.verbosity > 0:
            print 'Reading priors for {} from {}'.format(prior_type, path)
        with open(path) as f:
            priors = eval(f.read())
        return priors
    raise AssertionError('Could not find prior file at {}'.format(path))
Exemplo n.º 2
0
def get_allowed_priors(is_sigma=False):
    prior_type = 'theta' if not is_sigma else 'sigma'
    pattern = join(priors_dir(), prior_type, '*.txt')
    prior_files = glob(pattern)
    names = [splitext(basename(filename))[0] for filename in prior_files]
    return names