Skip to content

Implementation of reduced shear in source selection for clusters#398

Open
eduardojsbarroso wants to merge 12 commits intomasterfrom
clusters_source_selection
Open

Implementation of reduced shear in source selection for clusters#398
eduardojsbarroso wants to merge 12 commits intomasterfrom
clusters_source_selection

Conversation

@eduardojsbarroso
Copy link
Contributor

So far, the cluster code only measures Delta Sigma from the select source galaxies around a cluster. We need to implement the same for gamma and we are also interested in using N(z) to select the galaxies behind the cluster instead of redshift PDF or zmode or zmean.

@eduardojsbarroso
Copy link
Contributor Author

In this code. We set a maximum radius of search for galaxies around a cluster. Given the cluster redshift and a fiducial cosmology, we can transform this distance into an angle that changes for each cluster given their redshift.

If I do not want to assume any fiducial cosmology and search the galaxies by angle directly, should I use the same search angle for all clusters? Or is there some other approach to reescale this distance with redshift without using cosmology? @marina-ricci @joezuntz

@joezuntz
Copy link
Collaborator

joezuntz commented Aug 1, 2025

There's definitely no way to convert a distance to an angle without knowing the cosmology. So I guess you would have to use the same angle, and make sure it's large enough. Why don't you want to use a fiducial cosmology? It shouldn't have a significant impact on the results at this level.

@eduardojsbarroso
Copy link
Contributor Author

eduardojsbarroso commented Aug 4, 2025

There's definitely no way to convert a distance to an angle without knowing the cosmology. So I guess you would have to use the same angle, and make sure it's large enough. Why don't you want to use a fiducial cosmology? It shouldn't have a significant impact on the results at this level.

Thank you for the reply Joe. I just wanted to know if there was any other way around it since we do not need the cosmology for the tangential signal. But ok, then I think I will leave this untouched and maybe add an option to use a constant angle if wanted

@marina-ricci
Copy link
Contributor

marina-ricci commented Sep 22, 2025

@eduardojsbarroso for this special case I don't think it is a problem. Indeed we can use a fiducial cosmology just to define theta_max, it doesn't (should't) interfer with the "scientific" measurements. And even having radial binning in Mpc is not as much of a problem as having e.g. sigma_crit.

@marina-ricci
Copy link
Contributor

Also, note for ourselves : we should through an error message when our binning is larger than the search radius (in case it's not hapening already)

@marina-ricci
Copy link
Contributor

marina-ricci commented Sep 23, 2025

We decided it makes no sense to implement the N(z) method in source_compute_select, as it will be done more cleanly with the NG correlation.

@eduardojsbarroso eduardojsbarroso changed the title Implementation of reduced shear and N(z) in source selection for clusters Implementation of reduced shear in source selection for clusters Sep 26, 2025
@eduardojsbarroso
Copy link
Contributor Author

@marina-ricci I have cleaned the option of Nz, as as discussed with @combet, we can implement this in another pull request, and a third one for the treecor option. Could you take a look at the code and check what you think?

@eduardojsbarroso
Copy link
Contributor Author

eduardojsbarroso commented Sep 26, 2025

Also, note for ourselves : we should through an error message when our binning is larger than the search radius (in case it's not hapening already)

I think this is already done in the make_ensemble_profile.py

            cat_max_distance = (clmm.utils.convert_units(np.max(bg_cat["distance_arcmin"]), "arcmin", "Mpc", z_cl, self.clmm_cosmo) if shear_units == "mpc" else np.max(bg_cat["distance_arcmin"]))
            if cat_max_distance < self.distance_bins[-1]:
                print ("!!! maximum distance of source smaller than distance_bins")

@eduardojsbarroso eduardojsbarroso marked this pull request as ready for review September 26, 2025 14:35
@eduardojsbarroso eduardojsbarroso marked this pull request as draft September 29, 2025 09:10
@eduardojsbarroso eduardojsbarroso marked this pull request as ready for review October 2, 2025 15:07
@eduardojsbarroso
Copy link
Contributor Author

@marina-ricci I added a pipeline file to test this new functionalities and a notebook if you want to explore the results. Everything seems into place for me

Copy link
Collaborator

@joezuntz joezuntz left a comment

Choose a reason for hiding this comment

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

In general I don't know enough to comment on the clusters code, so I will just review to make sure that things look structurally correct and don't cause any issues with the wider code.

This looks fine from that perspective, though I've added a note about a change you'll need to make because of other changes in the rest of the imports. I'm happy for you to merge it whenever the CL people are happy!

name: mini
interval: 3.0
modules: >
txpipe
Copy link
Collaborator

Choose a reason for hiding this comment

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

You will need to add txpipe.extensions here because of changes in the structuring of the code.

nzbins: 301
columns_file: ./data/bpz_riz.columns
data_path: ./data/example/rail-bpz-inputs
columns_file: /sps/lsst/groups/clusters/cl_pipeline_project/TXPipe_data/bpz_riz.columns
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe avoid hard-coded paths (this is for cc-in2p3 only) so users may more easily use the examples. Or at least add a comment to explain how they should change it to match their setup.


output_dir: ./data/cosmodc2/outputs-20deg2-CL
config: ./examples/cosmodc2/Cluster_pipelines/config-20deg2-CL.yml
output_dir: /sps/lsst/users/ebarroso/TXPipe/data/cosmodc2/outputs-20deg2-CL
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above regarding path

"r_min" : 0.2, #in Mpc
"r_max" : 5.0, #in Mpc
#distance bin definition
"d_min" : 0.5, #in Mpc or acrmin
Copy link
Contributor

Choose a reason for hiding this comment

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

To me, r_min and r_max is more intuitive than d_min, d_max. And 'radial bin' is more used I think, even when thinking of angular separation. Just a suggestion.

radius_edges = np.logspace(np.log10(rmin), np.log10(rmax), len(radius_centers) + 1)
for i in range(len(radius_edges) - 1):
bin_radius_dict[f'radius_{i}'] = (radius_edges[i], radius_edges[i+1], radius_centers[i])
distance_centers = np.array(data['bin_zbin_0_richbin_0']['clmm_cluster_ensemble'].stacked_data['radius'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment as above. distance_centers is a bit cryptic. Maybe radial_bin_centers instead, or something along those lines?

def add_deltasigma_data(self, sacc_obj, data: dict, survey_name: str):
def add_shear_data(self, sacc_obj, data: dict, survey_name: str, profile_type: str):
"""
Adds cluster shear (delta sigma) data to the SACC object.
Copy link
Contributor

Choose a reason for hiding this comment

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

Adds cluster reduced shear or delta sigma (depending on profile_type) profile to the SACC object.

self.radial_bins = clmm.dataops.make_bins(self.config["r_min"], self.config["r_max"], nbins=self.config["nbins"], method="evenlog10width")
print (self.radial_bins)
import clmm.cosmology.ccl
if self.config["units"].lower() == "arcmin":
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it a bit counter-intuitive to have a units keywords decide the type of radial binning (angular or in physical distance). Maybe there should be another keyword radial_bin_type (e.g. 'radius' or 'angle' ) or something like this to control it?

Good to keep the units information though, maybe to save it later as metadata in the sacc file?


if (clmm.utils.convert_units(np.max(bg_cat["distance_arcmin"]), 'arcmin', 'Mpc', z_cl, self.clmm_cosmo)< self.radial_bins[-1]):
print ("!!! maximum radial distance of source smaller than radial_bins")
cat_max_distance = (clmm.utils.convert_units(np.max(bg_cat["distance_arcmin"]), "arcmin", "Mpc", z_cl, self.clmm_cosmo) if shear_units == "mpc" else np.max(bg_cat["distance_arcmin"]))
Copy link
Contributor

@combet combet Feb 6, 2026

Choose a reason for hiding this comment

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

Need to find another name for shear_units. "shear" in this code is either dimensionless or surface mass density if working with DeltaSigma.

gc_object.make_radial_profile(
"Mpc",
bins=self.radial_bins,
shear_units,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants