(
    alms,
    fwhm=0.0,
    sigma=None,
    beam_window=None,
    pol=True,
    mmax=None,
    verbose=True,
    inplace=True,
)
return alms
Smooth alm with a Gaussian symmetric beam function.

    Parameters
    ----------
    alms : array or sequence of 3 arrays
      Either an array representing one alm, or a sequence of arrays.
      See *pol* parameter.
    fwhm : float, optional
      The full width half max parameter of the Gaussian. Default:0.0
      [in radians]
    sigma : float, optional
      The sigma of the Gaussian. Override fwhm.
      [in radians]
    beam_window: array, optional
      Custom beam window function. Override fwhm and sigma.
    pol : bool, optional
      If True, assumes input alms are TEB. Output will be TQU maps.
      (input must be 1 or 3 alms)
      If False, apply spin 0 harmonic transform to each alm.
      (input can be any number of alms)
      If there is only one input alm, it has no effect. Default: True.
    mmax : None or int, optional
      The maximum m for alm. Default: mmax=lmax
    inplace : bool, optional
      If True, the alm's are modified inplace if they are contiguous arrays
      of type complex128. Otherwise, a copy of alm is made. Default: True.
    verbose : bool, optional
      Deprecated, has not effect.

    Returns
    -------
    alms : array or sequence of 3 arrays
      The smoothed alm. If alm[i] is a contiguous array of type complex128,
      and *inplace* is True the smoothing is applied inplace.
      Otherwise, a copy is made.
Smooth alm with a Gaussian symmetric beam function.
Smooth alm with a Gaussian symmetric beam function .
def smoothalm(
    alms,
    fwhm=0.0,
    sigma=None,
    beam_window=None,
    pol=True,
    mmax=None,
    verbose=True,
    inplace=True,
):
    """Smooth alm with a Gaussian symmetric beam function.

    Parameters
    ----------
    alms : array or sequence of 3 arrays
      Either an array representing one alm, or a sequence of arrays.
      See *pol* parameter.
    fwhm : float, optional
      The full width half max parameter of the Gaussian. Default:0.0
      [in radians]
    sigma : float, optional
      The sigma of the Gaussian. Override fwhm.
      [in radians]
    beam_window: array, optional
      Custom beam window function. Override fwhm and sigma.
    pol : bool, optional
      If True, assumes input alms are TEB. Output will be TQU maps.
      (input must be 1 or 3 alms)
      If False, apply spin 0 harmonic transform to each alm.
      (input can be any number of alms)
      If there is only one input alm, it has no effect. Default: True.
    mmax : None or int, optional
      The maximum m for alm. Default: mmax=lmax
    inplace : bool, optional
      If True, the alm's are modified inplace if they are contiguous arrays
      of type complex128. Otherwise, a copy of alm is made. Default: True.
    verbose : bool, optional
      Deprecated, has not effect.

    Returns
    -------
    alms : array or sequence of 3 arrays
      The smoothed alm. If alm[i] is a contiguous array of type complex128,
      and *inplace* is True the smoothing is applied inplace.
      Otherwise, a copy is made.
    """
    if (sigma is None) & (beam_window is None):
        sigma = fwhm / (2.0 * np.sqrt(2.0 * np.log(2.0)))

    if beam_window is None:
        log.info("Sigma is %f arcmin (%f rad) ", sigma * 60 * 180 / np.pi, sigma)
        log.info(
            "-> fwhm is %f arcmin",
            sigma * 60 * 180 / np.pi * (2.0 * np.sqrt(2.0 * np.log(2.0)))
        )

    # Check alms
    if not cb.is_seq(alms):
        raise ValueError("alm must be a sequence")

    if (sigma == 0) & (beam_window is None):
        # nothing to be done
        return alms

    lonely = False
    if not cb.is_seq_of_seq(alms):
        alms = [alms]
        lonely = True

    # we have 3 alms -> apply smoothing to each map.
    # polarization has different B_l from temperature
    # exp{-[ell(ell+1) - s**2] * sigma**2/2}
    # with s the spin of spherical harmonics
    # s = 2 for pol, s=0 for temperature
    retalm = []
    for ialm, alm in enumerate(alms):
        lmax = Alm.getlmax(len(alm), mmax)
        if lmax < 0:
            raise TypeError(
                "Wrong alm size for the given "
                "mmax (len(alms[%d]) = %d)." % (ialm, len(alm))
            )
        ell = np.arange(lmax + 1.0)
        s = 2 if ialm >= 1 and pol else 0
        if beam_window is None:
            fact = np.exp(-0.5 * (ell * (ell + 1) - s ** 2) * sigma ** 2)
        else:
            fact = np.copy(beam_window)
        res = almxfl(alm, fact, mmax=mmax, inplace=inplace)
        retalm.append(res)
    # Test what to return (inplace/not inplace...)
    # Case 1: 1d input, return 1d output
    if lonely:
        return retalm[0]
    # case 2: 2d input, check if in-place smoothing for all alm's
    for i in range(len(alms)):
        samearray = alms[i] is retalm[i]
        if not samearray:
            # Case 2a:
            # at least one of the alm could not be smoothed in place:
            # return the list of alm
            return np.array(retalm)
    # Case 2b:
    # all smoothing have been performed in place:
    # return the input alms.  If the input was a tuple, so will the output be.
    return alms
def smoothalm ( alms , fwhm = 0.0 , sigma = None , beam_window = None , pol = True , mmax = None , verbose = True , inplace = True , ) : if ( sigma is None ) & ( beam_window is None ) : sigma = fwhm / ( 2.0 * np . sqrt ( 2.0 * np . log ( 2.0 ) ) ) if beam_window is None : log . info ( "Sigma is %f arcmin (%f rad) " , sigma * 60 * 180 / np . pi , sigma ) log . info ( "-> fwhm is %f arcmin" , sigma * 60 * 180 / np . pi * ( 2.0 * np . sqrt ( 2.0 * np . log ( 2.0 ) ) ) ) # Check alms if not cb . is_seq ( alms ) : raise ValueError ( "alm must be a sequence" ) if ( sigma == 0 ) & ( beam_window is None ) : # nothing to be done return alms lonely = False if not cb . is_seq_of_seq ( alms ) : alms = [ alms ] lonely = True # we have 3 alms -> apply smoothing to each map. # polarization has different B_l from temperature # exp{-[ell(ell+1) - s**2] * sigma**2/2} # with s the spin of spherical harmonics # s = 2 for pol, s=0 for temperature retalm = [ ] for ialm , alm in enumerate ( alms ) : lmax = Alm . getlmax ( len ( alm ) , mmax ) if lmax < 0 : raise TypeError ( "Wrong alm size for the given " "mmax (len(alms[%d]) = %d)." % ( ialm , len ( alm ) ) ) ell = np . arange ( lmax + 1.0 ) s = 2 if ialm >= 1 and pol else 0 if beam_window is None : fact = np . exp ( - 0.5 * ( ell * ( ell + 1 ) - s ** 2 ) * sigma ** 2 ) else : fact = np . copy ( beam_window ) res = almxfl ( alm , fact , mmax = mmax , inplace = inplace ) retalm . append ( res ) # Test what to return (inplace/not inplace...) # Case 1: 1d input, return 1d output if lonely : return retalm [ 0 ] # case 2: 2d input, check if in-place smoothing for all alm's for i in range ( len ( alms ) ) : samearray = alms [ i ] is retalm [ i ] if not samearray : # Case 2a: # at least one of the alm could not be smoothed in place: # return the list of alm return np . array ( retalm ) # Case 2b: # all smoothing have been performed in place: # return the input alms.  If the input was a tuple, so will the output be. return alms