{
  "__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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "ValueError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "xp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "fp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " have different length If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "xp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "fp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are not 1-D sequences If "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "period == 0",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "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": "y",
              "annotation": "float or complex (corresponding to fp) or ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The interpolated values, same shape as "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "One-dimensional linear interpolation for monotonically increasing sample points."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The x-coordinate sequence is expected to be increasing, but this is not explicitly enforced.  However, if the sequence "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is non-increasing, interpolation results are meaningless."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that, since NaN is unsortable, "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " also cannot contain NaNs."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A simple check for "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " being strictly increasing is      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "np.all(np.diff(xp) > 0)",
          "execution_status": null
        }
      ],
      "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": "x",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The x-coordinates at which to evaluate the interpolated values."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "xp",
              "annotation": "1-D sequence of floats",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The x-coordinates of the data points, must be increasing if argument "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "period"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not specified. Otherwise, "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "xp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is internally sorted after normalizing the periodic boundaries with "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "xp = xp % period"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "fp",
              "annotation": "1-D sequence of float or complex",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The y-coordinates of the data points, same length as "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "xp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "left",
              "annotation": "optional float or complex corresponding to fp",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Value to return for "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "x < xp[0]",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", default is "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "fp[0]",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "right",
              "annotation": "optional float or complex corresponding to fp",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Value to return for "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "x > xp[-1]",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", default is "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "fp[-1]",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "period",
              "annotation": "None or float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A period for the x-coordinates. This parameter allows the proper interpolation of angular x-coordinates. Parameters "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "left"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "right"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are ignored if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "period"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is specified."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points ("
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "fp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), evaluated at "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "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": "/numpy/lib/_function_base_impl.py",
  "item_line": 1538,
  "item_type": "_ArrayFunctionDispatcher",
  "aliases": [
    "numpy.interp"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nxp = [1, 2, 3]\nfp = [3, 2, 0]\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.interp(2.5, xp, fp)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp)\nUNDEF = -99.0\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.interp(3.14, xp, fp, right=UNDEF)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nPlot an interpolant to the sine function:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = np.linspace(0, 2*np.pi, 10)\ny = np.sin(x)\nxvals = np.linspace(0, 2*np.pi, 50)\nyinterp = np.interp(xvals, x, y)\nimport matplotlib.pyplot as plt\nplt.plot(x, y, 'o')\nplt.plot(xvals, yinterp, '-x')\nplt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "numpy",
          "version": "2.4.3",
          "kind": "assets",
          "path": "fig-3c763ccf50f93055.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nInterpolation with periodic x-coordinates:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = [-180, -170, -185, 185, -10, -5, 0, 365]\nxp = [190, -190, 350, -350]\nfp = [5, 10, 3, 4]\nnp.interp(x, xp, fp, period=360)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nComplex interpolation:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = [1.5, 4.0]\nxp = [2,3,5]\nfp = [1.0j, 0, 2+3j]\nnp.interp(x, xp, fp)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.interpolate",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.interpolate"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "xp",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "fp",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "left",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "right",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "period",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "interp"
  },
  "references": null,
  "qa": "numpy:interp",
  "arbitrary": [],
  "local_refs": [
    "fp",
    "left",
    "period",
    "right",
    "x",
    "xp",
    "y"
  ]
}