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

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

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