support for polarization

This commit is contained in:
Andrea Zonca 2017-11-20 08:50:27 -08:00
parent cdb11e97d0
commit 2511a895ae

View file

@ -247,8 +247,8 @@ cdef class alm_info:
sharp_destroy_alm_info(self.ainfo) sharp_destroy_alm_info(self.ainfo)
self.ainfo = NULL self.ainfo = NULL
def almxfl(self, np.ndarray[double, ndim=3, mode='c'] alm, np.ndarray[double, mode='c'] fl, int rank): def almxfl(self, np.ndarray[double, ndim=3, mode='c'] alm, np.ndarray[double, ndim=2, mode='c'] fl, int rank):
"""Multiply Alms by a Ell based array """Multiply Alm by a Ell based array
Parameters Parameters
@ -264,19 +264,21 @@ cdef class alm_info:
""" """
mvstart = 0 mvstart = 0
has_multiple_beams = alm.shape[2] > 1 and fl.shape[1] > 1
for m in self.mval(): for m in self.mval():
f = 1 if (m==0) else 2 f = 1 if (m==0) else 2
num_ells = self.ainfo.lmax + 1 - m num_ells = self.ainfo.lmax + 1 - m
has_multiple_beams = alm.shape[2] > 1 and fl.ndim > 1
if not has_multiple_beams: if not has_multiple_beams:
for i_l in range(num_ells): for i_l in range(num_ells):
l = m + i_l l = m + i_l
alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[l] alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[l]
else: else:
for i_l in range(num_ells): for i_signal in range(alm.shape[0]):
l = m + i_l for i_pol in range(alm.shape[1]):
alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[:alm.shape[2],l] for i_l in range(num_ells):
l = m + i_l
alm[i_signal, i_pol, mvstart + f*i_l:mvstart + f*i_l +f] *= fl[l, i_pol]
mvstart += f * num_ells mvstart += f * num_ells
cdef class triangular_order(alm_info): cdef class triangular_order(alm_info):