wolfhece.PyPalette._model
Author: HECE - University of Liege, Pierre Archambeau Date: 2024
Copyright (c) 2024 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
- class wolfhece.PyPalette._model.wolfpaletteModel(parent=None, title='', w=100, h=500, nseg=1024)[source]
Bases:
matplotlib.colors.LinearSegmentedColormap
Color palette data model based on LinearSegmentedColormap from Matplotlib (Colormap objects based on lookup tables using linear segments).
This class contains all data and computation logic without any wxPython dependency. For GUI functionality (dialogs, wx.Frame), use the
wolfpalettesubclass.- get_rgba(x: numpy.ndarray)[source]
Retrieve the color based on the value x
- Parameters:
x – array of values
- distribute_values(minval: float = -99999, maxval: float = -99999, step=0, **kwargs)[source]
Distribution of the palette values (data-only, no GUI dialogs).
- Parameters:
minval – minimum value (ignored if -99999)
maxval – maximum value (ignored if -99999)
step – distribution step; if provided, takes precedence over the maximum value
- export_image(fn='', h_or_v: Literal['h', 'v', ''] = '', figax=None)[source]
Export image from colormap
:param : fn : filepath or io.BytesIO() :param : h_or_v : configuration to save ‘h’ = horizontal, ‘v’ = vertical, ‘’ = both
- updatefrompalette(srcpal)[source]
Update the palette based on another one
We copy the values, we do not point to the object
- lookupcolor_rgba(x)[source]
Lookup interpolated color for value x.
- Returns:
(r, g, b, a) tuple with int values 0-255
- lookupcolorflt(x)[source]
Lookup interpolated color for value x.
- Returns:
[r, g, b, a] list with float values 0.0-1.0
- lookupcolorrgb(x)[source]
Lookup interpolated color for value x.
- Returns:
(r, g, b, a) tuple with int values 0-255
- set_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- set_discrete_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette in discrete mode
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- set_linear_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette in linear mode
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- isopop(array: numpy.ma.masked_array, nbnotnull: int = 99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs
- defaultgray_minmax(array: numpy.ma.masked_array, nbnotnull=99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs
- defaultblue_minmax(array: numpy.ma.masked_array, nbnotnull=99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs