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]) fitter.add_model_and_dataset(CorrSeo2016(recon=r), d, name=f"Seo 2016 {t}", linestyle=ls, color=cs[1]) fitter.add_model_and_dataset(CorrDing2018(recon=r), d, name=f"Ding 2018 {t}", linestyle=ls, color=cs[2]) fitter.set_sampler(sampler) fitter.set_num_walkers(30) fitter.fit(file) if fitter.should_plot(): import logging logging.info("Creating plots") res = fitter.load() if True: from chainconsumer import ChainConsumer if True: # This is a dirty way of faking another column in the dataset so I can keep plots visually consistent.
import logging from barry.models import CorrDing2018 if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG, format="[%(levelname)7s |%(funcName)20s] %(message)s") logging.getLogger("matplotlib").setLevel(logging.ERROR) from barry.datasets import CorrelationFunction_SDSS_DR12_Z061_NGC for recon in [True, False]: model = CorrDing2018(recon=recon) model_smooth = CorrDing2018(recon=recon, smooth=True) model.set_default("om", 0.31) model_smooth.set_default("om", 0.31) # Assuming the change from 0.675 to 0.68 is something we can ignore, or we can add h0 to the default parameters. dataset1 = CorrelationFunction_SDSS_DR12_Z061_NGC(recon=recon, reduce_cov_factor=10) data1 = dataset1.get_data() # First comparison - the actual recon data model.set_data(data1) p, minv = model.optimize() model_smooth.set_data(data1) p2, minv2 = model_smooth.optimize() print(p) print(minv) model.plot(p, smooth_params=p2) # FINDINGS # Good. gets 0.998
c4 = ["#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, realisation=0) beutler_not_fixed = CorrBeutler2017() beutler = CorrBeutler2017() sigma_nl = 5.0 if r else 8.0 beutler.set_default("sigma_nl", sigma_nl) beutler.set_fix_params(["om", "sigma_nl"]) seo = CorrSeo2016(recon=r) ding = CorrDing2018(recon=r) for i in range(999): d.set_realisation(i) fitter.add_model_and_dataset(beutler_not_fixed, d, name=f"Beutler 2017 {t}, mock number {i}", linestyle=ls, color=c4[0], realisation=i) fitter.add_model_and_dataset(beutler, d, name=f"Beutler 2017 Fixed $\\Sigma_{{nl}}$ {t}, mock number {i}", linestyle=ls, color=c4[0], realisation=i) fitter.add_model_and_dataset(seo, d, name=f"Seo 2016 {t}, mock number {i}", linestyle=ls, color=c4[1], realisation=i) fitter.add_model_and_dataset(ding, d, name=f"Ding 2018 {t}, mock number {i}", linestyle=ls, color=c4[2], realisation=i) fitter.set_sampler(sampler) fitter.set_num_walkers(1) fitter.set_num_concurrent(400) if not fitter.should_plot(): fitter.fit(file)
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]) fitter.add_model_and_dataset(CorrSeo2016(recon=r), d, name=f"Seo 2016 {t}", linestyle=ls, color=cs[1]) fitter.add_model_and_dataset(CorrDing2018(recon=r), d, name=f"Ding 2018 {t}", linestyle=ls, color=cs[2]) fitter.set_sampler(sampler) fitter.set_num_walkers(30) fitter.fit(file) if fitter.should_plot(): import logging logging.info("Creating plots") from chainconsumer import ChainConsumer
# Check correlation between pk and xi results using recon Ding if __name__ == "__main__": pfn, dir_name, file = setup(__file__) fitter = Fitter(dir_name, save_dims=2, remove_output=False) sampler = DynestySampler(temp_dir=dir_name, nlive=400) for r in [True]: t = "Recon" if r else "Prerecon" d_pk = PowerSpectrum_SDSS_DR12_Z061_NGC(recon=r, realisation=0) d_xi = CorrelationFunction_SDSS_DR12_Z061_NGC(recon=r, realisation=0) ding_pk = PowerDing2018(recon=r) ding_pk_smooth = PowerDing2018(recon=r, smooth=True) ding_xi = CorrDing2018(recon=r) ding_xi_smooth = CorrDing2018(recon=r, smooth=True) for i in range(999): d_pk.set_realisation(i) d_xi.set_realisation(i) fitter.add_model_and_dataset( ding_pk, d_pk, name=f"Ding 2018 $P(k)$, mock number {i}", linestyle="-", color="p", realisation=i) fitter.add_model_and_dataset( ding_pk_smooth,