seg1d.algorithm.uniques

seg1d.algorithm.uniques(sortedPeaks, srcLen)[source]

Unique Segment Identification

Find unique segment(s) in a sequence of correlation values.
Guarantees segments are not overlapping
Parameters:
sortedPeaksn x 3 array

n x 3 array sorted by highest to lowest correlation of form [ scale (int), correlation(float) , peak index (int) ]

srcLenint

length of the target data, used to block out possible segments

Returns:
n x 3 array

[ start index, end index, correlation ]

None

if no segments are found

See also

get_peaks
(input for this function)
cluster
(takes in the return of this function)

Examples

>>> import numpy as np
>>> import seg1d.algorithm as alg
>>> p = [ [10, 0.90, 7  ],
...     [10, 0.89, 8  ],
...     [20, 0.80, 20 ],
...     [25, 0.70, 40 ],
...     ]
>>> el = 50
>>> alg.uniques(p,el)
[[7, 17, 0.9], [20, 40, 0.8], [40, 65, 0.7]]