1 from __future__
import (absolute_import, division, print_function,
6 import matplotlib.cbook
as cbook
7 from matplotlib.colors
import Normalize
10 fn =
lambda d: np.arcsinh(d*scale)
11 invfn =
lambda d: np.sinh(d)/scale
16 Normalize a given value to the ``[0, 1]`` interval with a power-law 17 scaling. This will clip any negative data points to 0. 19 def __init__(self, fn, invfn, vmin=None, vmax=None, clip=False):
20 Normalize.__init__(self, vmin, vmax, clip)
28 result, is_scalar = self.process_value(value)
33 raise ValueError(
"minvalue must be less than or equal to maxvalue")
38 mask = ma.getmask(result)
39 result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
42 resdat = self.
fn(resdat)
44 resdat /= (self._upper - self.
_lower)
46 result = np.ma.array(resdat, mask=result.mask, copy=
False)
53 Calculates vmin and vmax in the transformed system. 56 arr = np.array([vmax, vmin]).astype(np.float)
61 raise ValueError(
"Not invertible until scaled")
64 if cbook.iterable(value):
65 val = ma.asarray(value)
67 return self.
invfn(val)
69 value = value * (self._upper - self.
_lower) + self.
_lower 70 return self.
invfn(value)
74 Set *vmin*, *vmax* to min, max of *A*. 81 ' autoscale only None-valued vmin or vmax' 82 if self.
vmin is None and np.size(A) > 0:
85 if self.
vmax is None and np.size(A) > 0:
def _transform_vmin_vmax(self)
def __call__(self, value, clip=None)
def __init__(self, fn, invfn, vmin=None, vmax=None, clip=False)
def ArcsinhNorm(scale=1., args, kwargs)
def autoscale_None(self, A)