cmaps.py
Converts some nicer matplotlib colormaps to pyqtgraph colormaps.
- class cmaps.PIVAColorMap[source]
Simple subclass of
pyqtgraph.ColorMap. Addsvmaxand powerlaw normalizationgamma.
- __init__(pos, color, mapping=ColorMap.CLIP)[source]
Parameters
- pos: array_like of float, optional
Assigned positions of specified colors. None sets equal spacing. Values need to be in range 0.0-1.0.
- color: array_like of color_like
List of colors, interpreted via
mkColor().- mapping: str or int, optional
Controls how values outside the 0 to 1 range are mapped to colors. See
setMappingMode()for details.The default of ColorMap.CLIP continues to show the colors assigned to 0 and 1 for all values below or above this range, respectively.
- apply_transformations()[source]
Recalculate the positions where the colormapping is defined by applying (in sequence) alpha, then a linear map to the range [0,
vmax] and finally the powerlaw scaling:pos = pos^gamma
- Return type:
None
- set_gamma(gamma=1.0)[source]
Set the exponent for the power-law norm (
gamma) that maps the colors to values. The values where the colours are defined are mapped like:y = x^gamma
- Parameters:
gamma (float)
- Return type:
None
- cmaps.convert_matplotlib_to_pyqtgraph(matplotlib_cmap, alpha=0.5)[source]
Converts
ColorMapobject frommatplotlibformat topyqtgraphformat.
- Parameters:
matplotlib_cmap (str | LinearSegmentedColormap | ListedColormap) – represents the name of a
matplotlibcolormapalpha (float) – transparency value to be assigned to the whole cmap. Default = 1.
- Returns:
corresponding colormap object in
pyqtgrqph- Return type:
- cmaps.convert_piva_to_matplotlib(piva_cmap, cmap_name='converted_cmap')[source]
Create a
matplotlibcolormap from aPIVAColorMapinstance.
- Parameters:
piva_cmap (PIVAColorMap) – colormap in a
pivaformatcmap_name (str) – optional name for the created cmap
- Returns:
colormap in a
matplotlibformat- Return type: