(self, values)
| 332 | type(self).__name__, self.base, "clip" if self._clip else "mask") |
| 333 | |
| 334 | def transform_non_affine(self, values): |
| 335 | # Ignore invalid values due to nans being passed to the transform. |
| 336 | with np.errstate(divide="ignore", invalid="ignore"): |
| 337 | log_func = self._log_funcs.get(self.base) |
| 338 | if log_func: |
| 339 | out = log_func(values) |
| 340 | else: |
| 341 | out = np.log(values) / np.log(self.base) |
| 342 | if self._clip: |
| 343 | # SVG spec says that conforming viewers must support values up |
| 344 | # to 3.4e38 (C float); however experiments suggest that |
| 345 | # Inkscape (which uses cairo for rendering) runs into cairo's |
| 346 | # 24-bit limit (which is apparently shared by Agg). |
| 347 | # Ghostscript (used for pdf rendering appears to overflow even |
| 348 | # earlier, with the max value around 2 ** 15 for the tests to |
| 349 | # pass. On the other hand, in practice, we want to clip beyond |
| 350 | # np.log10(np.nextafter(0, 1)) ~ -323 |
| 351 | # so 1000 seems safe. |
| 352 | out[values <= 0] = -1000 |
| 353 | return out |
| 354 | |
| 355 | def inverted(self): |
| 356 | return InvertedLogTransform(self.base) |
no test coverage detected