(m, nside_out, pess=False, power=None, dtype=None)
return map_out.astype(type_out)
Internal routine used by ud_grade. It assumes that the map is NESTED
    and single (not a list of maps)
Internal routine used by ud_grade. It assumes that the map is NESTED
    and single (not a list of maps)
Internal routine used by ud_grade . It assumes that the map is NESTED and single ( not a list of maps )
def _ud_grade_core(m, nside_out, pess=False, power=None, dtype=None):
    """Internal routine used by ud_grade. It assumes that the map is NESTED
    and single (not a list of maps)
    """
    nside_in = get_nside(m)
    if dtype:
        type_out = dtype
    else:
        type_out = type(m[0])
    check_nside(nside_out, nest=True)
    npix_in = nside2npix(nside_in)
    npix_out = nside2npix(nside_out)

    if power:
        power = float(power)
        ratio = (float(nside_out) / float(nside_in)) ** power
    else:
        ratio = 1

    if nside_out > nside_in:
        rat2 = npix_out // npix_in
        fact = np.ones(rat2, dtype=type_out) * ratio
        map_out = np.outer(m, fact).reshape(npix_out)
    elif nside_out < nside_in:
        rat2 = npix_in // npix_out
        mr = m.reshape(npix_out, rat2)
        goods = ~(mask_bad(mr) | (~np.isfinite(mr)))
        map_out = np.sum(mr * goods, axis=1).astype(type_out)
        nhit = goods.sum(axis=1)
        if pess:
            badout = np.where(nhit != rat2)
        else:
            badout = np.where(nhit == 0)
        if power:
            nhit = nhit / ratio
        map_out[nhit != 0] = map_out[nhit != 0] / nhit[nhit != 0]
        try:
            map_out[badout] = UNSEEN
        except OverflowError:
            pass
    else:
        map_out = m
    return map_out.astype(type_out)
def _ud_grade_core ( m , nside_out , pess = False , power = None , dtype = None ) : nside_in = get_nside ( m ) if dtype : type_out = dtype else : type_out = type ( m [ 0 ] ) check_nside ( nside_out , nest = True ) npix_in = nside2npix ( nside_in ) npix_out = nside2npix ( nside_out ) if power : power = float ( power ) ratio = ( float ( nside_out ) / float ( nside_in ) ) ** power else : ratio = 1 if nside_out > nside_in : rat2 = npix_out // npix_in fact = np . ones ( rat2 , dtype = type_out ) * ratio map_out = np . outer ( m , fact ) . reshape ( npix_out ) elif nside_out < nside_in : rat2 = npix_in // npix_out mr = m . reshape ( npix_out , rat2 ) goods = ~ ( mask_bad ( mr ) | ( ~ np . isfinite ( mr ) ) ) map_out = np . sum ( mr * goods , axis = 1 ) . astype ( type_out ) nhit = goods . sum ( axis = 1 ) if pess : badout = np . where ( nhit != rat2 ) else : badout = np . where ( nhit == 0 ) if power : nhit = nhit / ratio map_out [ nhit != 0 ] = map_out [ nhit != 0 ] / nhit [ nhit != 0 ] try : map_out [ badout ] = UNSEEN except OverflowError : pass else : map_out = m return map_out . astype ( type_out )