def second_peak_bin(self, d):
    "\n        Return the feature_bin with the second peak in the distribution.\n        Unlike second_max_value_bin(), it does not return a feature_bin which is the\n        second largest value, if laying on a wing of the first peak, the second\n        peak is returned only if the distribution is truly multimodal. If it isn't,\n        return the first peak (for compatibility with numpy array type, and\n        plotting compatibility), however the corresponding selectivity will be\n        forced to 0.0\n        "
    h = d.data()
    l = len(h)
    if (l <= 1):
        return d.keys()[0]
    ks = list(h.keys())
    ks.sort()
    ik0 = ks.index(d.keys()[np.argmax(d.values())])
    k0 = ks[ik0]
    v0 = h[k0]
    v = v0
    k = k0
    ik = ik0
    while (h[k] <= v):
        ik += 1
        if (ik >= l):
            ik = 0
        if (ik == ik0):
            return k0
        v = h[k]
        k = ks[ik]
    ik1 = ik
    v = v0
    k = k0
    ik = ik0
    while (h[k] <= v):
        ik -= 1
        if (ik < 0):
            ik = (l - 1)
        if (ik == ik0):
            return k0
        v = h[k]
        k = ks[ik]
    ik2 = ik
    if (ik1 == ik2):
        return ks[ik1]
    ik = ik1
    m = 0
    while (ik != ik2):
        k = ks[ik]
        if (h[k] > m):
            m = h[k]
            im = ik
        ik += 1
        if (ik >= l):
            ik = 0
    return ks[im]
Return the feature_bin with the second peak in the distribution.
Unlike second_max_value_bin(), it does not return a feature_bin which is the
second largest value, if laying on a wing of the first peak, the second
peak is returned only if the distribution is truly multimodal. If it isn't,
return the first peak (for compatibility with numpy array type, and
plotting compatibility), however the corresponding selectivity will be
forced to 0.0
def second_peak_bin(self, d):
    "\n        Return the feature_bin with the second peak in the distribution.\n        Unlike second_max_value_bin(), it does not return a feature_bin which is the\n        second largest value, if laying on a wing of the first peak, the second\n        peak is returned only if the distribution is truly multimodal. If it isn't,\n        return the first peak (for compatibility with numpy array type, and\n        plotting compatibility), however the corresponding selectivity will be\n        forced to 0.0\n        "
    h = d.data()
    l = len(h)
    if (l <= 1):
        return d.keys()[0]
    ks = list(h.keys())
    ks.sort()
    ik0 = ks.index(d.keys()[np.argmax(d.values())])
    k0 = ks[ik0]
    v0 = h[k0]
    v = v0
    k = k0
    ik = ik0
    while (h[k] <= v):
        ik += 1
        if (ik >= l):
            ik = 0
        if (ik == ik0):
            return k0
        v = h[k]
        k = ks[ik]
    ik1 = ik
    v = v0
    k = k0
    ik = ik0
    while (h[k] <= v):
        ik -= 1
        if (ik < 0):
            ik = (l - 1)
        if (ik == ik0):
            return k0
        v = h[k]
        k = ks[ik]
    ik2 = ik
    if (ik1 == ik2):
        return ks[ik1]
    ik = ik1
    m = 0
    while (ik != ik2):
        k = ks[ik]
        if (h[k] > m):
            m = h[k]
            im = ik
        ik += 1
        if (ik >= l):
            ik = 0
    return ks[im]