(
    map_in,
    nside_out,
    pess=False,
    order_in="RING",
    order_out=None,
    power=None,
    dtype=None,
)
Upgrade or degrade resolution of a map (or list of maps).

    in degrading the resolution, ud_grade sets the value of the superpixel
    as the mean of the children pixels.

    Parameters
    ----------
    map_in : array-like or sequence of array-like
      the input map(s) (if a sequence of maps, all must have same size)
    nside_out : int
      the desired nside of the output map(s)
    pess : bool
      if ``True``, in degrading, reject pixels which contains
      a bad sub_pixel. Otherwise, estimate average with good pixels
    order_in, order_out : str
      pixel ordering of input and output ('RING' or 'NESTED')
    power : float
      if non-zero, divide the result by (nside_in/nside_out)**power
      Examples:
      power=-2 keeps the sum of the map invariant (useful for hitmaps),
      power=2 divides the mean by another factor of (nside_in/nside_out)**2
      (useful for variance maps)
    dtype : type
      the type of the output map

    Returns
    -------
    map_out : array-like or sequence of array-like
      the upgraded or degraded map(s)

    Examples
    --------
    >>> import healpy as hp
    >>> hp.ud_grade(np.arange(48.), 1)
    array([  5.5 ,   7.25,   9.  ,  10.75,  21.75,  21.75,  23.75,  25.75,
            36.5 ,  38.25,  40.  ,  41.75])
Upgrade or degrade resolution of a map (or list of maps).
Upgrade or degrade resolution of a map ( or list of maps ) .
def ud_grade(
    map_in,
    nside_out,
    pess=False,
    order_in="RING",
    order_out=None,
    power=None,
    dtype=None,
):
    """Upgrade or degrade resolution of a map (or list of maps).

    in degrading the resolution, ud_grade sets the value of the superpixel
    as the mean of the children pixels.

    Parameters
    ----------
    map_in : array-like or sequence of array-like
      the input map(s) (if a sequence of maps, all must have same size)
    nside_out : int
      the desired nside of the output map(s)
    pess : bool
      if ``True``, in degrading, reject pixels which contains
      a bad sub_pixel. Otherwise, estimate average with good pixels
    order_in, order_out : str
      pixel ordering of input and output ('RING' or 'NESTED')
    power : float
      if non-zero, divide the result by (nside_in/nside_out)**power
      Examples:
      power=-2 keeps the sum of the map invariant (useful for hitmaps),
      power=2 divides the mean by another factor of (nside_in/nside_out)**2
      (useful for variance maps)
    dtype : type
      the type of the output map

    Returns
    -------
    map_out : array-like or sequence of array-like
      the upgraded or degraded map(s)

    Examples
    --------
    >>> import healpy as hp
    >>> hp.ud_grade(np.arange(48.), 1)
    array([  5.5 ,   7.25,   9.  ,  10.75,  21.75,  21.75,  23.75,  25.75,
            36.5 ,  38.25,  40.  ,  41.75])
    """
    check_nside(nside_out, nest=order_in != "RING")
    typ = maptype(map_in)
    if typ < 0:
        raise TypeError("Invalid map")
    if typ == 0:
        m_in = [map_in]
    else:
        m_in = map_in
    mapout = []
    if order_out is None:
        order_out = order_in
    for m in m_in:
        if str(order_in).upper()[0:4] == "RING":
            m = reorder(m, r2n=True)
        mout = _ud_grade_core(m, nside_out, pess=pess, power=power, dtype=dtype)
        if str(order_out).upper()[0:4] == "RING":
            mout = reorder(mout, n2r=True)
        mapout.append(mout)
    if typ == 0:
        return mapout[0]
    else:
        return np.array(mapout)
def ud_grade ( map_in , nside_out , pess = False , order_in = "RING" , order_out = None , power = None , dtype = None , ) : check_nside ( nside_out , nest = order_in != "RING" ) typ = maptype ( map_in ) if typ < 0 : raise TypeError ( "Invalid map" ) if typ == 0 : m_in = [ map_in ] else : m_in = map_in mapout = [ ] if order_out is None : order_out = order_in for m in m_in : if str ( order_in ) . upper ( ) [ 0 : 4 ] == "RING" : m = reorder ( m , r2n = True ) mout = _ud_grade_core ( m , nside_out , pess = pess , power = power , dtype = dtype ) if str ( order_out ) . upper ( ) [ 0 : 4 ] == "RING" : mout = reorder ( mout , n2r = True ) mapout . append ( mout ) if typ == 0 : return mapout [ 0 ] else : return np . array ( mapout )