csiborgtools/notebooks/flow/flow_calibration.ipynb
Richard Stiskalek c4557cf35b
Matching of observations (#127)
* Rename file

* Add indents

* Update imports

* Add counting

* Docs

* Add nb

* Rename nb

* Update nb

* Add PV processing

* Update nb

* Add Pantheon+groups

* Update submission scripts

* Add Pantheon+zSN

* Update nb

* Edit param

* Matchin SFI

* Update nb

* Fix path bug

* Add list of clusters

* Update imports

* Update imports

* Add cartesian & mass of clusters

* Add observation to halo matching

* Add nb

* Add inverse CDF

* Add import

* Update nb

* Add comments
2024-04-23 12:02:09 +01:00

865 KiB

Calibrating the velocity field against observations

In [3]:
# Copyright (C) 2024 Richard Stiskalek
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
import numpy as np
import matplotlib.pyplot as plt
import jax
from numpyro.infer import MCMC, NUTS, init_to_median
import corner
from getdist import plots
from scipy.stats import multivariate_normal

import csiborgtools

from flow_calibration import *

%load_ext autoreload
%autoreload 2
%matplotlib inline

paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)

LOS density & radial velocity plots

In [ ]:
# fpath = "/mnt/extraspace/rstiskalek/catalogs/A2.h5"
fpath = "/mnt/extraspace/rstiskalek/catalogs/PV_compilation_Supranta2019.hdf5"

loader_carrick = csiborgtools.flow.DataLoader("Carrick2015", "LOSS", fpath, paths, ksmooth=0)
loader_csiborg = csiborgtools.flow.DataLoader("csiborg1", "LOSS", fpath, paths, ksmooth=0)
loader_csiborg2 = csiborgtools.flow.DataLoader("csiborg2_main", "LOSS", fpath, paths, ksmooth=0)
In [ ]:
# ks = [115,  53,  77, 105,  26,  61,  86,  29,  80,  21]
ks = [19,  8, 15,  0, 16,  6, 48, 38, 26, 44]
# ks = [19]
# ks = np.random.choice(50, 10, replace=False)

# k = 6
for k in []:
    fig, axs = plt.subplots(2, 1, figsize=(7, 7), sharex=True)
    # Get rid of vertical spacing
    fig.subplots_adjust(wspace=0)

    # Plot CSiBORG
    for i in range(loader_csiborg.los_density.shape[1]):
        axs[0].plot(loader_csiborg.rdist, loader_csiborg.los_density[k, i, :], alpha=0.1, color="black")
        axs[1].plot(loader_csiborg.rdist, loader_csiborg.los_radial_velocity[k, i, :], alpha=0.1, color="black")

    # CSiBORG1
    axs[0].plot(loader_csiborg.rdist, loader_csiborg.los_density[k, :, :].mean(axis=0), color="red", label="CSiBORG1")
    axs[1].plot(loader_csiborg.rdist, loader_csiborg.los_radial_velocity[k, :, :].mean(axis=0), color="red")

    # CSiBORG2
    axs[0].plot(loader_csiborg2.rdist, loader_csiborg2.los_density[k, :, :].mean(axis=0), color="violet", label="CSiBORG2")
    axs[1].plot(loader_csiborg2.rdist, loader_csiborg2.los_radial_velocity[k, :, :].mean(axis=0), color="violet")

    # Plot Carrick+2015
    axs[0].plot(loader_carrick.rdist, loader_carrick.los_density[k, 0, :], color="blue", label="Carrick+2015")
    axs[1].plot(loader_carrick.rdist, loader_carrick.los_radial_velocity[k, 0, :] * 0.43, color="blue")


    # for i in range(2):
    #     label = "SN"
    #     rdist = loader_csiborg.cat["r_hMpc"][k]
    #     axs[i].axvline(rdist, color="violet", linestyle="--",
    #                 zorder=0, label=label)

    axs[1].set_xlabel(r"$r ~ [\mathrm{Mpc} / h]$")
    axs[0].set_ylabel(r"$\rho_{\rm LOS} / \langle \rho_{\rm matter} \rangle$")
    axs[1].set_ylabel(r"$v_{\rm LOS} ~ [\mathrm{km/s}]$")

    axs[0].set_yscale("log")

    axs[0].legend(loc="upper right")
    axs[0].set_xlim(0, 200)

    fig.tight_layout(w_pad=0, h_pad=0)
    fig.savefig(f"../plots/LOSS_los_{k}.png", dpi=500, bbox_inches="tight")

    fig.show()

Test running a model

In [89]:
fpath_data = "/mnt/extraspace/rstiskalek/catalogs/PV_compilation.hdf5"
# fpath_data = "/mnt/extraspace/rstiskalek/catalogs/A2.h5"
# fpath_data = "/mnt/extraspace/rstiskalek/catalogs/PV_mock_CB2_17417_large.hdf5"

simname = "csiborg2_main"
catalogue = "Pantheon+_groups"
loader = csiborgtools.flow.DataLoader(simname, 10, catalogue, fpath_data, paths, ksmooth=1)
get_model_kwargs = {"zcmb_max": 0.07}
10:16:51: reading the catalogue.
10:16:51: reading the interpolated field.
10:16:51: calculating the radial velocity.
/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:94: UserWarning: The number of radial steps is even. Skipping the first step at 0.0 because Simpson's rule requires an odd number of steps.
  warn(f"The number of radial steps is even. Skipping the first "

Running HMC

In [97]:
model = csiborgtools.flow.get_model(loader, **get_model_kwargs)
model_kwargs = {"sample_alpha": True, "sample_beta": True}
Selected 188/741 galaxies.
In [98]:
kernel = NUTS(model, init_strategy=init_to_median(num_samples=100))
mcmc = MCMC(kernel, num_warmup=250, num_samples=500)

rng_key = jax.random.PRNGKey(5)
In [99]:
mcmc.run(rng_key, **model_kwargs)
sample: 100%|██████████| 750/750 [00:32<00:00, 22.85it/s, 7 steps of size 4.86e-01. acc. prob=0.92]  
In [101]:
mcmc.print_summary()
samples = mcmc.get_samples(group_by_chain=False)
# print(csiborgtools.numpyro_gof(model, mcmc, model_kwargs))
                      mean       std    median      5.0%     95.0%     n_eff     r_hat
          Vext_x     -7.07     28.15     -6.90    -51.51     40.12    431.62      1.00
          Vext_y     11.58     27.69     12.30    -34.86     57.30    436.66      1.01
          Vext_z   -112.96     33.42   -113.19   -159.74    -54.83    422.45      1.00
           alpha      2.70      0.54      2.66      1.82      3.51    530.76      1.00
       alpha_cal      0.13      0.02      0.13      0.09      0.16    436.28      1.01
        beta_cal      2.71      0.30      2.69      2.19      3.18    544.84      1.00
  e_mu_intrinsic      0.14      0.02      0.14      0.10      0.17    635.61      1.00
         mag_cal    -18.50      0.03    -18.49    -18.55    -18.45    514.73      1.01
         sigma_v    178.05     15.63    177.08    156.72    205.27    516.90      1.00

Number of divergences: 0
In [102]:
#                      mean       std    median      5.0%     95.0%     n_eff     r_hat
#           Vext_x     16.25     26.81     15.10    -23.17     65.77    523.48      1.00
#           Vext_y     32.83     27.00     32.93    -13.96     75.47    322.45      1.01
#           Vext_z    -97.87     35.48    -97.78   -159.36    -42.14    422.92      1.00
#            alpha      0.96      0.12      0.95      0.78      1.18    470.16      1.00
#        alpha_cal      0.15      0.02      0.16      0.12      0.19    407.33      1.00
#         beta_cal      2.80      0.23      2.80      2.39      3.14    481.54      1.00
#   e_mu_intrinsic      0.13      0.02      0.13      0.10      0.17    511.25      1.00
#          mag_cal    -18.50      0.03    -18.50    -18.55    -18.45    390.57      1.01
#          sigma_v    169.94     14.54    169.52    146.79    193.29    784.99      1.00
In [103]:
Vmag = np.sqrt(samples["Vext_x"]**2 + samples["Vext_y"]**2 + samples["Vext_z"]**2)

V = np.vstack([samples["Vext_x"], samples["Vext_y"], samples["Vext_z"]]).T
V = csiborgtools.cartesian_to_radec(V)

l, b = csiborgtools.flow.radec_to_galactic(V[:, 1], V[:, 2])

print(f"|V|  = {np.mean(Vmag)} +- {np.std(Vmag)}")
print(f"l    = {np.mean(l)} +- {np.std(l)}")
print(f"b    = {np.mean(b)} +- {np.std(b)}")
if "beta" in samples:
    print(f"beta = {np.mean(samples['beta'])} +- {np.std(samples['beta'])}")
|V|  = 120.92754364013672 +- 31.4892635345459
l    = 294.0298299307121 +- 23.44887489204706
b    = -23.89915683240672 +- 13.709079097191216
In [104]:
data = [l, b, Vmag]
labels = [r"$l$", r"$b$", r"$|\bf{V}_{\rm ext}|$"]
if "alpha" in samples:
    data.append(samples["alpha"])
    labels.append(r"$\alpha$")

if "beta" in samples:
    data.append(samples["beta"])
    labels.append(r"$\beta$")

if "h" in samples:
    data.append(samples["h"])
    labels.append(r"$h$")

data = np.vstack(data).T
fig = corner.corner(data, labels=labels, show_titles=True, title_fmt=".3f", title_kwargs={"fontsize": 12}, smooth=1)
# fig.savefig(f"../../plots/mock_{simname}_{catalogue}.png", dpi=500, bbox_inches="tight")
No description has been provided for this image

Vizualize the results

In [ ]:
data, names, gof = read_samples("Pantheon+_groups", "Carrick2015", 0)

fig = corner.corner(data, labels=names_to_latex(names, True), show_titles=True,
                    title_fmt=".3f", title_kwargs={"fontsize": 12}, smooth=1)

$\texttt{LOSS}$ comparison

In [ ]:
LOSS_Carrick_0 = read_samples("LOSS", "Carrick2015", 0, return_MCsamples=True)
LOSS_Carrick_1 = read_samples("LOSS", "Carrick2015", 1, return_MCsamples=True)

LOSS_CB1_0 = read_samples("LOSS", "csiborg1", 0, return_MCsamples=True)
LOSS_CB1_1 = read_samples("LOSS", "csiborg1", 1, return_MCsamples=True)

LOSS_CB2_0 = read_samples("LOSS", "csiborg2_main", 0, return_MCsamples=True)
LOSS_CB2_1 = read_samples("LOSS", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
     LOSS_Carrick_0,
     # LOSS_Carrick_1,
     # LOSS_CB1_0,
     LOSS_CB1_1,
     LOSS_CB2_0,
     LOSS_CB2_1,
     ]

# params = ["l", "b", "Vmag", "beta"]
params = None

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, params=params, filled=True, legend_loc='upper right', )
g.export(f"../plots/LOSS_comparison.png", dpi=500,)

$\texttt{Foundation}$ comparison

In [ ]:
FOUNDATION_Carrick_0 = read_samples("Foundation", "Carrick2015", 0, return_MCsamples=True)
FOUNDATION_Carrick_1 = read_samples("Foundation", "Carrick2015", 1, return_MCsamples=True)

FOUNDATION_CB1_0 = read_samples("Foundation", "csiborg1", 0, return_MCsamples=True)
FOUNDATION_CB1_1 = read_samples("Foundation", "csiborg1", 1, return_MCsamples=True)

FOUNDATION_CB2_0 = read_samples("Foundation", "csiborg2_main", 0, return_MCsamples=True)
FOUNDATION_CB2_1 = read_samples("Foundation", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    FOUNDATION_Carrick_0,
    # FOUNDATION_Carrick_1,
    # FOUNDATION_CB1_0,
    FOUNDATION_CB1_1,
    FOUNDATION_CB2_0,
    FOUNDATION_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../plots/FOUNDATION_comparison.png", dpi=500,)

$\texttt{Pantheon+}$ comparison

In [ ]:
# PANTHEONP_Carrick_0 = read_samples("Pantheon+", "Carrick2015", 0, return_MCsamples=True)
# PANTHEONP_Carrick_1 = read_samples("Pantheon+", "Carrick2015", 1, return_MCsamples=True)

# PANTHEONP_CB1_0 = read_samples("Pantheon+", "csiborg1", 0, return_MCsamples=True)
# PANTHEONP_CB1_1 = read_samples("Pantheon+", "csiborg1", 1, return_MCsamples=True)

PANTHEONP_CB2_0 = read_samples("Pantheon+", "csiborg2_main", 0, return_MCsamples=True)
PANTHEONP_CB2_1 = read_samples("Pantheon+", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    # PANTHEONP_Carrick_0,
    # PANTHEONP_Carrick_1,
    # PANTHEONP_CB1_0,
    # PANTHEONP_CB1_1,
    PANTHEONP_CB2_0,
    PANTHEONP_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
# g.export(f"../plots/PANTHEONP_comparison.png", dpi=500,)

$\texttt{Pantheon+}$ groups

In [4]:
LG = 0

PANTHEONP_Carrick = read_samples("Pantheon+", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG, )
PANTHEONP_Carrick_Groups = read_samples("Pantheon+_groups", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG)
PANTHEONP_Carrick_Groups_zSN = read_samples("Pantheon+_groups_zSN", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG)
PANTHEONP_Carrick_zSN = read_samples("Pantheon+_zSN", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG)

# ksmooth = 1
# PANTHEONP_CB2 = read_samples("Pantheon+", "csiborg2_main", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)
# PANTHEONP_CB2_Groups = read_samples("Pantheon+_groups", "csiborg2_main", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)
# PANTHEONP_CB2_Groups_zSN = read_samples("Pantheon+_groups_zSN", "csiborg2_main", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)
Reading Pantheon+ fitted to Carrick2015 with ksmooth = 0.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 9947.804688 +- 0.000000
AIC  = 9902.613281 +- 0.000000
logZ = -4942.983398 +- 0.000000
chi2 = 0.000000 +- 0.000000
Removed no burn in

Reading Pantheon+_groups fitted to Carrick2015 with ksmooth = 0.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 2574.760986 +- 0.000000
AIC  = 2542.396484 +- 0.000000
logZ = -1258.320190 +- 0.000000
chi2 = 1.096741 +- 0.262201
Removed no burn in

Reading Pantheon+_groups_zSN fitted to Carrick2015 with ksmooth = 0.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 2796.622070 +- 0.000000
AIC  = 2764.257568 +- 0.000000
logZ = -1364.911255 +- 0.000000
chi2 = 1.072540 +- 0.119186
Removed no burn in

Reading Pantheon+_zSN fitted to Carrick2015 with ksmooth = 0.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 10111.704102 +- 0.000000
AIC  = 10066.512695 +- 0.000000
logZ = -5023.536621 +- 0.000000
chi2 = 1.089721 +- 0.062810
Removed no burn in
In [7]:
params = ["Vmag", "l", "b"]
CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),
                names=params, labels=names_to_latex(params, True), label="CMB")


X = [
    PANTHEONP_Carrick,
    PANTHEONP_Carrick_Groups,
    # PANTHEONP_Carrick_Groups_zSN,
    PANTHEONP_Carrick_zSN,
    # PANTHEONP_CB2,
    # PANTHEONP_CB2_Groups,
    # PANTHEONP_CB2_Groups_zSN,
    CMB,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../../plots/PANTHEON_GROUPS_Carrick_comparison_LG.png", dpi=500,)
Removed no burn in
No description has been provided for this image

$\texttt{2MTF}$ comparison

In [ ]:
TWOMTF_Carrick_0 = read_samples("2MTF", "Carrick2015", 0, return_MCsamples=True)
TWOMTF_Carrick_1 = read_samples("2MTF", "Carrick2015", 1, return_MCsamples=True)

TWOMTF_CB1_0 = read_samples("2MTF", "csiborg1", 0, return_MCsamples=True)
TWOMTF_CB1_1 = read_samples("2MTF", "csiborg1", 1, return_MCsamples=True)

TWOMTF_CB2_0 = read_samples("2MTF", "csiborg2_main", 0, return_MCsamples=True)
TWOMTF_CB2_1 = read_samples("2MTF", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    TWOMTF_Carrick_0,
    # TWOMTF_Carrick_1,
    # TWOMTF_CB1_0,
    TWOMTF_CB1_1,
    TWOMTF_CB2_0,
    TWOMTF_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../plots/2MTF_comparison.png", dpi=500,)

$\texttt{SFI++ galaxies}$ comparison

In [ ]:
SFIGAL_Carrick_0 = read_samples("SFI_gals", "Carrick2015", 0, return_MCsamples=True)
SFIGAL_Carrick_1 = read_samples("SFI_gals", "Carrick2015", 1, return_MCsamples=True)

# SFIGAL_CB1_0 = read_samples("SFI_gals", "csiborg1", 0, return_MCsamples=True)
# SFIGAL_CB1_1 = read_samples("SFI_gals", "csiborg1", 1, return_MCsamples=True)

SFIGAL_CB2_0 = read_samples("SFI_gals", "csiborg2_main", 0, return_MCsamples=True)
SFIGAL_CB2_1 = read_samples("SFI_gals", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    SFIGAL_Carrick_0,
    # SFIGAL_Carrick_1,
    # SFIGAL_CB1_0,
    # SFIGAL_CB1_1,
    # SFIGAL_CB2_0,
    SFIGAL_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../plots/SFI_gals_comparison.png", dpi=500,)

$\texttt{SFI++ groups}$ comparison

In [ ]:
SFIGROUP_Carrick_0 = read_samples("SFI_groups", "Carrick2015", 0, return_MCsamples=True)
SFIGROUP_Carrick_1 = read_samples("SFI_groups", "Carrick2015", 1, return_MCsamples=True)

SFIGROUP_CB2_0 = read_samples("SFI_groups", "csiborg2_main", 0, return_MCsamples=True)
SFIGROUP_CB2_1 = read_samples("SFI_groups", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    SFIGROUP_Carrick_0,
    SFIGAL_Carrick_0,
    # SFIGROUP_Carrick_1,
    # SFIGROUP_CB2_0,
    # SFIGROUP_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../plots/SFI_gals_vs_groups_comparison.png", dpi=500,)

SN to TF comparison

In [73]:
LG = 0

# PANTHEONP_Carrick = read_samples("Pantheon+", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG, )
# PANTHEONP_Groups_Carrick = read_samples("Pantheon+_groups", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG, )
# TWOMTF_Carrick = read_samples("2MTF", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG)
# SFIGAL_Carrick = read_samples("SFI_gals", "Carrick2015", 0, return_MCsamples=True, subtract_LG_velocity=LG)

k = 1
PANTHEONP_CB2 = read_samples("Pantheon+", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG, )
PANTHEONP_Groups_CB2 = read_samples("Pantheon+_groups", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG, )
TWOMTF_CB2 = read_samples("2MTF", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
SFIGAL_CB2 = read_samples("SFI_gals", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
Reading Pantheon+ fitted to csiborg2_main with ksmooth = 1.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 10027.133105 +- 13.850270
AIC  = 9981.941699 +- 13.850270
logZ = -4981.690186 +- 6.885272
chi2 = 0.000000 +- 0.000000
Removed no burn in

Reading Pantheon+_groups fitted to csiborg2_main with ksmooth = 1.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 2651.293762 +- 12.943075
AIC  = 2618.929260 +- 12.943075
logZ = -1293.734613 +- 6.356175
chi2 = 0.955844 +- 0.134530
Removed no burn in

Reading 2MTF fitted to csiborg2_main with ksmooth = 1.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 19167.596582 +- 20.190445
AIC  = 19121.432520 +- 20.190445
logZ = -9555.558252 +- 9.820362
chi2 = 0.000000 +- 0.000000
Removed no burn in

Reading SFI_gals fitted to csiborg2_main with ksmooth = 1.
Subtracting LG velocity with kernel 0.0 Mpc / h.
BIC  = 28646.324902 +- 24.227278
AIC  = 28596.914746 +- 24.227278
logZ = -14288.365332 +- 12.050230
chi2 = 0.000000 +- 0.000000
Removed no burn in
In [74]:
params = ["Vmag", "l", "b"]
CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),
                names=params, labels=names_to_latex(params, True), label="CMB")


X = [
    # PANTHEONP_Carrick,
    # PANTHEONP_Groups_Carrick,
    # TWOMTF_Carrick,
    # SFIGAL_Carrick,
    PANTHEONP_CB2,
    PANTHEONP_Groups_CB2,
    TWOMTF_CB2,
    SFIGAL_CB2,
    CMB,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
# g.export(f"../../plots/SN_TF_CB2_consistency.png", dpi=500,)
Removed no burn in
WARNING:root:2D kernel density bandwidth optimizer failed for Vmag, l. Using fallback width: f(a) and f(b) must have different signs
WARNING:root:2D kernel density bandwidth optimizer failed for l, b. Using fallback width: f(a) and f(b) must have different signs
WARNING:root:2D kernel density bandwidth optimizer failed for l, b. Using fallback width: f(a) and f(b) must have different signs
WARNING:root:2D kernel density bandwidth optimizer failed for l, sigma_v. Using fallback width: f(a) and f(b) must have different signs
No description has been provided for this image

Mock $\texttt{CB2}$ comparison

In [ ]:
SMALLMOCK_CB2_0 = read_samples("CB2_small", "csiborg2_main", 0, return_MCsamples=True)
SMALLMOCK_CB2_1 = read_samples("CB2_small", "csiborg2_main", 1, return_MCsamples=True)

LARGEMOCK_CB2_0 = read_samples("CB2_large", "csiborg2_main", 0, return_MCsamples=True)
LARGEMOCK_CB2_1 = read_samples("CB2_large", "csiborg2_main", 1, return_MCsamples=True)
In [ ]:
X = [
    # SMALLMOCK_CB2_0,
    # SMALLMOCK_CB2_1,
    LARGEMOCK_CB2_0,
    LARGEMOCK_CB2_1,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, filled=True, legend_loc='upper right')
g.export(f"../plots/CB2_mocks_large.png", dpi=500,)

External flow consistency

Carrick2015

In [ ]:
X = [
    # LOSS_Carrick_0,
    # FOUNDATION_Carrick_0,
    PANTHEONP_Carrick_0,
    TWOMTF_Carrick_0,
    SFIGAL_Carrick_0,
    ]

params = ["Vmag", "l", "b", "beta"]
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)
g.export(f"../plots/Carrick2015_external_flow.png", dpi=500,)

CSiBORG1

In [ ]:
X = [
    # LOSS_CB1_1,
    # FOUNDATION_CB1_1,
    PANTHEONP_CB1_1,
    TWOMTF_CB1_1,
    # SFIGAL_CB1_1,
    ]

params = ["Vmag", "l", "b", "beta"]
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)
g.export(f"../plots/CB1_external_flow.png", dpi=500,)

CSiBORG2

In [ ]:
X = [
    # LOSS_CB2_1,
    # FOUNDATION_CB2_1,
    PANTHEONP_CB2_1,
    TWOMTF_CB2_1,
    SFIGAL_CB2_1,
    ]

params = ["Vmag", "l", "b", "beta"]
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)
g.export(f"../plots/CB2_external_flow.png", dpi=500,)
In [ ]:
k = 1
LG = 0

# Carrick
# LOSS_Carrick_LG = read_samples("LOSS", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)
# FOUNDATION_Carrick_LG = read_samples("Foundation", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)
# PANTHEON_Carrick_LG = read_samples("Pantheon+", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)
# TWOMTF_Carrick_LG = read_samples("2MTF", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)
SFIGAL_Carrick_LG = read_samples("SFI_gals", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)
SFIGROUPS_Carrick_LG = read_samples("SFI_groups", "Carrick2015", k, return_MCsamples=True, subtract_LG_velocity=LG)


# # CSiBORG2
# LOSS_CB2_LG = read_samples("LOSS", "csiborg2_main", k, return_MCsamples=True,subtract_LG_velocity=LG)
# FOUNDATION_CB2_LG = read_samples("Foundation", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
# PANTHEON_CB2_LG = read_samples("Pantheon+", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
# TWOMTF_CB2_LG = read_samples("2MTF", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
SFIGAL_CB2_LG = read_samples("SFI_gals", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)
SFIGROUP_CB2_LG = read_samples("SFI_groups", "csiborg2_main", k, return_MCsamples=True, subtract_LG_velocity=LG)

# # CSiBORG1
# LOSS_CB1_LG = read_samples("LOSS", "csiborg1", k, return_MCsamples=True, subtract_LG_velocity=LG)
# FOUNDATION_CB1_LG = read_samples("Foundation", "csiborg1", k, return_MCsamples=True, subtract_LG_velocity=LG)
# PANTHEON_CB1_LG = read_samples("Pantheon+", "csiborg1", k, return_MCsamples=True, subtract_LG_velocity=LG)
# TWOMTF_CB1_LG = read_samples("2MTF", "csiborg1", k, return_MCsamples=True, subtract_LG_velocity=LG)
# SFIGAL_CB1_LG = read_samples("SFI_gals", "csiborg1", k, return_MCsamples=True, subtract_LG_velocity=LG)
In [ ]:
params = ["Vmag", "l", "b"]
CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),
                names=params, labels=names_to_latex(params, True), label="CMB")

X = [
    # LOSS_Carrick_LG,
    # FOUNDATION_Carrick_LG,
    # PANTHEON_Carrick_LG,
    # TWOMTF_Carrick_LG,
    # SFIGAL_Carrick_LG,
    # SFIGROUPS_Carrick_LG,
    # LOSS_CB1_LG,
    # FOUNDATION_CB1_LG,
    # PANTHEON_CB1_LG,
    # TWOMTF_CB1_LG,
    # SFIGAL_CB1_LG,
    # LOSS_CB2_LG,
    # FOUNDATION_CB2_LG,
    # PANTHEON_CB2_LG,
    # TWOMTF_CB2_LG,
    SFIGAL_CB2_LG,
    SFIGROUP_CB2_LG,
    CMB,
    ]

g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add = 0.75
# g.settings.title_limit_fontsize = 14
g.triangle_plot(X, params=params, filled=True, legend_loc='upper right', )
# g.export(f"../plots/ALL_dipole.png", dpi=500,)
In [ ]: