plfit/plfit.py
def alpha_gen(x):
    """ Create a mappable function alpha to apply to each xmin in a list of xmins.
    This is essentially the slow version of fplfit/cplfit, though I bet it could
    be speeded up with a clever use of parellel_map.  Not intended to be used by users.

    Docstring for the generated alpha function::

        Given a sorted data set and a minimum, returns power law MLE fit
        data is passed as a keyword parameter so that it can be vectorized

        If there is only one element, return alpha=0
    """
    def alpha_(xmin,x=x):
        """
        Given a sorted data set and a minimum, returns power law MLE fit
        data is passed as a keyword parameter so that it can be vectorized

        If there is only one element, return alpha=0
        """
        gexmin = x>=xmin
        n = np.count_nonzero(gexmin)
        if n < 2:
            return 0
        x = x[gexmin]
        a = 1 + float(n) / sum(log(x/xmin))
        return a
    return alpha_
def alpha_gen(x):
    """ Create a mappable function alpha to apply to each xmin in a list of xmins.
    This is essentially the slow version of fplfit/cplfit, though I bet it could
    be speeded up with a clever use of parellel_map.  Not intended to be used by users.

    Docstring for the generated alpha function::

        Given a sorted data set and a minimum, returns power law MLE fit
        data is passed as a keyword parameter so that it can be vectorized

        If there is only one element, return alpha=0
    """
    def alpha_(xmin,x=x):
        """
        Given a sorted data set and a minimum, returns power law MLE fit
        data is passed as a keyword parameter so that it can be vectorized

        If there is only one element, return alpha=0
        """
        gexmin = x>=xmin
        n = np.count_nonzero(gexmin)
        if n < 2:
            return 0
        x = x[gexmin]
        a = 1 + float(n) / sum(log(x/xmin))
        return a
    return alpha_
Create a mappable function alpha to apply to each xmin in a list of xmins.
    This is essentially the slow version of fplfit/cplfit, though I bet it could
    be speeded up with a clever use of parellel_map.  Not intended to be used by users.

    Docstring for the generated alpha function::

        Given a sorted data set and a minimum, returns power law MLE fit
        data is passed as a keyword parameter so that it can be vectorized

        If there is only one element, return alpha=0