Esempio n. 1
0
    ax.plot(x, y, "bo", markersize=3, alpha=0.4)
    ax.set_xlabel(k1)
    ax.set_ylabel(k2)

    plt.show(block=False)


if __name__ == "__main__":

    metric = "log_likelihood_kde_3d"
    # metric = "posterior"
    # metric = "posterior_ks"

    grid = ParameterGrid("blue_sedgwick_shen_final")
    df = grid.load_best_sample(metric=metric)

    dfo = load_sample()

    cond = df["selected_jig"].values == 1
    df = df[cond].reset_index(drop=True)

    # pdf = TransformedGaussianPDF(df, makeplots=MAKEPLOTS)
    pdf = TransformedKDE(df, makeplots=MAKEPLOTS)

    pvals = pdf.evaluate(dfo)
    print(np.log(pvals).sum())

    # if MAKEPLOTS:
    # pdf.summary_plot(dfo=dfo)
Esempio n. 2
0
    return result


if __name__ == "__main__":

    model_name = "blue_final"
    metric = "poisson_likelihood_2d"
    confs = None

    config = get_config()
    image_dir = os.path.join(config["directories"]["data"], "images")
    image_filename = os.path.join(image_dir, f"model_fit_{model_name}.png")

    grid = ParameterGrid(model_name)
    dfm = grid.load_best_sample(metric=metric)
    dfo = load_sample()

    keys = "uae_obs_jig", "rec_obs_jig"
    range = {k: r for k, r in zip(keys, RANGE)}
    dfs = grid.load_confident_samples(q=Q)
    dfbest = grid.load_best_sample()
    confs = get_confidence_intervals(dfs, dfbest, keys, range=range, bins=BINS1D)

    fig = plt.figure(figsize=FIGSIZE)

    spec = gridspec.GridSpec(ncols=10, nrows=2, figure=fig, hspace=0.35, wspace=1.6)
    ax1 = fig.add_subplot(spec[:, :4])
    ax2 = fig.add_subplot(spec[0, 4:])
    ax3 = fig.add_subplot(spec[1, 4:])
Esempio n. 3
0
    "colour_obs": r"$(g-r)$"
}

OBSKEYS = {
    "uae_obs_jig": "mueff_av",
    "rec_obs_jig": "rec_arcsec",
    "colour_obs": "g_r"
}

# TODO: Add KS values to graphs
# TODO: Make into grid method / plotting utils

if __name__ == "__main__":

    grid = ParameterGrid(MODEL_NAME)
    df = grid.load_best_sample(apply_prior=True, select=True)
    df = df[df["selected_jig"].values == 1].reset_index(drop=True)

    dfo = load_sample(select=True)

    fig = plt.figure(figsize=(FIGHEIGHT * len(PAR_NAMES), FIGHEIGHT * 1.2))

    for i, par_name in enumerate(PAR_NAMES):

        ax = plt.subplot(1, len(PAR_NAMES), i + 1)
        values = df[par_name].values
        ax.hist(values, color="k", alpha=0.4, **HISTKWARGS)

        if par_name in OBSKEYS:
            values_obs = dfo[OBSKEYS[par_name]].values
            rng = values.min(), values.max()