galsci / pysm

PySM 3: Sky emission simulations for Cosmic Microwave Background experiments
https://pysm3.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
33 stars 23 forks source link

websky extragalactic models #129

Closed xzackli closed 1 year ago

xzackli commented 1 year ago

This commit contains a basic interface for accessing extragalactic models from websky, like in so_pysm_models.

There's an important detail for the SZ: the sky map is not band-limited due to the cuspy nature of the halos, and this has been shown to cause issues at the 10% level. It would be better if I could supply a map generated in real space with a fiducial 1 arcmin beam, and provide an interface for reconvolving a user-supplied beam. I don't think this will make it into DC-1.

marcelo-alvarez commented 1 year ago

Thanks a lot for this @xzackli!

There is some mitigation of the SZ maps not being band-limited through normalization of the overall profile to preserve the total y-distortion of each halo and be consistent with the pixel window function when halos are poorly resolved, but there are some residual effects as you describe that will hopefully be addressed in subsequent updates.

It's likely there will be some re-scaling of CIB in order to reduce the small-scale power slightly and optimize these maps for cluster finding, by @sriniraghunathan. @zonca do you suggest we do this here or merge without any scaling applied and document that step in a separate PR?

zonca commented 1 year ago

Thanks can you also specify which files I should copy over and in what target folder?

zonca commented 1 year ago

Can you also fix the codestyle errors so the unit tests can run?

zonca commented 1 year ago

It's likely there will be some re-scaling of CIB in order to reduce the small-scale power slightly and optimize these maps for cluster finding, by @sriniraghunathan. @zonca do you suggest we do this here or merge without any scaling applied and document that step in a separate PR?

either way is fine

xzackli commented 1 year ago

To get the maps, please copy the contents of for_nersc_www directory from my scratch to pysm-data/websky/0.4.

mkdir /global/project/projectdirs/cmb/www/pysm-data/websky
cp -r /global/cscratch1/sd/xzackli/for_nersc_www /global/project/projectdirs/cmb/www/pysm-data/websky/0.4
xzackli commented 1 year ago

I added the CMB map from so_pysm_models but let me know if pysm3 has advanced past that for the purpose of lensing the map with the potential.

zonca commented 1 year ago

I added the CMB map from so_pysm_models but let me know if pysm3 has advanced past that for the purpose of lensing the map with the potential.

I always assumed that we want to use the same CMB parameters of Websky for consistency, so we are stuck with that CMB. However, should we reconsider? @xzackli @marcelo-alvarez, do you have a clear answer to this? or know who else we can ask?

xzackli commented 1 year ago

To clarify, I was wondering if pysm3 now has the ability to lens a Gaussian unlensed CMB realisation with the websky potential. Anyway, for the purposes of this PR I think the existing CMB map is totally fine.

marcelo-alvarez commented 1 year ago

I added the CMB map from so_pysm_models but let me know if pysm3 has advanced past that for the purpose of lensing the map with the potential.

I always assumed that we want to use the same CMB parameters of Websky for consistency, so we are stuck with that CMB. However, should we reconsider? @xzackli @marcelo-alvarez, do you have a clear answer to this? or know who else we can ask?

I think it's fair to say we are stuck with some of the websky cosmo parameters, for consistency of lensing with the primary, but not necessarily stuck with the same realization of the primary or parameters whose variation doesn't significantly affect the lensing, such as the scalar to tensor ratio r.

zonca commented 1 year ago

To clarify, I was wondering if pysm3 now has the ability to lens a Gaussian unlensed CMB realisation with the websky potential. Anyway, for the purposes of this PR I think the existing CMB map is totally fine.

no, we don't have any lensing software inside PySM

zonca commented 1 year ago

I copied the input maps to the pysm-data area at NERSC:

https://portal.nersc.gov/project/cmb/pysm-data/websky/0.4/

zonca commented 1 year ago

here a Notebook on Gist (or Google Colab, see link at the top of the notebook) to test this branch: https://gist.github.com/zonca/3e1df26fa69d279ae4a9e05658d408a1#file-test-websky-cib-pysm-3-ipynb

xzackli commented 1 year ago

This PR lacks tests, but I believe it is otherwise ready for merging. Adding tests in the form of a set of downgraded (nside 512) wouldn't be too difficult though, is that desirable?

zonca commented 1 year ago

thanks @xzackli I am working on importing the old tests, I can take care of that. Could you please import the docs from so-pysm-models and make sure they are updated for 0.4?

zonca commented 1 year ago

also we need to create PySM names for the components, I think we can do:

For CMB:

giuspugl commented 1 year ago

thanks a lot for this PR! i am a bit against c4, coadding multiple signals can be misleading for the user. perhaps it might be more useful to have a separated component dipole that can eventually be coadded to the other signals..
the other names are fine to me!

xzackli commented 1 year ago

The names look good to me!

marcelo-alvarez commented 1 year ago

What is c1? I would have thought it was unlensed primary, i.e. the numbers start counting from one for each of the different flavors of each component.

zonca commented 1 year ago

What is c1? I would have thought it was unlensed primary, i.e. the numbers start counting from one for each of the different flavors of each component.

c1 is the PySM 2 CMB https://pysm3.readthedocs.io/en/latest/models.html#cmb

marcelo-alvarez commented 1 year ago

I see, thanks. I like this naming convention and it should be easy to document.

zonca commented 1 year ago

@marcelo-alvarez @xzackli @giuspugl @sriniraghunathan please review and improve the documentation:

No hurry, I don't need this for the simulations.

zonca commented 1 year ago

@xzackli the instrument model for S4 that I am using requires a map at 17.5 Ghz or below, could you please generate it for CIB and Radio Galaxies?

xzackli commented 1 year ago

Yes, I'm going to add some of my favorite radio bands (S, C, X, etc)

"1.4", "2.7", "5", "10.7", "14.5", "17.5"
xzackli commented 1 year ago

Quick update: CIB at these low freq bands is done, but I still need to do some radio abundance matching. I'll give a directory to copy once I'm set up.

zonca commented 1 year ago

thanks @xzackli implementation is done so I merged the PR, please notify me when you have the data available.