; Fc@sdklZlZdklZdfdYZdfdYZdfdYZdefd YZeZ d efd YZ e Z d S( (sunitsbox(stickscubecBs)tZdZeeddZdZRS(swa value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analytic form of the rating is cubic for both, the left and the right side of the rater, independentlyicCsZ|tjo d}n|tjod|}n||_||_||_||_dS(sinitializes the rater - by default, left is set to zero, right is set to 3*opt - left should be smaller than opt, right should be bigger than opt - weight should be positive and is a factor multiplicated to the ratesiiN(sleftsNonesrightsoptsselfsweight(sselfsoptsleftsrightsweight((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pys__init__0s      cCsx|i|}||jo|i|}n#||jo|i|}ndS||t||}|i |dSdS(s6returns a rating for a value - the density lineary rescales the rater (the optimum etc.), e.g. a value bigger than one increases the optimum (when it is positive) and a value lower than one decreases the optimum (when it is positive); the density itself should be positiveiiN( sselfsoptsdensitysvaluesleftsothersrightsfloatsfactorsweight(sselfsvaluesdensitysoptsothersfactor((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pysrate>s   (s__name__s __module__s__doc__sNones__init__srate(((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pyscube's sdistancecBs#tZdZddZdZRS(s_a distance rater (rates a list of distances) - the distance rater rates a list of distances by rating each independently and returning the average rate - there is an optimal value, where the rate becomes zero - the analytic form is linary for values above the optimal value (twice the optimal value has the rating one, three times the optimal value has the rating two, etc.) - the analytic form is reciprocal subtracting one for values below the optimal value (halve the optimal value has the rating one, one third of the optimal value has the rating two, etc.)f0.10000000000000001cCs||_||_dS(sinititializes the rater - opt is the optimal length (a visual PyX length) - weight should be positive and is a factor multiplicated to the ratesN(soptsselfsweight(sselfsoptsweight((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pys__init__\s cCst|oti|i|}d}xQ|D]I}||jo||i ||d7}q0||i ||d7}q0W|t t|SndS(ssrate distances - the distances are a list of positive floats in PostScript points - the density lineary rescales the rater (the optimum etc.), e.g. a value bigger than one increases the optimum (when it is positive) and a value lower than one decreases the optimum (when it is positive); the density itself should be positiveiiN( slens distancessunitstoptsselfsoptsdensitysratesdistancesweightsfloat(sselfs distancessdensitysoptsratesdistance((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pysratecs  (s__name__s __module__s__doc__s__init__srate(((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pysdistanceOs  sratercBs2tZdZdZdZdZdZRS(sa rater for ticks - the rating of axes is splited into two separate parts: - rating of the ticks in terms of the number of ticks, subticks, labels, etc. - rating of the label distances - in the end, a rate for ticks is the sum of these rates - it is useful to first just rate the number of ticks etc. and selecting those partitions, where this fits well -> as soon as an complete rate (the sum of both parts from the list above) of a first ticks is below a rate of just the number of ticks, subticks labels etc. of other ticks, those other ticks will never be better than the first one -> we gain speed by minimizing the number of ticks, where label distances have to be taken into account) - both parts of the rating are shifted into instances of raters defined above --- right now, there is not yet a strict interface for this delegation (should be done as soon as it is needed)cCs(||_||_||_||_dS(sinitializes the axis rater - ticks and labels are lists of instances of a value rater - the first entry in ticks rate the number of ticks, the second the number of subticks, etc.; when there are no ticks of a level or there is not rater for a level, the level is just ignored - labels is analogous, but for labels - within the rating, all ticks with a higher level are considered as ticks for a given level - range is a value rater instance, which rates the covering of an axis range by the ticks (as a relative value of the tick range vs. the axis range), ticks might cover less or more than the axis range (for the standard automatic axis partition schemes an extention of the axis range is normal and should get some penalty) - distance is an distance rater instanceN(stickssselfslabelssrangesdistance(sselfsticksslabelssrangesdistance((sH/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/graph/axis/rater.pys__init__s    cCsfti|\}}dg|} dg|} x|D]} | it j o1x.t | i|D]}| |cd7