zonca / pico-simulations

Simulations for PICO using TOAST
0 stars 2 forks source link

Test PICO 4pi convolution with conviqt #17

Closed zonca closed 6 years ago

zonca commented 6 years ago

I have a first implementation (suitable for testing only for now) of integrating Conviqt into the satellite pipeline in https://github.com/hpc4cmb/toast/pull/241

I am testing with a simple input map with a signal on the equator:

download 9

I have a scanning strategy with no precession, see the hitmap:

hitmap

For testing I am using a symmetric 10 deg beam prepared by Karl, the results are as expected:

binned_map_conviqt

Here is a difference with a map smoothed with healpy:

diff

zonca commented 6 years ago

Next I'll test with elliptic beams so we can understand if the orientation of the beam is consistent.

zonca commented 6 years ago

ok, I have now tested with elliptic 10x1 deg gaussian beams provided by Karl to understand beam orientation.

We have 2 detectors A and B which are oriented orthogonally. If I use the longY beams for A and longX beams for B, the beams are oriented horizontally, parallel to the equator, so they smooth 10 deg along the equator and 1 deg across the latitude. The result is quite similar to a map smoothed by healpy with a 1 deg gaussian symmetric beam posted below.

conviqt_elliptic_yx healpy1deg

Instead if I switch the beams, the 10deg smoothing is in latitude and the result is quite similar to a healpy 10 deg smoothed map posted below.

conviqt_elliptic_xy healpy10deg

zonca commented 6 years ago

Here a plot of the alm of the test beams transformed a map with alm2map:

pico_test_beams_longx

zonca commented 6 years ago

@keskitalo I have some issues with the beam reference frame in libConviqt. From the docstrings I thought that if I use the Pxx reference frame, no rotation is applied to the detectors, so it assumes that their beams are defined exactly in the same reference frame. For example the beams plotted above here, I would like them to be superposed, however if I run a simulation, it looks like one of the detectors is rotated 90 deg both in Dxx and Pxx frame.

keskitalo commented 6 years ago

@zonca the matter is rather subtle. If you want to use the psi-angles directly from the quaternions, you set dxx=False and/or provide psipol=0 in the detectordata input dictionary for every detector. HOWEVER, for Planck at least, the actual Pxx frame was defined so that it was the same for both detectors in a horn. This meant that one had to remove the psi_pol rotation from the quaternion but not the psi_uv rotation to get to Pxx. Going from the quaternions to Dxx required subtracting psi_uv+psi_pol.

You almost definitely need to subtract psi_pol as well, so you should supply it in detectordata and run OpSimConviqt in dxx=True mode. This way the a and b beams are defined and applied in the same frame. Sorry about the confusion!

zonca commented 6 years ago

thanks @keskitalo I implemented your suggestion in https://github.com/hpc4cmb/toast/pull/241/commits/241e5e82d0e433b754fb0dc049c06b8e3b093fc7 i.e. I remove 90 deg from the "B" detectors, now the 2 beams are expected to be in the same reference frame.

Now in fact if I use the 2 longX or the 2 longY beams I get the expected results of either 1 deg or 10 deg smoothing in latitude:

psi_pol_longy psi_pol_longx

zonca commented 6 years ago

now I'll finalize the implementation in https://github.com/hpc4cmb/toast/pull/241

zonca commented 6 years ago

ok, the implementation is ready and will be reviewed and merged into TOAST soon. In the meantime I can run some simulations with the real beams see https://github.com/zonca/pico-simulations/issues/24