def transform_non_affine(self, a):
with np.errstate(divide="ignore", invalid="ignore"):
out = np.log(a)
out /= np.log(self.base)
if self._clip:
// SVG spec says that conforming viewers must support values up
// to 3.4e38 (C float); however experiments suggest that Inkscape
// (which uses cairo for rendering) runs into cairo"s 24-bit limit
// (which is apparently shared by Agg).
// Ghostscript (used for pdf rendering appears to overflow even
// earlier, with the max value around 2 ** 15 for the tests to pass.
// On the other hand, in practice, we want to clip beyond
// np.log10(np.nextafter(0, 1)) ~ -323
// so 1000 seems safe.
out[a <= 0] = -1000
return out
class InvertedLogTransformBase(Transform):
input_dims = 1