ImageNormalize¶
-
class
astropy.visualization.
ImageNormalize
(data=None, interval=None, vmin=None, vmax=None, stretch=<astropy.visualization.stretch.LinearStretch object>, clip=False, invalid=-1.0)[source]¶ Bases:
matplotlib.colors.Normalize
Normalization class to be used with Matplotlib.
- Parameters
- data
ndarray
, optional The image array. This input is used only if
interval
is also input.data
andinterval
are used to compute the vmin and/or vmax values only ifvmin
orvmax
are not input.- interval
BaseInterval
subclass instance, optional The interval object to apply to the input
data
to determine thevmin
andvmax
values. This input is used only ifdata
is also input.data
andinterval
are used to compute the vmin and/or vmax values only ifvmin
orvmax
are not input.- vmin, vmaxfloat, optional
The minimum and maximum levels to show for the data. The
vmin
andvmax
inputs override any calculated values from theinterval
anddata
inputs.- stretch
BaseStretch
subclass instance The stretch object to apply to the data. The default is
LinearStretch
.- clipbool, optional
If
True
, data values outside the [0:1] range are clipped to the [0:1] range.- invalid
None
or float, optional Value to assign NaN values generated by this class. NaNs in the input
data
array are not changed. For matplotlib normalization, theinvalid
value should map to the matplotlib colormap “under” value (i.e., any finite value < 0). IfNone
, then NaN values are not replaced. This keyword has no effect ifclip=True
.
- data
If vmin or vmax is not given, they are initialized from the minimum and maximum value respectively of the first input processed. That is, __call__(A) calls autoscale_None(A). If clip is True and the given value falls outside the range, the returned value will be 0 or 1, whichever is closer. Returns 0 if
vmin==vmax
Works with scalars or arrays, including masked arrays. If clip is True, masked values are set to 1; otherwise they remain masked. Clipping silently defeats the purpose of setting the over, under, and masked colors in the colormap, so it is likely to lead to surprises; therefore the default is clip = False.
Methods Summary
__call__
(self, values[, clip, invalid])Transform values using this normalization.
inverse
(self, values[, invalid])Methods Documentation
-
__call__
(self, values, clip=None, invalid=None)[source]¶ Transform values using this normalization.
- Parameters
- valuesarray_like
The input values.
- clipbool, optional
If
True
, values outside the [0:1] range are clipped to the [0:1] range. IfNone
then theclip
value from theImageNormalize
instance is used (the default of which isFalse
).- invalid
None
or float, optional Value to assign NaN values generated by this class. NaNs in the input
data
array are not changed. For matplotlib normalization, theinvalid
value should map to the matplotlib colormap “under” value (i.e., any finite value < 0). IfNone
, then theImageNormalize
instance value is used. This keyword has no effect ifclip=True
.