Пример #1
0
if __name__ == "__main__":
    pfn, dir_name, file = setup(__file__)

    r = True
    models = [
        PowerBeutler2017(recon=r, smooth_type="hinton2017", name="Hinton2017"),
        PowerBeutler2017(recon=r, smooth_type="eh1998", name="EH1998")
    ]
    data = PowerSpectrum_SDSS_DR12_Z061_NGC(name="Recon mean",
                                            recon=r,
                                            min_k=0.02,
                                            max_k=0.30)
    sampler = DynestySampler(temp_dir=dir_name)

    fitter = Fitter(dir_name)
    fitter.add_model_and_dataset(models[0], data, name="Hinton2017")
    fitter.add_model_and_dataset(models[1], data, name="EH1998")
    fitter.set_sampler(sampler)
    fitter.set_num_walkers(10)
    fitter.fit(file)

    if fitter.should_plot():
        from chainconsumer import ChainConsumer

        c = ChainConsumer()
        pks = {}
        for posterior, weight, chain, model, data, extra in fitter.load():
            c.add_chain(chain,
                        weights=weight,
                        parameters=model.get_labels(),
import sys

sys.path.append("..")
from barry.samplers import DynestySampler
from barry.cosmology.camb_generator import getCambGenerator
from barry.postprocessing import BAOExtractor
from barry.config import setup
from barry.models import PowerSeo2016, PowerBeutler2017, PowerDing2018, PowerNoda2019
from barry.datasets import PowerSpectrum_SDSS_DR12_Z061_NGC
from barry.fitter import Fitter
import numpy as np
import pandas as pd

if __name__ == "__main__":
    pfn, dir_name, file = setup("../config/pk_individual.py")
    fitter = Fitter(dir_name, save_dims=2, remove_output=False)

    c = getCambGenerator()
    r_s = c.get_data()[0]
    p = BAOExtractor(r_s)

    sampler = DynestySampler(temp_dir=dir_name, nlive=200)

    for r in [True, False]:
        t = "Recon" if r else "Prerecon"
        ls = "-" if r else "--"

        d = PowerSpectrum_SDSS_DR12_Z061_NGC(recon=r, realisation=0)
        de = PowerSpectrum_SDSS_DR12_Z061_NGC(recon=r,
                                              postprocess=p,
                                              realisation=0)
Пример #3
0
import os
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d

sys.path.append("..")
from barry.config import setup
from barry.models import CorrBeutler2017, CorrDing2018, CorrSeo2016
from barry.datasets import CorrelationFunction_SDSS_DR12_Z061_NGC
from barry.samplers import DynestySampler
from barry.fitter import Fitter

if __name__ == "__main__":
    pfn, dir_name, file = setup(__file__)
    sampler = DynestySampler(temp_dir=dir_name, nlive=1000)
    fitter = Fitter(dir_name, remove_output=False)

    cs = ["#262232", "#116A71", "#48AB75", "#D1E05B"]
    for r in [True, False]:
        t = "Recon" if r else "Prerecon"
        ls = "-" if r else "--"
        d = CorrelationFunction_SDSS_DR12_Z061_NGC(recon=r)

        # Fix sigma_nl for one of the Beutler models
        model = CorrBeutler2017()
        sigma_nl = 6.0 if r else 9.3
        model.set_default("sigma_nl", sigma_nl)
        model.set_fix_params(["om", "sigma_nl"])

        fitter.add_model_and_dataset(CorrBeutler2017(), d, name=f"Beutler 2017 {t}", linestyle=ls, color=cs[0])
        fitter.add_model_and_dataset(model, d, name=f"Beutler 2017 Fixed $\\Sigma_{{nl}}$ {t}", linestyle=ls, color=cs[0])
Пример #4
0
sys.path.append("../..")
from barry.samplers import DynestySampler
from barry.config import setup
from barry.models import PowerBeutler2017
from barry.datasets.dataset_power_spectrum import PowerSpectrum_DESIMockChallenge_Post
from barry.fitter import Fitter
import numpy as np
import pandas as pd
from barry.models.model import Correction
from barry.utils import weighted_avg_and_cov, break_vector_and_get_blocks
import matplotlib as plt
from matplotlib import cm

if __name__ == "__main__":
    pfn, dir_name, file = setup(__file__)
    fitter = Fitter(dir_name, remove_output=True)

    sampler = DynestySampler(temp_dir=dir_name, nlive=500)

    names = [
        "PostRecon Yuyu NonFix ",
        "PostRecon Yuyu NonFix ",
    ]
    cmap = plt.cm.get_cmap("viridis")

    smoothtypes = [1, 2, 3, 4]  # [5, 10, 15, 20] Mpc/h
    kmaxs = [0.15, 0.20, 0.25, 0.30]

    allnames = []
    counter = 0
    fit_poles = [0, 2, 4]