{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "results",
              "annotation": "set or ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Set of pairs "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(i,j)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", with "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i < j"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", for which the corresponding positions are close. If output_type is 'ndarray', an ndarray is returned instead of a set."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Find all pairs of points in "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "self"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " whose distance is at most r."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "r",
              "annotation": "positive float",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The maximum distance."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "p",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Which Minkowski norm to use.  "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "p"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " has to meet the condition "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1 <= p <= infinity"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". A finite large p may cause a ValueError if overflow can occur."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "eps",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Approximate search.  Branches of the tree are not explored if their nearest points are further than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "r/(1+eps)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and branches are added in bulk if their furthest points are nearer than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "r * (1+eps)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "eps"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " has to be non-negative."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "output_type",
              "annotation": "string, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Choose the output container, 'set' or 'ndarray'. Default: 'set'"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": null,
  "item_line": null,
  "item_type": "cython_function_or_method",
  "aliases": [
    "scipy.spatial.cKDTree.query_pairs"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "You can search all pairs of points in a kd-tree within a distance:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.spatial import cKDTree\nrng = np.random.default_rng()\npoints = rng.random((20, 2))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.figure(figsize=(6, 6))\nplt.plot(points[:, 0], points[:, 1], \"xk\", markersize=14)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "kd_tree = cKDTree(points)\npairs = kd_tree.query_pairs(r=0.2)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "for (i, j) in pairs:\n    plt.plot([points[i, 0], points[j, 0]],\n            [points[i, 1], points[j, 1]], \"-r\")\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-0aac80b4838cc5bf.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "self",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "r",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "p",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "2.0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "eps",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "output_type",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "set"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "query_pairs"
  },
  "references": null,
  "qa": "scipy.spatial._ckdtree:cKDTree.query_pairs",
  "arbitrary": [],
  "local_refs": [
    "eps",
    "output_type",
    "p",
    "r",
    "results"
  ]
}