{"id":13481650,"url":"https://github.com/efekarakus/d3-peaks","last_synced_at":"2025-12-24T09:17:41.653Z","repository":{"id":78223909,"uuid":"52752838","full_name":"efekarakus/d3-peaks","owner":"efekarakus","description":"Find peaks in a noisy signal","archived":false,"fork":false,"pushed_at":"2016-03-25T03:05:39.000Z","size":94,"stargazers_count":55,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T16:43:20.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/efekarakus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-29T00:37:42.000Z","updated_at":"2025-01-07T16:44:08.000Z","dependencies_parsed_at":"2023-06-11T16:45:22.016Z","dependency_job_id":null,"html_url":"https://github.com/efekarakus/d3-peaks","commit_stats":{"total_commits":37,"total_committers":1,"mean_commits":37.0,"dds":0.0,"last_synced_commit":"eb7cb71ee2b04279cc68c81504854fc1636099f1"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efekarakus%2Fd3-peaks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efekarakus%2Fd3-peaks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efekarakus%2Fd3-peaks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efekarakus%2Fd3-peaks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efekarakus","download_url":"https://codeload.github.com/efekarakus/d3-peaks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245844876,"owners_count":20681794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:00:53.717Z","updated_at":"2025-12-24T09:17:41.646Z","avatar_url":"https://github.com/efekarakus.png","language":"JavaScript","funding_links":[],"categories":["Utils"],"sub_categories":[],"readme":"# d3-peaks\n\nFind peaks in an array based on \"Improved peak detection\" \\[1\\]\n\n\\[1\\] Du, Pan, Warren A. Kibbe, and Simon M. Lin. \"Improved peak detection in mass spectrum by incorporating continuous wavelet transform-based pattern matching.\" Bioinformatics 22.17 (2006): 2059-2065.\n\nFor examples, please see:\n*  [Find Peaks](https://bl.ocks.org/efekarakus/cc7303456841523f37dd)\n*  [Convolution](http://bl.ocks.org/efekarakus/9e5d933195dee8b4a882)\n*  [Ricker Wavelet](http://bl.ocks.org/efekarakus/3c30061ef9e56c2328c6)\n\n## Installing\n\nIf you use NPM, `npm install d3-peaks`. Otherwise, download the [latest release](https://github.com/efekarakus/d3-peaks/releases/latest).\n\n## API Reference\n\n### Find Peaks\n\n\u003ca href=\"#findpeaks\" name=\"findpeaks\"\u003e#\u003c/a\u003e d3_peaks.\u003cb\u003efindPeaks\u003c/b\u003e([\u003ci\u003esignal\u003c/i\u003e])\n\nIf specified, returns an array of points that represents the peaks in the signal. Otherwise, returns a function to find peaks.\nAn example point returned is:\n```js\n[{\n  index: 10,\n  width: 2,\n  snr: 1.5\n}]\n```\nWhere \u003ci\u003eindex\u003c/i\u003e represents the index of the peak in the original \u003ci\u003esignal\u003c/i\u003e, \u003ci\u003ewidth\u003c/i\u003e is the width of the peak, and \u003ci\u003esnr\u003c/i\u003e is the signal to noise ratio.\n\n\u003ca href=\"#findpeaks-widths\" name=\"#findpeaks-widths\"\u003e#\u003c/a\u003e \u003cb\u003ewidths\u003c/b\u003e(\u003ci\u003e[w]\u003c/i\u003e)\n\nIf specified, \u003ci\u003e[w]\u003c/i\u003e is an array of expected peak widths that the algorithm should find. Otherwise, returns the current values.\n```js\nvar findPeaks = d3_peaks.findPeaks().widths([1, 2, 10]);\n```\n\n\u003ca href=\"#findpeaks-kernel\" name=\"#findpeaks-kernel\"\u003e#\u003c/a\u003e \u003cb\u003ekernel\u003c/b\u003e(\u003ci\u003ekernel\u003c/i\u003e)\n\nIf specified, changes the kernel function or \"smoother\". Otherwise, returns the current value.\n```js\nvar ricker = d3_peaks.ricker;\nvar findPeaks = d3_peaks.findPeaks().kernel(ricker);\n```\n\n\u003ca href=\"#findpeaks-gapthreshold\" name=\"#findpeaks-gapthreshold\"\u003e#\u003c/a\u003e \u003cb\u003egapThreshold\u003c/b\u003e(\u003ci\u003egap\u003c/i\u003e)\n\nIf specified, \u003ci\u003egap\u003c/i\u003e represents the maximum allowed number of gaps in the ridgeline. The higher is this number the more connected peaks we will find. Otherwise, returns the current value.\n```js\nvar findPeaks = d3_peaks.findPeaks().gapThreshold(3);\n```\n\n\u003ca href=\"#findpeaks-minlinelength\" name=\"#findpeaks-minlinelength\"\u003e#\u003c/a\u003e \u003cb\u003eminLineLength\u003c/b\u003e(\u003ci\u003elength\u003c/i\u003e)\n\nIf specified, \u003ci\u003elength\u003c/i\u003e represents the minimum ridgeline length. The higher is this number the more constrained are the lines and we will find fewer peaks. Otherwise, returns the current value.\n```js\nvar findPeaks = d3_peaks.findPeaks().minLineLength(2);\n```\n\n\u003ca href=\"#findpeaks-minsnr\" name=\"#findpeaks-minsnr\"\u003e#\u003c/a\u003e \u003cb\u003eminSNR\u003c/b\u003e(\u003ci\u003esnr\u003c/i\u003e)\n\nIf specified, \u003ci\u003esnr\u003c/i\u003e represents the minimum signal to noise ratio the ridge lines should have. Otherwise, returns the current value.\nBy default the minimum \u003ci\u003esnr\u003c/i\u003e is 1.0 for peaks of width 1. This number should be higher for bigger widths.\n```js\nvar findPeaks = d3_peaks.findPeaks().minSNR(1.5);\n```\n\n### Convolution\n\n\u003ca href=\"#convolve\" name=\"convolve\"\u003e#\u003c/a\u003e d3_peaks.\u003cb\u003econvolve\u003c/b\u003e([\u003ci\u003esignal\u003c/i\u003e])\n\nIf specified, convolve the \u003ci\u003esignal\u003c/i\u003e array with the smoother. Otherwise, returns a function to convolve a signal with the smoother.\n\n\u003ca href=\"#convolve-kernel\" name=\"convolve-kernel\"\u003e#\u003c/a\u003e \u003cb\u003ekernel\u003c/b\u003e(\u003ci\u003ekernel\u003c/i\u003e)\n\nIf specified, changes the kernel function or \"smoother\". Otherwise, returns the current kernel.\n```js\nvar convolve = d3_peaks.convolve()\n                        .kernel(ricker);\nvar signal = convolve([1,2,3,2.5,0,1,4,5,3,-1,-2]);\n```\n\n### Kernels\n\n\u003ca href=\"#ricker\" name=\"ricker\"\u003e#\u003c/a\u003e d3_peaks.\u003cb\u003ericker\u003c/b\u003e(\u003ci\u003ex\u003c/i\u003e)\n\nIf specified , it returns φ(\u003ci\u003ex\u003c/i\u003e). Otherwise, returns a function to compute the ricker wavelet with default standard deviation 1.0.\n\n\u003ca href=\"#ricker-std\" name=\"ricker-std\"\u003e#\u003c/a\u003e \u003cb\u003estd\u003c/b\u003e(\u003ci\u003evalue\u003c/i\u003e)\n\nIf specified, it sets the standard deviation of the curve to \u003ci\u003evalue\u003c/i\u003e. Otherwise, returns the \"width\" or standard deviation of the wavelet.\n\n\u003ca href=\"#ricker-reach\" name=\"ricker-reach\"\u003e#\u003c/a\u003e \u003cb\u003ereach\u003c/b\u003e()\n\nReturns the range value \u003ci\u003ereach\u003c/i\u003e such that φ(reach) ~ 0.\n\n```js\nvar y = d3_peaks.ricker()\n  .std(2);\nvar output = y(3.5);\nvar reach = y.reach();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefekarakus%2Fd3-peaks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefekarakus%2Fd3-peaks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefekarakus%2Fd3-peaks/lists"}