Commit bb0aff75 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweak a_lm rotation

parent af298f29
...@@ -212,20 +212,21 @@ class wigner_d_risbo_openmp ...@@ -212,20 +212,21 @@ class wigner_d_risbo_openmp
template<typename T> void rotate_alm (Alm<complex<T>> &alm, template<typename T> void rotate_alm (Alm<complex<T>> &alm,
double psi, double theta, double phi) double psi, double theta, double phi)
{ {
MR_assert (alm.Lmax()==alm.Mmax(),
"rotate_alm: lmax must be equal to mmax");
auto lmax=alm.Lmax(); auto lmax=alm.Lmax();
MR_assert (lmax==alm.Mmax(),
"rotate_alm: lmax must be equal to mmax");
if (theta!=0)
{
vector<complex<double> > exppsi(lmax+1), expphi(lmax+1); vector<complex<double> > exppsi(lmax+1), expphi(lmax+1);
for (size_t m=0; m<=lmax; ++m) for (size_t m=0; m<=lmax; ++m)
{ {
exppsi[m] = polar(1.,-psi*m); exppsi[m] = polar(1.,-psi*m);
expphi[m] = polar(1.,-phi*m); expphi[m] = polar(1.,-phi*m);
} }
wigner_d_risbo_openmp rec(lmax,theta);
vector<complex<double> > almtmp(lmax+1); vector<complex<double> > almtmp(lmax+1);
size_t nthreads=1; size_t nthreads=1;
wigner_d_risbo_openmp rec(lmax,theta);
for (size_t l=0; l<=lmax; ++l) for (size_t l=0; l<=lmax; ++l)
{ {
const auto &d(rec.recurse()); const auto &d(rec.recurse());
...@@ -260,6 +261,16 @@ size_t nthreads=1; ...@@ -260,6 +261,16 @@ size_t nthreads=1;
alm(l,m) = complex<T>(almtmp[m]*expphi[m]); alm(l,m) = complex<T>(almtmp[m]*expphi[m]);
} }
} }
else
{
for (size_t m=0; m<=lmax; ++m)
{
auto ang = polar(1.,-(psi+phi)*m);
for (size_t l=m; l<=lmax; ++l)
alm(l,m) *= ang;
}
}
}
#endif #endif
} }
......
...@@ -86,8 +86,9 @@ bar2 = np.zeros((nth,nph)) ...@@ -86,8 +86,9 @@ bar2 = np.zeros((nth,nph))
blmTfull = np.zeros(slmT.size)+0j blmTfull = np.zeros(slmT.size)+0j
blmTfull[0:blmT.size] = blmT blmTfull[0:blmT.size] = blmT
for ith in range(nth): for ith in range(nth):
rbeamth=interpol_ng.rotate_alm(blmTfull, lmax, ptg[ith,0,2],ptg[ith,0,0],0)
for iph in range(nph): for iph in range(nph):
rbeam=interpol_ng.rotate_alm(blmTfull, lmax, ptg[ith,iph,2],ptg[ith,iph,0],ptg[ith,iph,1]) rbeam=interpol_ng.rotate_alm(rbeamth, lmax, 0, 0, ptg[ith,iph,1])
bar2[ith,iph] = convolve(slmT, rbeam, lmax).real bar2[ith,iph] = convolve(slmT, rbeam, lmax).real
plt.subplot(2,2,2) plt.subplot(2,2,2)
plt.imshow(bar2) plt.imshow(bar2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment