{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.14"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Use only for precise data, as the fitted curve passes through the given points exactly. This routine is useful for plotting a pleasingly smooth curve through a few given points for purposes of plotting."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Let "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\delta_i = (y_{i+1} - y_i) / (x_{i+1} - x_i)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " be the slopes of the interval "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\left[x_i, x_{i+1}\\right)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Akima's derivative at "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x_i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is defined as:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "d_i = \\frac{w_1}{w_1 + w_2}\\delta_{i-1} + \\frac{w_2}{w_1 + w_2}\\delta_i"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the Akima interpolation "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "method=\"akima\""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), the weights are:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "\\begin{aligned}\nw_1 &= |\\delta_{i+1} - \\delta_i| \\\\\nw_2 &= |\\delta_{i-1} - \\delta_{i-2}|\n\\end{aligned}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the modified Akima interpolation "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "method=\"makima\""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), to eliminate overshoot and avoid edge cases of both numerator and denominator being equal to 0, the weights are modified as follows:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "\\begin{align*}\nw_1 &= |\\delta_{i+1} - \\delta_i| + |\\delta_{i+1} + \\delta_i| / 2 \\\\\nw_2 &= |\\delta_{i-1} - \\delta_{i-2}| + |\\delta_{i-1} + \\delta_{i-2}| / 2\n\\end{align*}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "Akima1DInterpolator",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.interpolate._cubic:Akima1DInterpolator"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ⛔                   \nPyTorch               ✅                     ⛔                   \nJAX                   ⛔                     ⛔                   \nDask                  ⛔                     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "__call__",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "derivative",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "antiderivative",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "integrate",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "solve",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "roots",
              "annotation": "",
              "desc": []
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Akima \"visually pleasing\" interpolator (C1 smooth)."
            }
          ]
        }
      ],
      "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": "x",
              "annotation": "ndarray, shape (npoints, )",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "1-D array of monotonically increasing real values."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "y",
              "annotation": "ndarray, shape (..., npoints, ...)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "N-D array of real values. The length of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " along the interpolation axis must be equal to the length of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Use the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " parameter to select the interpolation axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis in the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array corresponding to the x-coordinate values. Defaults to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "axis=0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "method",
              "annotation": "{'akima', 'makima'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"makima\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", use the modified Akima interpolation "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Defaults to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"akima\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", use the Akima interpolation "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.13.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extrapolate",
              "annotation": "{bool, None}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If bool, determines whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs. If None, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "extrapolate"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is set to False."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Fit piecewise cubic polynomials, given vectors x and y. The interpolation method by Akima uses a continuously differentiable sub-spline built from piecewise cubic polynomials. The resultant curve passes through the given data points and will appear smooth and natural."
            }
          ]
        }
      ],
      "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": "/scipy/interpolate/_cubic.py",
  "item_line": 401,
  "item_type": "class",
  "aliases": [
    "scipy.interpolate.Akima1DInterpolator"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Comparison of ``method=\"akima\"`` and ``method=\"makima\"``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.interpolate import Akima1DInterpolator\nimport matplotlib.pyplot as plt\nx = np.linspace(1, 7, 7)\ny = np.array([-1, -1, -1, 0, 1, 1, 1])\nxs = np.linspace(min(x), max(x), num=100)\ny_akima = Akima1DInterpolator(x, y, method=\"akima\")(xs)\ny_makima = Akima1DInterpolator(x, y, method=\"makima\")(xs)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(x, y, \"o\", label=\"data\")\nax.plot(xs, y_akima, label=\"akima\")\nax.plot(xs, y_makima, label=\"makima\")\nax.legend()\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe overshoot that occurred in ``\"akima\"`` has been avoided in ``\"makima\"``."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "CubicSpline",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._cubic:CubicSpline"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Cubic spline data interpolator."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "PPoly",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._interpolate:PPoly"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Piecewise polynomial in terms of coefficients and breakpoints"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "PchipInterpolator",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._cubic:PchipInterpolator"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "PCHIP 1-D monotonic cubic interpolator."
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "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": "y",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "method",
        "annotation": "Literal['akima', 'makima']",
        "kind": "KEYWORD_ONLY",
        "default": "akima"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "extrapolate",
        "annotation": "bool | None",
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "Akima1DInterpolator"
  },
  "references": [
    ".. [1] A new method of interpolation and smooth curve fitting based",
    "       on local procedures. Hiroshi Akima, J. ACM, October 1970, 17(4),",
    "       589-602. :doi:`10.1145/321607.321609`",
    ".. [2] Makima Piecewise Cubic Interpolation. Cleve Moler and Cosmin Ionita, 2019.",
    "       https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/"
  ],
  "qa": "scipy.interpolate._cubic:Akima1DInterpolator",
  "arbitrary": [],
  "local_refs": [
    "__call__",
    "antiderivative",
    "axis",
    "derivative",
    "extrapolate",
    "integrate",
    "method",
    "roots",
    "solve",
    "x",
    "y"
  ]
}