RankNormalize¶
- class RankNormalize(levels, vmin=None, vmax=None, clip=False)¶
Color distribution normalization class based on rank and not value.
This class is used to manage the “rank” norm for Contour drawables
- Attributes:
- clip
- vmax
- vmin
Methods
autoscale
(A)Set vmin, vmax to min, max of A.
If vmin or vmax are not set, use the min/max of A to set them.
inverse
(value)Maps the normalized value (i.e., index in the colormap) back to image data value.
process_value
(value)Homogenize the input value for easy and efficient normalization.
scaled
()Return whether vmin and vmax are both set.
- __init__(levels, vmin=None, vmax=None, clip=False)¶
Construct the normalization based on rank
- Parameters:
- levelslist of floats
List of level values.
- vminfloat, optional
Minimum value for color distribution
- vmaxfloat, optional
Maximum value for color distribution
- clipbool, optional
Indicator for cutting color distribution out of vmin and vmax Required by the parent class, but unused.
- autoscale(A)¶
Set vmin, vmax to min, max of A.
- autoscale_None(A)¶
If vmin or vmax are not set, use the min/max of A to set them.
- inverse(value)¶
Maps the normalized value (i.e., index in the colormap) back to image data value.
- Parameters:
- value
Normalized value.
- static process_value(value)¶
Homogenize the input value for easy and efficient normalization.
value can be a scalar or sequence.
- Parameters:
- value
Data to normalize.
- Returns:
- resultmasked array
Masked array with the same shape as value.
- is_scalarbool
Whether value is a scalar.
Notes
Float dtypes are preserved; integer types with two bytes or smaller are converted to np.float32, and larger types are converted to np.float64. Preserving float32 when possible, and using in-place operations, greatly improves speed for large arrays.
- scaled()¶
Return whether vmin and vmax are both set.