Allow empty radial bins in cluster ensemble
When working with cluster ensemble we can add individual profiles to produce a stack. However, if those profiles do not have the same radial bin the stacking step will fail. This is a problem when integrating CLMM in the Cluster pipeline as we provide the same N radial bins for every cluster, but when a radial bin is empty an array N-1 will be returned. For stacking cluster_ensemble requires all profiles with the same radial bins.
make_radial_profile has a keyword include_empty_bins that is False by default. Turning it to True when calling that function should solve the problem (I think).
make_radial_profilehas a keywordinclude_empty_binsthat is False by default. Turning it to True when calling that function should solve the problem (I think).
It is set to True for a ClusterEnsemble and user is not allowed to change this parameter. (line 161 in clusteremsemble.py)
Ah yes, it is if using the method make_individual_radial_profile from the CLMM ClusterEnsemble class
I believe @marina-ricci came across the issue when calling CLMM from TXPipe (see here and this), where we are computing the individual profiles using GC make_radial_profile (which has include_empty_bins=False by default) method and sequentially add them to a ClusterEnsemble object using the add_individual_radial_profile method. In that case, having include_empty_bins=True in the make_radial_profile call should fix the issue.
Ah yes, it is if using the method
make_individual_radial_profilefrom the CLMM ClusterEnsemble class (but this assumes all clusters background catalog to have been stored in the ClusterEnsemble, which is not feasible if there are too many clusters).I believe @marina-ricci came across the issue when calling CLMM from TXPipe (see here and this), where the individual profiles are computed using GC
make_radial_profilemethod and sequentially added to a ClusterEnsemble object using theadd_individual_radial_profilemethod. In that case, havinginclude_empty_bins=Falsein themake_radial_profilecall should fix the issue.
Ah I see. Yes, include_empty_bins=True should fix it. Sorry for the misunderstanding.
Great! Thank you for pointing it out to me! Always good to see there no fix needed :) I'll close the issue then.
Hello! I faced a similar issue again, and it's actually a follow-up from the above. In the case where we have empty bins, the radius returned in 0. Then in the stack, it counts in the average radius. This is incorrect. Example plot showing this :
When there is no galaxy in a bin, we should ouput a NaN value, and not 0. It means we also have to do nan average.
@marina-ricci can you provide the code that made the values on this figure? I checked, and make_radial_profile simply crops bins without data
I found the issue, it happens when
galaxycluster.make_radial_profile(..., include_empty_bins=True)
is used.
However, on ClusterEnsemble, these bins with 0 also have a weight W_l=0. So there are no problems on the stacking. Maybe we could just add a warning explaining how to clean each profile for visualization when that happens. @marina-ricci what do you think?