def get_ext(extmap, errmap, extwcs, ra, de):
    '\n    Get the extinction (errors) for a particular position or\n    list of positions\n    More generally get the value (error) for a particular\n    position given a wcs and world coordinates\n    '
    try:
        (xp, yp) = extwcs.all_world2pix(np.array([ra]).flatten(), np.array([de]).flatten(), 0)
    except:
        (xp, yp) = WCS(extwcs).all_world2pix(np.array([ra]).flatten(), np.array([de]).flatten(), 0)
    ext = []
    err = []
    for i in range(len(np.array(xp))):
        try:
            ext.append(extmap[(yp[int(round(i))], xp[int(round(i))])])
            if (errmap is not None):
                err.append(errmap[(yp[int(round(i))], xp[int(round(i))])])
        except IndexError:
            ext.append(np.nan)
            if (errmap is not None):
                err.append(np.nan)
    if (errmap is not None):
        return (np.array(ext), np.array(err))
    else:
        return (np.array(ext), None)
Get the extinction (errors) for a particular position or
list of positions
More generally get the value (error) for a particular
position given a wcs and world coordinates
def get_ext(extmap, errmap, extwcs, ra, de):
    '\n    Get the extinction (errors) for a particular position or\n    list of positions\n    More generally get the value (error) for a particular\n    position given a wcs and world coordinates\n    '
    try:
        (xp, yp) = extwcs.all_world2pix(np.array([ra]).flatten(), np.array([de]).flatten(), 0)
    except:
        (xp, yp) = WCS(extwcs).all_world2pix(np.array([ra]).flatten(), np.array([de]).flatten(), 0)
    ext = []
    err = []
    for i in range(len(np.array(xp))):
        try:
            ext.append(extmap[(yp[int(round(i))], xp[int(round(i))])])
            if (errmap is not None):
                err.append(errmap[(yp[int(round(i))], xp[int(round(i))])])
        except IndexError:
            ext.append(np.nan)
            if (errmap is not None):
                err.append(np.nan)
    if (errmap is not None):
        return (np.array(ext), np.array(err))
    else:
        return (np.array(ext), None)