{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If the discontinuity in "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is smaller than "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "period/2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but larger than "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "discont"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", no unwrapping is done because taking the complement would only make the discontinuity larger."
            }
          ]
        }
      ],
      "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": "out",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Output array."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Unwrap by taking the complement of large deltas with respect to the period."
            }
          ]
        }
      ],
      "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": "p",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input array."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "discont",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Maximum discontinuity between values, default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "period/2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Values below "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "period/2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are treated as if they were "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "period/2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". To have an effect different from the default, "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "discont"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should be larger than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "period/2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis along which unwrap will operate, default is the last axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "period",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Size of the range over which the input wraps. By default, it is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "2 pi"
                    },
                    {
                      "__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.21.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This unwraps a signal "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " by changing elements which have an absolute difference from their predecessor of more than "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "max(discont, period/2)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to their "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "period"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "-complementary values."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For the default case where "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "period"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "2\\pi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "discont"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\pi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", this unwraps a radian phase "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " such that adjacent differences are never greater than "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\pi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " by adding "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "2k\\pi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for some integer "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "k"
            },
            {
              "__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": 1740,
  "item_type": "_ArrayFunctionDispatcher",
  "aliases": [
    "numpy.unwrap"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "phase = np.linspace(0, np.pi, num=5)\nphase[3:] += np.pi\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "phase\nnp.unwrap(phase)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.unwrap([0, 1, 2, -1, 0], period=4)\nnp.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6)\nnp.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4)\nphase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180\nnp.unwrap(phase_deg, period=360)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis example plots the unwrapping of the wrapped input signal `w`.\nFirst generate `w`, then apply `unwrap` to get `u`.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "t = np.linspace(0, 25, 801)\nw = np.mod(1.5 * np.sin(1.1 * t + 0.26) * (1 - t / 6 + (t / 23) ** 3), 2.0) - 1\nu = np.unwrap(w, period=2.0)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nPlot `w` and `u`.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.plot(t, w, label='w (a signal wrapped to [-1, 1])')\nplt.plot(t, u, linewidth=2.5, alpha=0.5, label='unwrap(w, period=2)')\nplt.xlabel('t')\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.grid(alpha=0.6)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.legend(framealpha=1, shadow=True)\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": "numpy",
          "version": "2.4.4",
          "kind": "assets",
          "path": "fig-5282a1a76d10b23e.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "deg2rad",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "deg2rad"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "rad2deg",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "rad2deg"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "p",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "discont",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "-1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "period",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "6.283185307179586"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "unwrap"
  },
  "references": null,
  "qa": "numpy:unwrap",
  "arbitrary": [],
  "local_refs": [
    "axis",
    "discont",
    "out",
    "p",
    "period"
  ]
}