def conesearch_kdtree(kdtree,
                      racenter,
                      declcenter,
                      searchradiusdeg,
                      conesearchworkers=1):
    '''This does a cone-search around (`racenter`, `declcenter`) in `kdtree`.

    Parameters
    ----------

    kdtree : scipy.spatial.CKDTree
        This is a kdtree object generated by the `make_kdtree` function.

    racenter,declcenter : float or array-like
        This is the center coordinate to run the cone-search around in decimal
        degrees. If this is an np.array, will search for all coordinate pairs in
        the array.

    searchradiusdeg : float
        The search radius to use for the cone-search in decimal degrees.

    conesearchworkers : int
        The number of parallel workers to launch for the cone-search.

    Returns
    -------

    list or np.array of lists
        If (`racenter`, `declcenter`) is a single coordinate, this will return a
        list of the indices of the matching objects in the kdtree. If
        (`racenter`, `declcenter`) are array-likes, this will return an object
        array containing lists of matching object indices for each coordinate
        searched.

    '''

    cosdecl = np.cos(np.radians(declcenter))
    sindecl = np.sin(np.radians(declcenter))
    cosra = np.cos(np.radians(racenter))
    sinra = np.sin(np.radians(racenter))

    # this is the search distance in xyz unit vectors
    xyzdist = 2.0 * np.sin(np.radians(searchradiusdeg)/2.0)

    # look up the coordinates
    kdtindices = kdtree.query_ball_point([cosra*cosdecl,
                                          sinra*cosdecl,
                                          sindecl],
                                         xyzdist,
                                         n_jobs=conesearchworkers)

    return kdtindices
def conesearch_kdtree(kdtree,
                      racenter,
                      declcenter,
                      searchradiusdeg,
                      conesearchworkers=1):
    '''This does a cone-search around (`racenter`, `declcenter`) in `kdtree`.

    Parameters
    ----------

    kdtree : scipy.spatial.CKDTree
        This is a kdtree object generated by the `make_kdtree` function.

    racenter,declcenter : float or array-like
        This is the center coordinate to run the cone-search around in decimal
        degrees. If this is an np.array, will search for all coordinate pairs in
        the array.

    searchradiusdeg : float
        The search radius to use for the cone-search in decimal degrees.

    conesearchworkers : int
        The number of parallel workers to launch for the cone-search.

    Returns
    -------

    list or np.array of lists
        If (`racenter`, `declcenter`) is a single coordinate, this will return a
        list of the indices of the matching objects in the kdtree. If
        (`racenter`, `declcenter`) are array-likes, this will return an object
        array containing lists of matching object indices for each coordinate
        searched.

    '''

    cosdecl = np.cos(np.radians(declcenter))
    sindecl = np.sin(np.radians(declcenter))
    cosra = np.cos(np.radians(racenter))
    sinra = np.sin(np.radians(racenter))

    # this is the search distance in xyz unit vectors
    xyzdist = 2.0 * np.sin(np.radians(searchradiusdeg)/2.0)

    # look up the coordinates
    kdtindices = kdtree.query_ball_point([cosra*cosdecl,
                                          sinra*cosdecl,
                                          sindecl],
                                         xyzdist,
                                         n_jobs=conesearchworkers)

    return kdtindices
def conesearch_kdtree ( kdtree , racenter , declcenter , searchradiusdeg , conesearchworkers = 1 ) : cosdecl = np . cos ( np . radians ( declcenter ) ) sindecl = np . sin ( np . radians ( declcenter ) ) cosra = np . cos ( np . radians ( racenter ) ) sinra = np . sin ( np . radians ( racenter ) ) # this is the search distance in xyz unit vectors xyzdist = 2.0 * np . sin ( np . radians ( searchradiusdeg ) / 2.0 ) # look up the coordinates kdtindices = kdtree . query_ball_point ( [ cosra * cosdecl , sinra * cosdecl , sindecl ] , xyzdist , n_jobs = conesearchworkers ) return kdtindices
This does a cone-search around (`racenter`, `declcenter`) in `kdtree`.

    Parameters
    ----------

    kdtree : scipy.spatial.CKDTree
        This is a kdtree object generated by the `make_kdtree` function.

    racenter,declcenter : float or array-like
        This is the center coordinate to run the cone-search around in decimal
        degrees. If this is an np.array, will search for all coordinate pairs in
        the array.

    searchradiusdeg : float
        The search radius to use for the cone-search in decimal degrees.

    conesearchworkers : int
        The number of parallel workers to launch for the cone-search.

    Returns
    -------

    list or np.array of lists
        If (`racenter`, `declcenter`) is a single coordinate, this will return a
        list of the indices of the matching objects in the kdtree. If
        (`racenter`, `declcenter`) are array-likes, this will return an object
        array containing lists of matching object indices for each coordinate
        searched.
This does a cone - search around ( racenter declcenter ) in kdtree .