CLMM icon indicating copy to clipboard operation
CLMM copied to clipboard

Allow empty radial bins in cluster ensemble

Open marina-ricci opened this issue 2 years ago • 9 comments

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.

marina-ricci avatar Feb 22 '24 13:02 marina-ricci

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).

combet avatar Feb 26 '24 09:02 combet

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).

It is set to True for a ClusterEnsemble and user is not allowed to change this parameter. (line 161 in clusteremsemble.py)

hsinfan1996 avatar Feb 26 '24 09:02 hsinfan1996

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.

combet avatar Feb 26 '24 09:02 combet

Ah yes, it is if using the method make_individual_radial_profile from 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_profile method and sequentially added to a ClusterEnsemble object using the add_individual_radial_profile method. In that case, having include_empty_bins=False in the make_radial_profile call should fix the issue.

Ah I see. Yes, include_empty_bins=True should fix it. Sorry for the misunderstanding.

hsinfan1996 avatar Feb 26 '24 09:02 hsinfan1996

Great! Thank you for pointing it out to me! Always good to see there no fix needed :) I'll close the issue then.

marina-ricci avatar Mar 05 '24 15:03 marina-ricci

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 : image

marina-ricci avatar Nov 08 '24 22:11 marina-ricci

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 avatar Nov 15 '24 15:11 marina-ricci

@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

m-aguena avatar Nov 15 '24 17:11 m-aguena

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?

m-aguena avatar Nov 18 '24 17:11 m-aguena