python/cell_cycle_gating/findpeaks.py
def findpeaks(signal, npeaks=None, thresh=0.25):
    """Returns the amplitude , location and half-prominence width of peaks
    from the input signal

    Parameters
    ----------
    signal : list
    npeaks : int
         number of peaks, locations and width returned sorted
         from highest to lowes amplitude peaks
    thresh : Optional[float]
         threshold below which secondary peaks will not be reported. Default is 0.25

    Returns
    --------
    peak_amp : array of float
         amplitude of peaks
    peak_loc : array of float
         location of peaks
    width : array of float
        list of widths at half-prominence

    """
    peak_loc = peakutils.peak.indexes(signal, thres=thresh)
    peak_amp = [signal[loc] for loc in peak_loc]
    width = []
    for loc, value in zip(peak_loc, peak_amp):
        lw, lr, _ = get_width_half_prominence(signal, value, loc)
        width.append(lr-lw)
    if npeaks:
        sorted_peak_amps = sorted(peak_amp)[::-1]
        sorted_peak_indeces = [peak_amp.index(p) for p in sorted_peak_amps]
        sorted_loc = [peak_loc[i] for i in sorted_peak_indeces]
        sorted_width = [width[i] for i in sorted_peak_indeces]
        return (np.array(sorted_peak_amps[:npeaks]),
                np.array(sorted_loc[:npeaks]),
                np.array(sorted_width[:npeaks]))
    else:
        return np.array(peak_amp), np.array(peak_loc), np.array(width)
Returns the amplitude , location and half-prominence width of peaks
    from the input signal

    Parameters
    ----------
    signal : list
    npeaks : int
         number of peaks, locations and width returned sorted
         from highest to lowes amplitude peaks
    thresh : Optional[float]
         threshold below which secondary peaks will not be reported. Default is 0.25

    Returns
    --------
    peak_amp : array of float
         amplitude of peaks
    peak_loc : array of float
         location of peaks
    width : array of float
        list of widths at half-prominence

    
Returns the amplitude , location and half-prominence width of peaks
from the input signal

Parameters

signal : list
npeaks : int
number of peaks, locations and width returned sorted
from highest to lowes amplitude peaks
thresh : Optional[float]
threshold below which secondary peaks will not be reported.

Returns

peak_amp : array of float
amplitude of peaks
peak_loc : array of float
location of peaks
width : array of float
list of widths at half-prominence
Returns the amplitude location and half - prominence width of peaks from the input signal Parameters signal : list npeaks : int number of peaks locations and width returned sorted from highest to lowes amplitude peaks thresh : Optional [ float ] threshold below which secondary peaks will not be reported . Returns peak_amp : array of float amplitude of peaks peak_loc : array of float location of peaks width : array of float list of widths at half - prominence
def findpeaks(signal, npeaks=None, thresh=0.25):
    peak_loc = peakutils.peak.indexes(signal, thres=thresh)
    peak_amp = [signal[loc] for loc in peak_loc]
    width = []
    for loc, value in zip(peak_loc, peak_amp):
        lw, lr, _ = get_width_half_prominence(signal, value, loc)
        width.append(lr-lw)
    if npeaks:
        sorted_peak_amps = sorted(peak_amp)[::-1]
        sorted_peak_indeces = [peak_amp.index(p) for p in sorted_peak_amps]
        sorted_loc = [peak_loc[i] for i in sorted_peak_indeces]
        sorted_width = [width[i] for i in sorted_peak_indeces]
        return (np.array(sorted_peak_amps[:npeaks]),
                np.array(sorted_loc[:npeaks]),
                np.array(sorted_width[:npeaks]))
    else:
        return np.array(peak_amp), np.array(peak_loc), np.array(width)
def findpeaks ( signal , npeaks = None , thresh = 0.25 ) : peak_loc = peakutils . peak . indexes ( signal , thres = thresh ) peak_amp = [ signal [ loc ] for loc in peak_loc ] width = [ ] for loc , value in zip ( peak_loc , peak_amp ) : lw , lr , _ = get_width_half_prominence ( signal , value , loc ) width . append ( lr - lw ) if npeaks : sorted_peak_amps = sorted ( peak_amp ) [ : : - 1 ] sorted_peak_indeces = [ peak_amp . index ( p ) for p in sorted_peak_amps ] sorted_loc = [ peak_loc [ i ] for i in sorted_peak_indeces ] sorted_width = [ width [ i ] for i in sorted_peak_indeces ] return ( np . array ( sorted_peak_amps [ : npeaks ] ) , np . array ( sorted_loc [ : npeaks ] ) , np . array ( sorted_width [ : npeaks ] ) ) else : return np . array ( peak_amp ) , np . array ( peak_loc ) , np . array ( width )
Returns the amplitude , location and half-prominence width of peaks
from the input signal
Returns the amplitude location and half - prominence width of peaks from the input signal
"""Returns the amplitude , location and half-prominence width of peaks
    from the input signal

    Parameters
    ----------
    signal : list
    npeaks : int
         number of peaks, locations and width returned sorted
         from highest to lowes amplitude peaks
    thresh : Optional[float]
         threshold below which secondary peaks will not be reported. Default is 0.25

    Returns
    --------
    peak_amp : array of float
         amplitude of peaks
    peak_loc : array of float
         location of peaks
    width : array of float
        list of widths at half-prominence

    """
signal
npeaks
thresh