def peakDetect(self, signal, v_mph, v_mpd, v_cutMin, v_cutMax): if namespace.toforce: v_mph = v_mph * 0.01 * np.pi self.peak = find_peaks(signal, v_mph, v_mpd, v_cutMin, v_cutMax) if len(self.peak[0]) == 0: self.peak[0].append(len(self.filterSignal)-1) if len(self.peak[1]) == 0: self.peak[1].append(self.filterSignal[len(self.filterSignal)-1]) if len(self.peak[2]) == 0: self.peak[2].append(0) if len(self.peak[3]) == 0: self.peak[3].append(0)
def plotPeaks(xline, signal, v_mph, v_mpd, v_cutMin, v_cutMax): if namespace.toforce: v_mph = v_mph * 0.01 * np.pi v_in = find_peaks(signal, v_mph, v_mpd, v_cutMin, v_cutMax) id_vmax = v_in[0] vmax = v_in[1] id_vmin = v_in[2] vmin = v_in[3] if len(v_in[1]) != 0: plt.plot(xline[id_vmax], vmax, 'b+') if len(v_in[3]) != 0: plt.plot(xline[id_vmin], vmin, 'b+') return v_in