Exemplo n.º 1
0
Arquivo: run.py Projeto: dessn/sn-bhm
    c = d["sim_c"]
    x1 = d["sim_x1"]
    alpha = 0.15
    beta = 4.0

    hist_all, bins = np.histogram(mB, bins=200)
    hist_passed, _ = np.histogram(mB[mask], bins=bins)
    binc = 0.5 * (bins[:-1] + bins[1:])
    ratio = 1.0 * hist_passed / hist_all
    inter = interp1d(ratio, binc)
    mean = inter(0.5)
    width = 0.5 * (inter(0.16) - inter(0.84))
    width += alpha * np.std(x1) + beta * np.std(c)
    return mean, width + 0.02


if __name__ == "__main__":

    file = os.path.abspath(__file__)
    stan_model = os.path.dirname(file) + "/model.stan"

    mB_mean, mB_width = get_approximate_mb_correction()
    print(mB_mean, mB_width)

    data = {
        "mB_mean": mB_mean,
        "mB_width": mB_width
    }
    print("Running %s" % file)
    run(data, stan_model, file, weight_function=add_weight_to_chain)
Exemplo n.º 2
0
Arquivo: run.py Projeto: dessn/sn-bhm
import os
from dessn.models.d_simple_stan.run import run

if __name__ == "__main__":

    file = os.path.abspath(__file__)
    stan_model = os.path.dirname(file) + "/model.stan"
    data = {"add_sim": 3000}
    print("Running %s" % file)
    run(data, stan_model, file)