Skip to content

fix psi computation in ecliptic->galactic pointing rotation#543

Draft
mj-gomes wants to merge 1 commit into
masterfrom
fix_e2g_psi_rotation
Draft

fix psi computation in ecliptic->galactic pointing rotation#543
mj-gomes wants to merge 1 commit into
masterfrom
fix_e2g_psi_rotation

Conversation

@mj-gomes

@mj-gomes mj-gomes commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Hi,

This PR fixes the error that I found recently and that I briefly mentioned in #542.

I noticed that scanning a map with a non ideal HWP resulted in bizarre output maps (which looked like some weird angle rotation was happening somewhere) compared to when doing the scanning in ecliptic coordinates.

I (+ Eric, + one LLM) managed to find the bug. Currently, when we convert pointings from ecliptic to galactic coordinates, we are only rotating the orientation angle psi considering the rotation of the north pole, and ignoring the fact that the whole reference frame changes (the definition of both north and east directions), and since psi is defined between the north and east directions, the rotation of psi was incorrect.

The reason to why this only showed up when the hwp was non ideal is unclear, but it can come from the fact that systematic effects rotate with psi independently of the hwp rotation angle (rho), while for an ideal hwp, the rotation is always (rho-psi), which perhaps cancels out the effects from an incorrect psi.

Now, for each sample, we first obtain the north and east directions in the ecliptic frame with theta and phi, then we get the orientation vector in this basis, and we rotate both the basis and the vector, and then we obtain psi in galactic coordinates doing the inverse operation from vector to angle in the new reference frame.

I am now getting the same output maps using galactic or ecliptic coordinates.

EDIT: apparently we have to change the expected outputs for some examples in the docs, I'll do that tomorrow.

@paganol paganol added the bug Something isn't working label Jul 15, 2026
@mj-gomes

Copy link
Copy Markdown
Contributor Author

The error in the map_scanning documentation seems reasonable due to the changes, but the one in beam_convolution (https://github.com/litebird/litebird_sim/actions/runs/29433612982/job/87414564734?pr=543#step:7:115) looks a bit strange.

Namely due to the big difference in the previously expected output TOD and the one we get now:

Expected:
    113.796
    116.186
    118.567
    120.935
    123.300
    125.655
    128.000
    130.335
    132.661
    134.975
Got:
    -113.305
    -101.235
    -87.724
    -73.623
    -59.721
    -46.686
    -35.032
    -25.097
    -17.047
    -10.875

Can someone with more expertise than me in beam convolution (@paganol ?) see if this is expected with the change in psi calculation, or if there is something still wrong ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants