def _discover_bounds(cdf, tol=1e-7):
    """
    Uses scipy's general continuous distribution methods
    which compute the ppf from the cdf, then use the ppf
    to find the lower and upper limits of the distribution.
    """
    class DistFromCDF(stats.distributions.rv_continuous):
        def cdf(self, x):
            return cdf(x)
    dist = DistFromCDF()
    # the ppf is the inverse cdf
    lower = dist.ppf(tol)
    upper = dist.ppf(1. - tol)
    return lower, upper
def _discover_bounds ( cdf , tol = 1e-7 ) : class DistFromCDF ( stats . distributions . rv_continuous ) : def cdf ( self , x ) : return cdf ( x ) dist = DistFromCDF ( ) lower = dist . ppf ( tol ) upper = dist . ppf ( 1. - tol ) return lower , upper
Uses scipy's general continuous distribution methods
    which compute the ppf from the cdf, then use the ppf
    to find the lower and upper limits of the distribution.