ImageNormalize#
- class astropy.visualization.mpl_normalize.ImageNormalize(data=None, interval=None, vmin=None, vmax=None, stretch=<astropy.visualization.stretch.LinearStretch object>, clip=False, invalid=-1.0)[source]#
 Bases:
NormalizeNormalization class to be used with Matplotlib.
- Parameters:
 - data
ndarray, optional The image array. This input is used only if
intervalis also input.dataandintervalare used to compute the vmin and/or vmax values only ifvminorvmaxare not input.- interval
BaseIntervalsubclass instance, optional The interval object to apply to the input
datato determine thevminandvmaxvalues. This input is used only ifdatais also input.dataandintervalare used to compute the vmin and/or vmax values only ifvminorvmaxare not input.- vmin, vmax
python:float, optional The minimum and maximum levels to show for the data. The
vminandvmaxinputs override any calculated values from theintervalanddatainputs.- stretch
BaseStretchsubclass 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
python:Noneorpython:float, optional Value to assign NaN values generated by this class. NaNs in the input
dataarray are not changed. For matplotlib normalization, theinvalidvalue 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
 
Notes
If
vmin == vmax, the input data will be mapped to 0.- Parameters:
 - vmin, vmax
python:floatorpython:None Values within the range
[vmin, vmax]from the input data will be linearly mapped to[0, 1]. If either vmin or vmax is not provided, they default to the minimum and maximum values of the input, respectively.- clipbool, default: 
python:False Determines the behavior for mapping values outside the range
[vmin, vmax].If clipping is off, values outside the range
[vmin, vmax]are also transformed, resulting in values outside[0, 1]. This behavior is usually desirable, as colormaps can mark these under and over values with specific colors.If clipping is on, values below vmin are mapped to 0 and values above vmax are mapped to 1. Such values become indistinguishable from regular boundary values, which may cause misinterpretation of the data.
- vmin, vmax
 
Notes
If
vmin == vmax, input data will be mapped to 0.Methods Summary
__call__(values[, clip, invalid])Transform values using this normalization.
inverse(values[, invalid])Maps the normalized value (i.e., index in the colormap) back to image data value.
Methods Documentation
- __call__(values, clip=None, invalid=None)[source]#
 Transform values using this normalization.
- Parameters:
 - valuesnumpy:array_like
 The input values.
- clipbool, optional
 If
True, values outside the [0:1] range are clipped to the [0:1] range. IfNonethen theclipvalue from theImageNormalizeinstance is used (the default of which isFalse).- invalid
python:Noneorpython:float, optional Value to assign NaN values generated by this class. NaNs in the input
dataarray are not changed. For matplotlib normalization, theinvalidvalue should map to the matplotlib colormap “under” value (i.e., any finite value < 0). IfNone, then theImageNormalizeinstance value is used. This keyword has no effect ifclip=True.