def __call__(self, limits):
        """
        Calculate the breaks

        Parameters
        ----------
        limits : array
            Minimum and maximum values.

        Returns
        -------
        out : array_like
            Sequence of break points.
        """
        Q = self.Q
        w = self.w
        only_inside = self.only_inside
        simplicity_max = self.simplicity_max
        density_max = self.density_max
        coverage_max = self.coverage_max
        simplicity = self.simplicity
        coverage = self.coverage
        density = self.density
        legibility = self.legibility
        log10 = np.log10
        ceil = np.ceil
        floor = np.floor
        dmin, dmax = limits

        if dmin > dmax:
            dmin, dmax = dmax, dmin
        elif dmin == dmax:
            return np.array([dmin])

        best_score = -2
        j = 1

        while j < float('inf'):
            for q in Q:
                sm = simplicity_max(q, j)

                if w[0]*sm + w[1] + w[2] + w[3] < best_score:
                    j = float('inf')
                    break

                k = 2
                while k < float('inf'):
                    dm = density_max(k)

                    if w[0]*sm + w[1] + w[2]*dm + w[3] < best_score:
                        break

                    delta = (dmax-dmin)/(k+1)/j/q
                    z = ceil(log10(delta))

                    while z < float('inf'):
                        step = j*q*(10**z)
                        cm = coverage_max(dmin, dmax, step*(k-1))

                        if w[0]*sm + w[1]*cm + w[2]*dm + w[3] < best_score:
                            break

                        min_start = int(floor(dmax/step)*j - (k-1)*j)
                        max_start = int(ceil(dmin/step)*j)

                        if min_start > max_start:
                            z = z+1
                            break

                        for start in range(min_start, max_start+1):
                            lmin = start * (step/j)
                            lmax = lmin + step*(k-1)
                            lstep = step

                            s = simplicity(q, j, lmin, lmax, lstep)
                            c = coverage(dmin, dmax, lmin, lmax)
                            d = density(k, dmin, dmax, lmin, lmax)
                            l = legibility(lmin, lmax, lstep)

                            score = w[0]*s + w[1]*c + w[2]*d + w[3]*l

                            if (score > best_score and
                                    (not only_inside or
                                     (lmin >= dmin and lmax <= dmax))):
                                best_score = score
                                best = (lmin, lmax, lstep, q, k)
                        z = z+1
                    k = k+1
            j = j+1

        try:
            locs = best[0] + np.arange(best[4])*best[2]
        except UnboundLocalError:
            locs = []
        return locs
def __call__ ( self , limits ) : Q = self . Q w = self . w only_inside = self . only_inside simplicity_max = self . simplicity_max density_max = self . density_max coverage_max = self . coverage_max simplicity = self . simplicity coverage = self . coverage density = self . density legibility = self . legibility log10 = np . log10 ceil = np . ceil floor = np . floor dmin , dmax = limits if dmin > dmax : dmin , dmax = dmax , dmin elif dmin == dmax : return np . array ( [ dmin ] ) best_score = - 2 j = 1 while j < float ( 'inf' ) : for q in Q : sm = simplicity_max ( q , j ) if w [ 0 ] * sm + w [ 1 ] + w [ 2 ] + w [ 3 ] < best_score : j = float ( 'inf' ) break k = 2 while k < float ( 'inf' ) : dm = density_max ( k ) if w [ 0 ] * sm + w [ 1 ] + w [ 2 ] * dm + w [ 3 ] < best_score : break delta = ( dmax - dmin ) / ( k + 1 ) / j / q z = ceil ( log10 ( delta ) ) while z < float ( 'inf' ) : step = j * q * ( 10 ** z ) cm = coverage_max ( dmin , dmax , step * ( k - 1 ) ) if w [ 0 ] * sm + w [ 1 ] * cm + w [ 2 ] * dm + w [ 3 ] < best_score : break min_start = int ( floor ( dmax / step ) * j - ( k - 1 ) * j ) max_start = int ( ceil ( dmin / step ) * j ) if min_start > max_start : z = z + 1 break for start in range ( min_start , max_start + 1 ) : lmin = start * ( step / j ) lmax = lmin + step * ( k - 1 ) lstep = step s = simplicity ( q , j , lmin , lmax , lstep ) c = coverage ( dmin , dmax , lmin , lmax ) d = density ( k , dmin , dmax , lmin , lmax ) l = legibility ( lmin , lmax , lstep ) score = w [ 0 ] * s + w [ 1 ] * c + w [ 2 ] * d + w [ 3 ] * l if ( score > best_score and ( not only_inside or ( lmin >= dmin and lmax <= dmax ) ) ) : best_score = score best = ( lmin , lmax , lstep , q , k ) z = z + 1 k = k + 1 j = j + 1 try : locs = best [ 0 ] + np . arange ( best [ 4 ] ) * best [ 2 ] except UnboundLocalError : locs = [ ] return locs
Calculate the breaks

        Parameters
        ----------
        limits : array
            Minimum and maximum values.

        Returns
        -------
        out : array_like
            Sequence of break points.