def make_kdtree(ra, decl):
    '''This makes a `scipy.spatial.CKDTree` on (`ra`, `decl`).

    Parameters
    ----------

    ra,decl : array-like
        The right ascension and declination coordinate pairs in decimal degrees.

    Returns
    -------

    `scipy.spatial.CKDTree`
        The cKDTRee object generated by this function is returned and can be
        used to run various spatial queries.

    '''

    # get the xyz unit vectors from ra,decl
    # since i had to remind myself:
    # https://en.wikipedia.org/wiki/Equatorial_coordinate_system
    cosdecl = np.cos(np.radians(decl))
    sindecl = np.sin(np.radians(decl))
    cosra = np.cos(np.radians(ra))
    sinra = np.sin(np.radians(ra))
    xyz = np.column_stack((cosra*cosdecl,sinra*cosdecl, sindecl))

    # generate the kdtree
    kdt = sps.cKDTree(xyz,copy_data=True)

    return kdt
def make_kdtree(ra, decl):
    '''This makes a `scipy.spatial.CKDTree` on (`ra`, `decl`).

    Parameters
    ----------

    ra,decl : array-like
        The right ascension and declination coordinate pairs in decimal degrees.

    Returns
    -------

    `scipy.spatial.CKDTree`
        The cKDTRee object generated by this function is returned and can be
        used to run various spatial queries.

    '''

    # get the xyz unit vectors from ra,decl
    # since i had to remind myself:
    # https://en.wikipedia.org/wiki/Equatorial_coordinate_system
    cosdecl = np.cos(np.radians(decl))
    sindecl = np.sin(np.radians(decl))
    cosra = np.cos(np.radians(ra))
    sinra = np.sin(np.radians(ra))
    xyz = np.column_stack((cosra*cosdecl,sinra*cosdecl, sindecl))

    # generate the kdtree
    kdt = sps.cKDTree(xyz,copy_data=True)

    return kdt
def make_kdtree ( ra , decl ) : # get the xyz unit vectors from ra,decl # since i had to remind myself: # https://en.wikipedia.org/wiki/Equatorial_coordinate_system cosdecl = np . cos ( np . radians ( decl ) ) sindecl = np . sin ( np . radians ( decl ) ) cosra = np . cos ( np . radians ( ra ) ) sinra = np . sin ( np . radians ( ra ) ) xyz = np . column_stack ( ( cosra * cosdecl , sinra * cosdecl , sindecl ) ) # generate the kdtree kdt = sps . cKDTree ( xyz , copy_data = True ) return kdt
This makes a `scipy.spatial.CKDTree` on (`ra`, `decl`).

    Parameters
    ----------

    ra,decl : array-like
        The right ascension and declination coordinate pairs in decimal degrees.

    Returns
    -------

    `scipy.spatial.CKDTree`
        The cKDTRee object generated by this function is returned and can be
        used to run various spatial queries.
This makes a scipy . spatial . CKDTree on ( ra decl ) .