From 05123ec868f951446589339a0433511f8e09e49b Mon Sep 17 00:00:00 2001 From: rstiskalek Date: Mon, 7 Oct 2024 00:56:59 +0100 Subject: [PATCH] Pass marg arg --- csiborgtools/flow/io.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/csiborgtools/flow/io.py b/csiborgtools/flow/io.py index d2f22f9..dd81c63 100644 --- a/csiborgtools/flow/io.py +++ b/csiborgtools/flow/io.py @@ -354,8 +354,8 @@ def mask_fields(density, velocity, mask, return_none): def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, - absolute_calibration=None, calibration_fpath=None, - void_kwargs=None): + wo_num_dist_marginalisation=False, absolute_calibration=None, + calibration_fpath=None, void_kwargs=None): """ Get a model and extract the relevant data from the loader. @@ -369,9 +369,14 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, Maximum observed redshift in the CMB frame to include. mag_selection : dict, optional Magnitude selection parameters. + wo_num_dist_marginalisation : bool, optional + Whether to directly sample the distance without numerical + marginalisation. in which case the tracers can be coupled by a + covariance matrix. By default `False`. add_absolute_calibration : bool, optional Whether to add an absolute calibration for CF4 TFRs. calibration_fpath : str, optional + Path to the file containing the absolute calibration of CF4 TFR. Returns ------- @@ -418,7 +423,8 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, los_overdensity, los_velocity, RA[mask], dec[mask], zCMB[mask], e_zCMB, calibration_params, None, mag_selection, loader.rdist, loader._Omega_m, "SN", - name=kind, void_kwargs=void_kwargs) + name=kind, void_kwargs=void_kwargs, + wo_num_dist_marginalisation=wo_num_dist_marginalisation) elif "Pantheon+" in kind: keys = ["RA", "DEC", "zCMB", "mB", "x1", "c", "biasCor_m_b", "mBERR", "x1ERR", "cERR", "biasCorErr_m_b", "zCMB_SN", "zCMB_Group", @@ -451,7 +457,8 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, los_overdensity, los_velocity, RA[mask], dec[mask], zCMB[mask], e_zCMB[mask], calibration_params, None, mag_selection, loader.rdist, loader._Omega_m, "SN", - name=kind, void_kwargs=void_kwargs) + name=kind, void_kwargs=void_kwargs, + wo_num_dist_marginalisation=wo_num_dist_marginalisation) elif kind in ["SFI_gals", "2MTF", "SFI_gals_masked"]: keys = ["RA", "DEC", "z_CMB", "mag", "eta", "e_mag", "e_eta"] RA, dec, zCMB, mag, eta, e_mag, e_eta = (loader.cat[k] for k in keys) @@ -467,7 +474,8 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, los_overdensity, los_velocity, RA[mask], dec[mask], zCMB[mask], None, calibration_params, None, mag_selection, loader.rdist, loader._Omega_m, "TFR", name=kind, - void_kwargs=void_kwargs) + void_kwargs=void_kwargs, + wo_num_dist_marginalisation=wo_num_dist_marginalisation) elif "CF4_TFR_" in kind: # The full name can be e.g. "CF4_TFR_not2MTForSFI_i" or "CF4_TFR_i". band = kind.split("_")[-1] @@ -535,7 +543,8 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, los_overdensity, los_velocity, RA[mask], dec[mask], z_obs[mask], None, calibration_params, abs_calibration_params, mag_selection, loader.rdist, - loader._Omega_m, "TFR", name=kind, void_kwargs=void_kwargs) + loader._Omega_m, "TFR", name=kind, void_kwargs=void_kwargs, + wo_num_dist_marginalisation=wo_num_dist_marginalisation) elif kind in ["CF4_GroupAll"]: # Note, this for some reason works terribly. keys = ["RA", "DE", "Vcmb", "DMzp", "eDM"] @@ -556,7 +565,8 @@ def get_model(loader, zcmb_min=None, zcmb_max=None, mag_selection=None, los_overdensity, los_velocity, RA[mask], dec[mask], zCMB[mask], None, calibration_params, None, mag_selection, loader.rdist, loader._Omega_m, "simple", - name=kind, void_kwargs=void_kwargs) + name=kind, void_kwargs=void_kwargs, + wo_num_dist_marginalisation=wo_num_dist_marginalisation) else: raise ValueError(f"Catalogue `{kind}` not recognized.")