galsci / pysm

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

poltens full sky power spectra #100

Closed NicolettaK closed 2 years ago

NicolettaK commented 2 years ago

Hi, @yaojian95 has been working a bit on poltens dust maps produced by @giuspugl in https://github.com/galsci/pysm/pull/97, in order to estimate non-Gaussianity. He has computed power spectra for different fsky. In particular, power spectra on full sky look a bit weird, with bumps around \ell~100 (see below). Have you already discussed this point? I'm not sure whether this is critical or not, as spectra look ok once we move away from the Galactic plane, but we just want to make sure that you are aware of this features. PS_of_IQU_with_small_scales

zonca commented 2 years ago

can you please share the code?

yaojian95 commented 2 years ago

I just use Namaster with following masks to calculate the power spectra of the IQU maps transfromed from polten maps with small scales. The Namaster code and the maps are exactly from this notebook .

image

zonca commented 2 years ago

@yaojian95 I'd rather see the actual notebook you ran, in particular with all the intermediate outputs.

it would be useful to compare spectra to the original map and/or to the large-scales-only map.

yaojian95 commented 2 years ago

What I ran is exactly Giuseppe's notebook. I copied it to my home on Nersc and ran it cell by cell. What I plotted above are the power spectra of maps generated by cell 45, that are big IQU maps with small scales added in small iqu domain:

output_map = log_pol_tens_to_map(ii_map_out)

hp.write_map(
    datadir / f"dust_gnilc_hybrid_out_nside{output_nside}_float32.fits",
    output_map,
    dtype=np.float32,
    overwrite=True,
) 

Here are the plots for the original maps, but with monopole subtracted (exactly 'm_planck_varres' from cell 21) image

Calculating the power spectra takes a long time and I will show you the ps for the large-scales-only maps tomorrow.

yaojian95 commented 2 years ago

Here are the power spectra of large-scales-only maps, that are the original maps with small scales filtered in small iqu domain, then transformed back to IQU. That is, I take the log_ls maps in cell 43 then use log_pol_tens_to_map(log_ls) to get the IQU maps without small scales. image

giuspugl commented 2 years ago

Thank you @yaojian95 and @NicolettaK for checking this! This is something we were aware as for testing and for the implementation we didn't considered the full sky case but always the GAL080 one. From the plot above plot above
we can say that we achieve reasonable results with fsky< 97% (neglecting any leakage effect due to the Galactic cut, @yaojian95 would you mind to run namaster for fsky<1 cases? ). The peak at around ell=100 (which is the transition scale we inject small scales in the dust) is essentially due to the amplitude of the small scales injected that are exceeding the value expected at the same multipole for the fsky=1 case.. to improve the full-sky BB and EE spectra we need to tweak further the parameters of the modulation map. However, I rather prefer to improve the modulation methodology by means of some insights of the local properties of the emission. Surely something we have to explore in the coming months !

yaojian95 commented 2 years ago

@giuspugl What do you mean by "neglecting any leakage effect due to the Galactic cut" ? These power spectra are calculated by Namaster with the apodized mask, but without setting the purification flag.

giuspugl commented 2 years ago

To address this issue we agreed on including the real observed data (without any small scale ) within the region inside the GAL097 HFI mask see this post . The spectra I get are more nice looking with respect to the ones estimated by modulating small scales also at the Galactic plane . image solid lines refers to the new updated maps encoding small scales outside the GAL097 mask and the real data inside it. the light coloured lines refers to the spectra of the input GNILC maps , whereas the dotted lines refers to the dust maps with small scales everywhere .

I think this version of the maps benefits of the high SNR and high resolution at 21.8', notice how we transition more gradually from the observed small scales (at ell>400) to the artificial ones as we go from fsky = 1 to fsky~0.90 .

Thanks @yaojian95 and @NicolettaK for spotting this !!

zonca commented 2 years ago

@giuspugl can you please share the notebook implementing this fix and generating those plots? I'd like to use it as reference for my implementation and then merge it into the docs.

giuspugl commented 2 years ago

@zonca please you can find the notebook here. thanks!

zonca commented 2 years ago

implementation of the galactic plane fix was not too bad. For d9 and d10, the correction is just added to the input templates in preprocessing. For d11, I'm loading the GAL 070 mask and the IQU components of the logpoltens GNILC map, but I set the IQU map to 0 where it is not used, then gzip it so it's only 157 MB.