Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty radial bins in cluster ensemble #618

Open
marina-ricci opened this issue Feb 22, 2024 · 9 comments · May be fixed by #652
Open

Allow empty radial bins in cluster ensemble #618

marina-ricci opened this issue Feb 22, 2024 · 9 comments · May be fixed by #652
Assignees
Labels
bug Something isn't working good first issue Good for newcomers priority Essential for current milestone

Comments

@marina-ricci
Copy link
Collaborator

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.

@combet
Copy link
Collaborator

combet commented Feb 26, 2024

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

@hsinfan1996
Copy link
Collaborator

hsinfan1996 commented Feb 26, 2024

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)

@combet
Copy link
Collaborator

combet commented Feb 26, 2024

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.

@hsinfan1996
Copy link
Collaborator

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.

@marina-ricci
Copy link
Collaborator Author

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
Copy link
Collaborator Author

marina-ricci commented Nov 8, 2024

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 marina-ricci added bug Something isn't working good first issue Good for newcomers priority Essential for current milestone labels Nov 11, 2024
@marina-ricci
Copy link
Collaborator Author

marina-ricci commented Nov 15, 2024

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.

@m-aguena m-aguena self-assigned this Nov 15, 2024
@m-aguena
Copy link
Collaborator

@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
Copy link
Collaborator

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 m-aguena linked a pull request Nov 18, 2024 that will close this issue
@m-aguena m-aguena linked a pull request Nov 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers priority Essential for current milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants