'Find the difference between the peaks and valleys'

def _extractSignalInfo(self, forceChannel):

    self.pD = {}
    self.vD = {}
    self.doPeaks = {}
    bestSpread = 0.0
    bestDoPeaks = None
    bestKey = None
    for key in self.data.keys():
        if (len(self.peaks[key]) > 0):
            peakMean = np.mean(np.array(self.peaks[key])[:, 1])
            self.pD[key] = np.abs((self._steadyState[key][0] - peakMean))
        else:
            self.pD[key] = 0.0
        if (len(self.valleys[key]) > 0):
            valleyMean = np.mean(np.array(self.valleys[key])[:, 1])
            self.vD[key] = np.abs((self._steadyState[key][0] - valleyMean))
        else:
            self.vD[key] = 0.0
        self.doPeaks[key] = False
        best = self.vD[key]
        if (self.pD[key] > self.vD[key]):
            best = self.pD[key]
            self.doPeaks[key] = True
        if (best > bestSpread):
            bestSpread = best
            bestDoPeaks = self.doPeaks[key]
            bestKey = key
    if (forceChannel is not None):
        if self.data.has_key(forceChannel):
            self._bestKey = forceChannel
        else:
            raise Exception('That    is    not    a    valid    data    channel')
    else:
        self._bestKey = bestKey
