def weight_of_bottom_percent()

in eventdata/parameter_sources/weightedarray.py [0:0]


    def weight_of_bottom_percent(self, histogram, percent):
        """
        Determines the corresponding weight that represents at most the provided number of percent of all elements.

        :param histogram: A histogram of all elements.
        :param percent: A float representing the maximum number of elements that should be covered. 1.00 is 100% percent.
        """
        total = 0
        for weight, frequency in histogram.items():
            total += weight * frequency

        running_total = 0
        for weight, frequency in histogram.items():
            running_total += weight * frequency
            if running_total > percent * total:
                return weight