3.1.1 • Published 1 year ago

peaks-similarity v3.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

peaks-similarity

NPM version build status David deps npm download

Peaks similarity - calculate a similarity between 0 and 1 of 2 arrays of x,y points.

Description

The idea is to calculate a similarity value between 0 and 1 between two arrays of peaks (x,y points).

const peaks1 = [
  [1, 1],
  [2, 2],
];
const peaks2 = [
  [1, 2],
  [2, 1],
];

import Comparator from 'peaks-similarity';
const comparator = new Comparator({ widthBottom: 4, widthTop: 2 });
const result = comparator.getSimilarity(peaks1, peaks2);

console.log(result);

options

  • widthBottom : bottom width of the trapezoid (default: 2)
  • widthTop : top width of the trapezoid (default: 1)
  • trapezoid : Should we use overlapping of trapezoids surface (default: false). If trapezoid is false it is based only on peaks and not surface.
  • common: Only take the common part of the array based on the widthBottom of the trapezoid (default: false)
    • true: take the common part between the 2 array
    • first: keep first array and take the common part of the second one
    • second: keep second array and take the common part of the first one

Methods

  • setOptions(newOptions)
  • setPeaks1(anArray)
  • setPeaks2(anArray)
  • getExtract1()
  • getExtract2()
  • getExtractInfo1()
  • getExtractInfo2()
  • setTrapezoid(newWidthBottom, newWidthTop)
  • setFromTo(newFrom, newTo)
  • getOverlap(x1, y1, x2, y2)
  • getOverlapTrapezoid(x1, y1, x2, y2)
  • calculateDiff()
  • checkArray(points)
  • getSimilarity(newPeaks1, newPeaks2)
  • fastSimilarity(newPeaks2, from, to)
    • newPeaks2 has to be normalized (sum to 1)
    • fastSimilarity will use the common parameter. This parameter may be 'second' and will take the peaks1 that are at a distance less than widthBottom of any peak of peaks2

License

MIT

3.1.1

1 year ago

3.1.0

1 year ago

3.0.0

1 year ago

2.3.1

5 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.0

9 years ago