Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cosmo_val/cat_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ GLASS_mock_validation:
star_flag: FLAG_STAR_HSM
star_size: SIGMA_STAR_HSM
hdu: 1
path: unions_shapepipe_psf_2024_v1.6.a.fits
path: ../../../../n17data/UNIONS/WL/v1.6.x/unions_shapepipe_psf_2024_v1.6.a.fits
Comment thread
sachaguer marked this conversation as resolved.
ra_col: RA
dec_col: Dec
e1_PSF_col: E1_PSF_HSM
Expand Down
41 changes: 39 additions & 2 deletions src/sp_validation/cosmo_val/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,20 @@ def results_objectwise(self):
self._results_objectwise = self.init_results(objectwise=True)
return self._results_objectwise

def basename(self, version, treecorr_config=None, npatch=None):
def basename(
self,
version,
tomo_bin_a="all",
tomo_bin_b=None,
treecorr_config=None,
npatch=None,
):
cfg = treecorr_config or self.treecorr_config
patches = npatch or self.npatch
tomo_bin_a_str = f"tomo_bin_{tomo_bin_a}"
tomo_bin_b_str = f"_tomo_bin_{tomo_bin_b}" if tomo_bin_b is not None else ""
return (
f"{version}_minsep={cfg['min_sep']}"
f"{version}_{tomo_bin_a_str}{tomo_bin_b_str}_minsep={cfg['min_sep']}"
f"_maxsep={cfg['max_sep']}"
Comment on lines +496 to 500

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be checked whether new outputs are read differently or if the call to open the file relies on the basename function as well.

f"_nbins={cfg['nbins']}"
f"_npatch={patches}"
Expand Down Expand Up @@ -682,3 +691,31 @@ def _get_tomo_bins(self, version):
else:
self.print_cyan(f"Version {version} does not have tomography information.")
return None, None

def _get_tomo_bins_for_versions(self, versions, tomography):
"""
Return a dictionary of tomo_bin_ids and tomo_bin_pairs for each version in versions.

Parameters
----------
versions : list of str
List of catalog version identifiers
tomography : bool
If True, assumes tomography else returns the format for non-tomographic versions.

Returns
-------
dict
Dictionary with version as key and a dictionary containing 'ids' and 'pairs' as values.
Example: {version1: {'ids': tomo_bin_ids1, 'pairs': tomo_bin_pairs1}, ...}
"""
tomo_bins = {}
for ver in versions:
if tomography:
tomo_bin_ids, tomo_bin_pairs = self._get_tomo_bins(ver)
else:
tomo_bin_ids, tomo_bin_pairs = ["all"], [("all", "all")]

tomo_bins[ver] = {"ids": tomo_bin_ids, "pairs": tomo_bin_pairs}

return tomo_bins
17 changes: 6 additions & 11 deletions src/sp_validation/cosmo_val/pseudo_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,16 +1159,11 @@ def get_ell_factor(ell):

fmt_dict = {"EE": "o", "BB": "s", "EB": "^", "BE": "v"}
# From all the versions, get the maximum number of tomo_bin_ids
tomo_bins = {}
for ver in versions:
if tomography:
tomo_bin_ids, tomo_bin_pairs = self._get_tomo_bins(ver)
else:
tomo_bin_ids, tomo_bin_pairs = ["all"], [("all", "all")]

tomo_bins[ver] = {"ids": tomo_bin_ids, "pairs": tomo_bin_pairs}
tomo_bins = self._get_tomo_bins_for_versions(versions, tomography=tomography)

n_tomo_bins_plot = max(len(bins["ids"]) for bins in tomo_bins.values())
max_key = max(tomo_bins, key=lambda k: len(tomo_bins[k]["ids"]))
n_tomo_bins_plot = len(tomo_bins[max_key]["ids"])
reference_tomo_bin_pairs = tomo_bins[max_key]["pairs"]

fig, axs = plt.subplots(
n_tomo_bins_plot,
Expand Down Expand Up @@ -1206,7 +1201,7 @@ def get_ell_factor(ell):
# Better jittering: symmetric around original ell values
jitter_fraction = (j - (len(versions) - 1) / 2) * offset
jittered_ell = ell + jitter_fraction * ell_widths
ell_factor_ = get_ell_factor(jittered_ell)
ell_factor_ = get_ell_factor(ell)

for pol in pol_list:
pol_color = self.get_pol_color(ver_color, pol, pol_list)
Expand All @@ -1231,7 +1226,7 @@ def get_ell_factor(ell):
else:
ell_label = r"$\ell(\ell+1) C_\ell$"

for tomo_bin_a, tomo_bin_b in tomo_bin_pairs:
for tomo_bin_a, tomo_bin_b in reference_tomo_bin_pairs:
if tomography:
ax = axs[tomo_bin_b - 1, tomo_bin_a - 1]
else:
Expand Down
Loading
Loading