{
  "__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": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Return minimum and maximum values time-frequency values."
            }
          ]
        }
      ],
      "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": "n",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Number of samples in input signal."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axes_seq",
              "annotation": "{'tf', 'ft'}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return time extent first and then frequency extent or vice versa."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "center_bins: bool",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If set (default "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "False"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "), the values of the time slots and frequency bins are moved from the side the middle. This is useful, when plotting the "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "~ShortTimeFFT.stft",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " values as step functions, i.e., with no interpolation."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A tuple with four floats  "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(t0, t1, f0, f1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for 'tf' and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(f0, f1, t0, t1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for 'ft' is returned describing the corners of the time-frequency domain of the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "~ShortTimeFFT.stft",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". That tuple can be passed to "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "matplotlib.pyplot.imshow",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "matplotlib",
                "version": "*",
                "kind": "api",
                "path": "matplotlib.pyplot:imshow"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as a parameter with the same name."
            }
          ]
        }
      ],
      "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/signal/_short_time_fft.py",
  "item_line": 2153,
  "item_type": "function",
  "aliases": [
    "scipy.signal.ShortTimeFFT.extent"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "The following two plots illustrate the effect of the parameter `center_bins`:\nThe grid lines represent the three time and the four frequency values of the\nSTFT.\nThe left plot, where ``(t0, t1, f0, f1) = (0, 3, 0, 4)`` is passed as parameter\n``extent`` to `~matplotlib.pyplot.imshow`, shows the standard behavior of the\ntime and frequency values being at the lower edge of the corrsponding bin.\nThe right plot, with ``(t0, t1, f0, f1) = (-0.5, 2.5, -0.5, 3.5)``, shows that\nthe bins are centered over the respective values when passing\n``center_bins=True``.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.signal import ShortTimeFFT\nn, m = 12, 6\nSFT = ShortTimeFFT.from_window('hann', fs=m, nperseg=m, noverlap=0)\nSxx = SFT.stft(np.cos(np.arange(n)))  # produces a colorful plot\nfig, axx = plt.subplots(1, 2, tight_layout=True, figsize=(6., 4.))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "for ax_, center_bins in zip(axx, (False, True)):\n    ax_.imshow(abs(Sxx), origin='lower', interpolation=None, aspect='equal',\n               cmap='viridis', extent=SFT.extent(n, 'tf', center_bins))\n    ax_.set_title(f\"{center_bins=}\")\n    ax_.set_xlabel(f\"Time ({SFT.p_num(n)} points, Δt={SFT.delta_t})\")\n    ax_.set_ylabel(f\"Frequency ({SFT.f_pts} points, Δf={SFT.delta_f})\")\n    ax_.set_xticks(SFT.t(n))  # vertical grid line are timestamps\n    ax_.set_yticks(SFT.f)  # horizontal grid line are frequency values\n    ax_.grid(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": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-7b41413d18e544f1.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNote that the step-like behavior with the constant colors is caused by passing\n``interpolation=None`` to `~matplotlib.pyplot.imshow`."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "matplotlib.pyplot.imshow",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "matplotlib.pyplot.imshow"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Display data as an image."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.signal.ShortTimeFFT",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.signal._short_time_fft:ShortTimeFFT"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Class this method belongs to."
            }
          ]
        }
      ],
      "type": "class"
    }
  ],
  "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": "n",
        "annotation": "int",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axes_seq",
        "annotation": "Literal['tf', 'ft']",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "tf"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "center_bins",
        "annotation": "bool",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      }
    ],
    "return_annotation": "tuple[float, float, float, float]",
    "target_name": "extent"
  },
  "references": null,
  "qa": "scipy.signal._short_time_fft:ShortTimeFFT.extent",
  "arbitrary": [],
  "local_refs": [
    "axes_seq",
    "center_bins: bool",
    "n"
  ]
}