Skip to content

Commit 8c33a5e

Browse files
committed
support for polarization
1 parent 07da503 commit 8c33a5e

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

python/libsharp/libsharp.pyx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,36 @@ cdef class alm_info:
247247
sharp_destroy_alm_info(self.ainfo)
248248
self.ainfo = NULL
249249

250-
def almxfl(self, np.ndarray[double, ndim=3, mode='c'] alm, np.ndarray[double, ndim=1, mode='c'] fl, int rank):
251-
"""Multiply Alm by a Ell based array
250+
def almxfl(self, np.ndarray[double, ndim=3, mode='c'] alm, np.ndarray[double, mode='c'] fl, int rank):
251+
"""Multiply Alms by a Ell based array
252252
253-
For example beam smoothing"""
253+
254+
Parameters
255+
----------
256+
alm : np.ndarray
257+
input alm, 3 dimensions = (different signal x polarizations x lm-ordering)
258+
fl : np.ndarray
259+
either 1 dimension, e.g. gaussian beam, or 2 dimensions e.g. a polarized beam
260+
261+
Returns
262+
-------
263+
None, it modifies alms in-place
264+
265+
"""
254266
mvstart = 0
255267
for m in self.mval():
256268
f = 1 if (m==0) else 2
257269
num_ells = self.ainfo.lmax + 1 - m
258-
for i_l in range(num_ells):
259-
l = m + i_l
260-
alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[l]
270+
271+
has_multiple_beams = alm.shape[2] > 1 and fl.ndim > 1
272+
if not has_multiple_beams:
273+
for i_l in range(num_ells):
274+
l = m + i_l
275+
alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[l]
276+
else:
277+
for i_l in range(num_ells):
278+
l = m + i_l
279+
alm[:,:,mvstart + f*i_l:mvstart + f*i_l +f] *= fl[:alm.shape[2],l]
261280
mvstart += f * num_ells
262281

263282
cdef class triangular_order(alm_info):

0 commit comments

Comments
 (0)