{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This approach was designed for finding sharp peaks among noisy data, however with proper parameter selection it should function well for different peak shapes."
            }
          ]
        },
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "The algorithm is as follows:"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": true,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Perform a continuous wavelet transform on "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "vector"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", for the supplied     "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "widths"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ". This is a convolution of "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "vector"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " with "
                            },
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "wavelet(width)",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " for     each width in "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "widths"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ". See "
                            },
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "cwt",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Identify \"ridge lines\" in the cwt matrix. These are relative maxima     at each row, connected across adjacent rows. See identify_ridge_lines"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Filter the ridge_lines using filter_ridge_lines."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.11.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_cwt",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.signal._peak_finding:find_peaks_cwt"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ⛔                   \nPyTorch               ⛔                     ⛔                   \nJAX                   ⛔                     ⛔                   \nDask                  ⛔                     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "peaks_indices",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Indices of the locations in the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "vector"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " where peaks were found. The list is sorted."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Find peaks in a 1-D array with wavelet transformation."
            }
          ]
        }
      ],
      "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": "vector",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "1-D array in which to find the peaks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "widths",
              "annotation": "float or sequence",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Single width or 1-D array-like of widths to use for calculating the CWT matrix. In general, this range should cover the expected width of peaks of interest."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "wavelet",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Should take two parameters and return a 1-D array to convolve with "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "vector"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The first parameter determines the number of points of the returned wavelet array, the second parameter is the scale ("
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "width",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") of the wavelet. Should be normalized and symmetric. Default is the ricker wavelet."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "max_distances",
              "annotation": "ndarray, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "At each row, a ridge line is only connected if the relative max at row[n] is within "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "max_distances[n]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " from the relative max at "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "row[n+1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  Default value is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "widths/4"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "gap_thresh",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If a relative maximum is not found within "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "max_distances"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", there will be a gap. A ridge line is discontinued if there are more than "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "gap_thresh"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " points without connecting a new relative maximum. Default is the first value of the widths array i.e. widths[0]."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "min_length",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Minimum length a ridge line needs to be acceptable. Default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "cwt.shape[0] / 4"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", ie 1/4-th the number of widths."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "min_snr",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Minimum SNR ratio. Default 1. The signal is the maximum CWT coefficient on the largest ridge line. The noise is "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "noise_perc"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " th percentile of datapoints contained within the same ridge line."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "noise_perc",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When calculating the noise floor, percentile of data points examined below which to consider noise. Calculated using "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "stats.scoreatpercentile",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  Default is 10."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "window_size",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Size of window to use to calculate noise floor. Default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "cwt.shape[1] / 20"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The general approach is to smooth "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " by convolving it with "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "wavelet(width)",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for each width in "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "widths"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Relative maxima which appear at enough length scales, and with sufficiently high SNR, are accepted."
            }
          ]
        }
      ],
      "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": 1201,
  "item_type": "function",
  "aliases": [
    "scipy.signal.find_peaks_cwt"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy import signal\nxs = np.arange(0, np.pi, 0.05)\ndata = np.sin(xs)\npeakind = signal.find_peaks_cwt(data, np.arange(1,10))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "peakind, xs[peakind], data[peakind]\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "find_peaks",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.signal._peak_finding:find_peaks"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Find peaks inside a signal based on peak properties."
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "vector",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "widths",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "wavelet",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "max_distances",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "gap_thresh",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "min_length",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "min_snr",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "noise_perc",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "10"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "window_size",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "find_peaks_cwt"
  },
  "references": [
    ".. [1] Bioinformatics (2006) 22 (17): 2059-2065.",
    "   :doi:`10.1093/bioinformatics/btl355`"
  ],
  "qa": "scipy.signal._peak_finding:find_peaks_cwt",
  "arbitrary": [],
  "local_refs": [
    "gap_thresh",
    "max_distances",
    "min_length",
    "min_snr",
    "noise_perc",
    "peaks_indices",
    "vector",
    "wavelet",
    "widths",
    "window_size"
  ]
}