{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the context of this function, a peak or local maximum is defined as any sample whose two direct neighbours have a smaller amplitude. For flat peaks (more than one sample of equal amplitude wide) the index of the middle sample is returned (rounded down in case the number of samples is even). For noisy signals the peak locations can be off because the noise might change the position of local maxima. In those cases consider smoothing the signal before searching for peaks or use other peak finding and fitting methods (like "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "find_peaks_cwt",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.signal._peak_finding:find_peaks_cwt"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ")."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Some additional comments on specifying conditions:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Almost all conditions (excluding "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "distance"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") can be given as half-open or   closed intervals, e.g., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(1, None)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " defines the half-open   interval "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "[1, \\infty]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " while "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(None, 1)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " defines the interval   "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "[-\\infty, 1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The open interval "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(None, None)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be specified   as well, which returns the matching properties without exclusion of peaks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The border is always included in the interval used to select valid peaks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "For several conditions the interval borders can be specified with   arrays matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " in shape which enables dynamic constrains based on   the sample position."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The conditions are evaluated in the following order: "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "plateau_size"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ",   "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "height"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "threshold"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "distance"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "prominence"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "width"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". In most cases   this order is the fastest one because faster operations are applied first   to reduce the number of peaks that need to be evaluated later."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "While indices in "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peaks",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "peaks"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are guaranteed to be at least "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "distance"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " samples   apart, edges of flat peaks may be closer than the allowed "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "distance"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Use "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "wlen"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to reduce the time it takes to evaluate the conditions for   "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "prominence"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "width"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is large or has many local maxima   (see "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peak_prominences",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.signal._peak_finding:peak_prominences"
                      },
                      "kind": "module"
                    },
                    {
                      "__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.1.0"
                }
              ]
            }
          ]
        },
        {
          "__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": "find_peaks",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.signal._peak_finding:find_peaks"
              },
              "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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "PeakPropertyWarning",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Raised if a peak's properties have unexpected values (see "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peak_prominences",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.signal._peak_finding:peak_prominences"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peak_widths",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.signal._peak_finding:peak_widths"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "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": "peaks",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Indices of peaks in "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " that satisfy all given conditions."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "properties",
              "annotation": "dict",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A dictionary containing properties of the returned peaks which were calculated as intermediate results during evaluation of the specified conditions:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "DefList",
                          "__tag": 4033,
                          "children": [
                            {
                              "__type": "DefListItem",
                              "__tag": 4037,
                              "dt": {
                                "__type": "Paragraph",
                                "__tag": 4045,
                                "children": [
                                  {
                                    "__type": "Text",
                                    "__tag": 4046,
                                    "value": "'peak_heights'"
                                  }
                                ]
                              },
                              "dd": [
                                {
                                  "__type": "Paragraph",
                                  "__tag": 4045,
                                  "children": [
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "If "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "height"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " is given, the height of each peak in "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "x"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "."
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "DefList",
                          "__tag": 4033,
                          "children": [
                            {
                              "__type": "DefListItem",
                              "__tag": 4037,
                              "dt": {
                                "__type": "Paragraph",
                                "__tag": 4045,
                                "children": [
                                  {
                                    "__type": "Text",
                                    "__tag": 4046,
                                    "value": "'left_thresholds', 'right_thresholds'"
                                  }
                                ]
                              },
                              "dd": [
                                {
                                  "__type": "Paragraph",
                                  "__tag": 4045,
                                  "children": [
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "If "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "threshold"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " is given, these keys contain a peaks vertical       distance to its neighbouring samples."
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "DefList",
                          "__tag": 4033,
                          "children": [
                            {
                              "__type": "DefListItem",
                              "__tag": 4037,
                              "dt": {
                                "__type": "Paragraph",
                                "__tag": 4045,
                                "children": [
                                  {
                                    "__type": "Text",
                                    "__tag": 4046,
                                    "value": "'prominences', 'right_bases', 'left_bases'"
                                  }
                                ]
                              },
                              "dd": [
                                {
                                  "__type": "Paragraph",
                                  "__tag": 4045,
                                  "children": [
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "If "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "prominence"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " is given, these keys are accessible. See       "
                                    },
                                    {
                                      "__type": "CrossRef",
                                      "__tag": 4002,
                                      "value": "peak_prominences",
                                      "reference": {
                                        "__type": "LocalRef",
                                        "__tag": 4022,
                                        "kind": "module",
                                        "path": "scipy.signal._peak_finding:peak_prominences"
                                      },
                                      "kind": "module"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " for a description of their content."
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "DefList",
                          "__tag": 4033,
                          "children": [
                            {
                              "__type": "DefListItem",
                              "__tag": 4037,
                              "dt": {
                                "__type": "Paragraph",
                                "__tag": 4045,
                                "children": [
                                  {
                                    "__type": "Text",
                                    "__tag": 4046,
                                    "value": "'widths', 'width_heights', 'left_ips', 'right_ips'"
                                  }
                                ]
                              },
                              "dd": [
                                {
                                  "__type": "Paragraph",
                                  "__tag": 4045,
                                  "children": [
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "If "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "width"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " is given, these keys are accessible. See "
                                    },
                                    {
                                      "__type": "CrossRef",
                                      "__tag": 4002,
                                      "value": "peak_widths",
                                      "reference": {
                                        "__type": "LocalRef",
                                        "__tag": 4022,
                                        "kind": "module",
                                        "path": "scipy.signal._peak_finding:peak_widths"
                                      },
                                      "kind": "module"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "       for a description of their content."
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "DefList",
                          "__tag": 4033,
                          "children": [
                            {
                              "__type": "DefListItem",
                              "__tag": 4037,
                              "dt": {
                                "__type": "Paragraph",
                                "__tag": 4045,
                                "children": [
                                  {
                                    "__type": "Text",
                                    "__tag": 4046,
                                    "value": "'plateau_sizes', left_edges', 'right_edges'"
                                  }
                                ]
                              },
                              "dd": [
                                {
                                  "__type": "Paragraph",
                                  "__tag": 4045,
                                  "children": [
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": "If "
                                    },
                                    {
                                      "__type": "ParamRef",
                                      "__tag": 4071,
                                      "name": "plateau_size"
                                    },
                                    {
                                      "__type": "Text",
                                      "__tag": 4046,
                                      "value": " is given, these keys are accessible and contain       the indices of a peak's edges (edges are still part of the       plateau) and the calculated plateau sizes."
                                    }
                                  ]
                                },
                                {
                                  "__type": "Admonition",
                                  "__tag": 4056,
                                  "kind": "versionadded",
                                  "base_type": "neutral",
                                  "children": [
                                    {
                                      "__type": "AdmonitionTitle",
                                      "__tag": 4055,
                                      "children": [
                                        {
                                          "__type": "Text",
                                          "__tag": 4046,
                                          "value": "versionadded 1.2.0"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "To calculate and return properties without excluding peaks, provide the open interval "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(None, None)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " as a value to the appropriate argument (excluding "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "distance"
                    },
                    {
                      "__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": "Find peaks inside a signal based on peak properties."
            }
          ]
        }
      ],
      "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": "This function may return unexpected results for data containing NaNs. To avoid this, NaNs should either be removed or replaced."
            }
          ]
        }
      ],
      "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": "sequence",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A signal with peaks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "height",
              "annotation": "number or ndarray or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required height of peaks. Either a number, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an array matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or a 2-element sequence of the former. The first element is always interpreted as the  minimal and the second, if supplied, as the maximal required height."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "threshold",
              "annotation": "number or ndarray or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required threshold of peaks, the vertical distance to its neighboring samples. Either a number, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an array matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or a 2-element sequence of the former. The first element is always interpreted as the  minimal and the second, if supplied, as the maximal required threshold."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "distance",
              "annotation": "number, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required minimal horizontal distance (>= 1) in samples between neighbouring peaks. Smaller peaks are removed first until the condition is fulfilled for all remaining peaks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "prominence",
              "annotation": "number or ndarray or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required prominence of peaks. Either a number, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an array matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or a 2-element sequence of the former. The first element is always interpreted as the  minimal and the second, if supplied, as the maximal required prominence."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "width",
              "annotation": "number or ndarray or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required width of peaks in samples. Either a number, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an array matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or a 2-element sequence of the former. The first element is always interpreted as the  minimal and the second, if supplied, as the maximal required width."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "wlen",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Used for calculation of the peaks prominences, thus it is only used if one of the arguments "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "prominence"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "width"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is given. See argument "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "wlen"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " in "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peak_prominences",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.signal._peak_finding:peak_prominences"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for a full description of its effects."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rel_height",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Used for calculation of the peaks width, thus it is only used if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "width"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is given. See argument  "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rel_height"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " in "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "peak_widths",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.signal._peak_finding:peak_widths"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for a full description of its effects."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "plateau_size",
              "annotation": "number or ndarray or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Required size of the flat top of peaks in samples. Either a number, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an array matching "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or a 2-element sequence of the former. The first element is always interpreted as the minimal and the second, if supplied as the maximal required plateau size."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.2.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function takes a 1-D array and finds all local maxima by simple comparison of neighboring values. Optionally, a subset of these peaks can be selected by specifying conditions for a peak's properties."
            }
          ]
        }
      ],
      "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/_peak_finding.py",
  "item_line": 729,
  "item_type": "function",
  "aliases": [
    "scipy.signal.find_peaks"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "To demonstrate this function's usage we use a signal `x` supplied with\nSciPy (see `scipy.datasets.electrocardiogram`). Let's find all peaks (local\nmaxima) in `x` whose amplitude lies above 0.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.datasets import electrocardiogram\nfrom scipy.signal import find_peaks\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = electrocardiogram()[2000:4000]\npeaks, _ = find_peaks(x, height=0)\nplt.plot(x)\nplt.plot(peaks, x[peaks], \"x\")\nplt.plot(np.zeros_like(x), \"--\", color=\"gray\")\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nWe can select peaks below 0 with ``height=(None, 0)`` or use arrays matching\n`x` in size to reflect a changing condition for different parts of the\nsignal.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "border = np.sin(np.linspace(0, 3 * np.pi, x.size))\npeaks, _ = find_peaks(x, height=(-border, border))\nplt.plot(x)\nplt.plot(-border, \"--\", color=\"gray\")\nplt.plot(border, \":\", color=\"gray\")\nplt.plot(peaks, x[peaks], \"x\")\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAnother useful condition for periodic signals can be given with the\n`distance` argument. In this case, we can easily select the positions of\nQRS complexes within the electrocardiogram (ECG) by demanding a distance of\nat least 150 samples.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "peaks, _ = find_peaks(x, distance=150)\nnp.diff(peaks)\nplt.plot(x)\nplt.plot(peaks, x[peaks], \"x\")\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nEspecially for noisy signals peaks can be easily grouped by their\nprominence (see `peak_prominences`). E.g., we can select all peaks except\nfor the mentioned QRS complexes by limiting the allowed prominence to 0.6.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "peaks, properties = find_peaks(x, prominence=(None, 0.6))\nproperties[\"prominences\"].max()\nplt.plot(x)\nplt.plot(peaks, x[peaks], \"x\")\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAnd, finally, let's examine a different section of the ECG which contains\nbeat forms of different shape. To select only the atypical heart beats, we\ncombine two conditions: a minimal prominence of 1 and width of at least 20\nsamples.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = electrocardiogram()[17000:18000]\npeaks, properties = find_peaks(x, prominence=1, width=20)\nproperties[\"prominences\"], properties[\"widths\"]\nplt.plot(x)\nplt.plot(peaks, x[peaks], \"x\")\nplt.vlines(x=peaks, ymin=x[peaks] - properties[\"prominences\"],\n           ymax = x[peaks], color = \"C1\")\nplt.hlines(y=properties[\"width_heights\"], xmin=properties[\"left_ips\"],\n           xmax=properties[\"right_ips\"], color = \"C1\")\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "find_peaks_cwt",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.signal._peak_finding:find_peaks_cwt"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Find peaks using the wavelet transformation."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "peak_prominences",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.signal._peak_finding:peak_prominences"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Directly calculate the prominence of peaks."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "peak_widths",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.signal._peak_finding:peak_widths"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Directly calculate the width of peaks."
            }
          ]
        }
      ],
      "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": "height",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "threshold",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "distance",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "prominence",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "width",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "wlen",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rel_height",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.5"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "plateau_size",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "find_peaks"
  },
  "references": null,
  "qa": "scipy.signal._peak_finding:find_peaks",
  "arbitrary": [],
  "local_refs": [
    "distance",
    "height",
    "peaks",
    "plateau_size",
    "prominence",
    "properties",
    "rel_height",
    "threshold",
    "width",
    "wlen",
    "x"
  ]
}