def second_peak(self, d):
    '\n        Return preference and selectivity of the second peak in the distribution.\n\n        It is just the combination of second_peak_bin() and\n        second_peak_selectivity(), with the advantage of avoiding a duplicate\n        call of second_peak_bin(), if the user is interested in both preference\n        and selectivity, as often is the case.\n        '
    l = len(d.keys())
    if (l <= 1):
        return (d.keys()[0], 0.0)
    p1 = d.max_value_bin()
    p2 = self.second_peak_bin(d)
    if (p1 == p2):
        return (p1, 0.0)
    m = d.get_value(p2)
    proportion = d._safe_divide(m, sum(d.values()))
    offset = (1.0 / l)
    scaled = ((proportion - offset) / (1.0 - offset))
    return (p2, max(scaled, 0.0))
Return preference and selectivity of the second peak in the distribution.

It is just the combination of second_peak_bin() and
second_peak_selectivity(), with the advantage of avoiding a duplicate
call of second_peak_bin(), if the user is interested in both preference
and selectivity, as often is the case.
def second_peak(self, d):
    '\n        Return preference and selectivity of the second peak in the distribution.\n\n        It is just the combination of second_peak_bin() and\n        second_peak_selectivity(), with the advantage of avoiding a duplicate\n        call of second_peak_bin(), if the user is interested in both preference\n        and selectivity, as often is the case.\n        '
    l = len(d.keys())
    if (l <= 1):
        return (d.keys()[0], 0.0)
    p1 = d.max_value_bin()
    p2 = self.second_peak_bin(d)
    if (p1 == p2):
        return (p1, 0.0)
    m = d.get_value(p2)
    proportion = d._safe_divide(m, sum(d.values()))
    offset = (1.0 / l)
    scaled = ((proportion - offset) / (1.0 - offset))
    return (p2, max(scaled, 0.0))