How to use the vector.plot_peaks function in vector

To help you get started, we’ve selected a few vector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MonsieurV / py-findpeaks / tests / octave_findpeaks.py View on Github external
np.array(vector),
    indexes,
    algorithm='Octave-Forge findpeaks'
)

print('Detect peaks with minimum height and distance filters.')
(pks, indexes) = octave.findpeaks(
    np.array(vector),
    'DoubleSided', 'MinPeakHeight', 6, 'MinPeakDistance', 2, 'MinPeakWidth', 0
)
# The results are in a 2D array and in floats: get back to 1D array and convert
# peak indexes to integer. Also this is MatLab-style indexation (one-based),
# so we must substract one to get back to Python indexation (zero-based).
indexes = indexes[0].astype(int) - 1
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    mph=6, mpd=2, algorithm='Octave-Forge findpeaks'
)
github MonsieurV / py-findpeaks / tests / peakutils_indexes.py View on Github external
print('Detect peaks without any filters.')
indexes = peakutils.peak.indexes(np.array(vector), thres=0, min_dist=0)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='peakutils.peak.indexes'
)

print('Detect peaks with minimum height and distance filters.')
indexes = peakutils.peak.indexes(
    np.array(vector),
    thres=7.0/max(vector), min_dist=2
)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    mph=7, mpd=2, algorithm='peakutils.peak.indexes'
)
github MonsieurV / py-findpeaks / tests / scipy_signal_find_peaks.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import vector, plot_peaks
import scipy.signal

print('Detect peaks without any filters.')
indexes, _ = scipy.signal.find_peaks(np.array(vector))
print('Peaks are: {}'.format(indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='scipy.signal.find_peaks'
)

print('Detect peaks with minimum height and distance filters.')
indexes, _ = scipy.signal.find_peaks(
    np.array(vector),
    height=7, distance=2.1
)
print('Peaks are: {}'.format(indexes))
plot_peaks(
    np.array(vector),
    indexes,
    mph=7, mpd=2.1, algorithm='scipy.signal.find_peaks'
)
github MonsieurV / py-findpeaks / tests / peakdetect.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import vector, plot_peaks
from libs import peakdetect

print('Detect peaks without any filters.')
peaks = peakdetect.peakdetect(np.array(vector), lookahead=2)
# peakdetect returns two lists, respectively positive and negative peaks,
# with for each peak a tuple of (indexes, values).
indexes = []
for posOrNegPeaks in peaks:
    for peak in posOrNegPeaks:
        indexes.append(peak[0])
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    np.array(indexes),
    algorithm='peakdetect from sixtenbe'
)

print('Detect peaks with distance filters.')
peaks = peakdetect.peakdetect(np.array(vector), lookahead=2, delta=2)
# peakdetect returns two lists, respectively positive and negative peaks,
# with for each peak a tuple of (indexes, values).
indexes = []
for posOrNegPeaks in peaks:
    for peak in posOrNegPeaks:
        indexes.append(peak[0])
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
github MonsieurV / py-findpeaks / tests / scipy_argrelextrema.py View on Github external
print('Peaks are: %s' % (indexes[0]))
# To get number of peaks:
# print("{} peaks".format(len(indexes[0])))
plot_peaks(
    np.array(vector),
    indexes[0],
    algorithm='scipy.signal.argrelmax'
)

print('Detect peaks without any filters (minima).')
indexes = scipy.signal.argrelextrema(
    np.array(vector),
    comparator=np.less
)
print('Peaks are: %s' % (indexes[0]))
plot_peaks(
    np.array(vector),
    indexes[0],
    algorithm='scipy.signal.argrelmax'
)

print('Detect peaks with order (distance) filter.')
indexes = scipy.signal.argrelextrema(
    np.array(vector),
    comparator=np.greater,
    order=2
)
print('Peaks are: %s' % (indexes[0]))
plot_peaks(
    np.array(vector),
    indexes[0],
    mpd=2, algorithm='scipy.signal.argrelmax'
github MonsieurV / py-findpeaks / tests / detect_peaks.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import vector, plot_peaks
from libs import detect_peaks

print('Detect peaks without any filters.')
indexes = detect_peaks.detect_peaks(vector)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='detect_peaks from Marcos Duarte'
)

print('Detect peaks with minimum height and distance filters.')
indexes = detect_peaks.detect_peaks(vector, mph=7, mpd=2)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes, mph=7, mpd=2,
    algorithm='detect_peaks from Marcos Duarte'
)
github MonsieurV / py-findpeaks / tests / tony_beltramelli_detect_peaks.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import vector, plot_peaks
from libs.tony_beltramelli_detect_peaks import detect_peaks

print('Detect peaks without any filters.')
indexes = detect_peaks(vector)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    np.array(indexes),
    algorithm='detect_peaks from Tony Beltramelli'
)

print('Detect peaks with height threshold.')
indexes = detect_peaks(vector, 1.5)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    np.array(indexes), mph=1.5,
    algorithm='detect_peaks from Tony Beltramelli'
)
github MonsieurV / py-findpeaks / tests / detect_peaks.py View on Github external
from vector import vector, plot_peaks
from libs import detect_peaks

print('Detect peaks without any filters.')
indexes = detect_peaks.detect_peaks(vector)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='detect_peaks from Marcos Duarte'
)

print('Detect peaks with minimum height and distance filters.')
indexes = detect_peaks.detect_peaks(vector, mph=7, mpd=2)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes, mph=7, mpd=2,
    algorithm='detect_peaks from Marcos Duarte'
)
github MonsieurV / py-findpeaks / tests / scipy_signal_find_peaks.py View on Github external
print('Detect peaks without any filters.')
indexes, _ = scipy.signal.find_peaks(np.array(vector))
print('Peaks are: {}'.format(indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='scipy.signal.find_peaks'
)

print('Detect peaks with minimum height and distance filters.')
indexes, _ = scipy.signal.find_peaks(
    np.array(vector),
    height=7, distance=2.1
)
print('Peaks are: {}'.format(indexes))
plot_peaks(
    np.array(vector),
    indexes,
    mph=7, mpd=2.1, algorithm='scipy.signal.find_peaks'
)
github MonsieurV / py-findpeaks / tests / peakutils_indexes.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import vector, plot_peaks
import peakutils.peak

print('Detect peaks without any filters.')
indexes = peakutils.peak.indexes(np.array(vector), thres=0, min_dist=0)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    algorithm='peakutils.peak.indexes'
)

print('Detect peaks with minimum height and distance filters.')
indexes = peakutils.peak.indexes(
    np.array(vector),
    thres=7.0/max(vector), min_dist=2
)
print('Peaks are: %s' % (indexes))
plot_peaks(
    np.array(vector),
    indexes,
    mph=7, mpd=2, algorithm='peakutils.peak.indexes'
)