wolfhece.PyPalette ================== .. py:module:: wolfhece.PyPalette .. autoapi-nested-parse:: 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 --------------- .. py:class:: wolfpalette(parent=None, title=_('Colormap'), w=100, h=500, nseg=1024) Bases: :py:obj:`wx.Frame`, :py:obj:`matplotlib.colors.LinearSegmentedColormap` .. autoapi-inheritance-diagram:: wolfhece.PyPalette.wolfpalette :parts: 1 :private-bases: Color palette based on the "LinearSegmentedColormap" object from Matplotlib (Colormap objects based on lookup tables using linear segments) .. py:attribute:: filename :type: str .. py:attribute:: nb :type: int .. py:attribute:: colors :type: numpy.array .. py:attribute:: colorsflt :type: numpy.array .. py:attribute:: colorsuint8 :type: numpy.array .. py:attribute:: values :value: None .. py:attribute:: colormin .. py:attribute:: colormax .. py:attribute:: nseg :value: 1024 .. py:attribute:: automatic :value: True .. py:attribute:: interval_cst :value: False .. py:attribute:: wx_exists .. py:property:: colormin_uint8 .. py:property:: colormax_uint8 .. py:method:: get_colors_f32() .. py:method:: get_colors_uint8() .. py:method:: set_bounds() .. py:method:: get_rgba(x: numpy.ndarray) Retrieve the color based on the value x :param x: array of values .. py:method:: get_rgba_oneval(x: float) Retrieve the color based on the value x .. py:method:: export_palette_matplotlib(name) .. py:method:: distribute_values(minval: float = -99999, maxval: float = -99999, step=0, wx_permitted=True) Distribution of the palette values :param minval: minimum value :param maxval: maximum value :param step: distribution step If the step is provided, it takes precedence over the maximum value. .. py:method:: get_ScalarMappable_mpl() Retrieve the ScalarMappable object via Matplotlib .. py:method:: export_image(fn='', h_or_v: Literal['h', 'v', ''] = '', figax=None) Export image from colormap :param : fn : filepath or io.BytesIO() :param : h_or_v : configuration to save 'h' = horizontal, 'v' = vertical, '' = both .. py:method:: plot(fig: matplotlib.figure.Figure, ax: matplotlib.pyplot.Axes) Display the color palette .. py:property:: cmap Retrieve the color palette .. py:property:: _cmap_discrete Retrieve the discrete color palette .. py:property:: scalarmappable Retrieve the ScalarMappable object .. py:property:: vmin Retrieve the minimum value .. py:property:: vmax Retrieve the maximum value .. py:property:: norm Retrieve the normalization .. py:method:: fillgrid(gridto: wolfhece.CpGrid.CpGrid) Fill a grid with the palette values .. py:method:: updatefromgrid(gridfrom: wolfhece.CpGrid.CpGrid) Update the palette based on a grid .. py:method:: updatefrompalette(srcpal) Update the palette based on another one We copy the values, we do not point to the object .. py:method:: lookupcolor(x) .. py:method:: lookupcolorflt(x) .. py:method:: lookupcolorrgb(x) .. py:method:: default16() Default 16 color palette in WOLF .. py:method:: default_difference3() Default 3 color palette for differences in WOLF .. py:method:: set_values_colors(values: Union[list[float], numpy.ndarray], colors: Union[list[tuple[int]], numpy.ndarray, list[tuple[str]]]) Update the values and colors of the palette :param values: list or array of values :param colors: list or array of colors (RGB or RGBA) .. py:method:: set_discrete_values_colors(values: Union[list[float], numpy.ndarray], colors: Union[list[tuple[int]], numpy.ndarray, list[tuple[str]]]) Update the values and colors of the palette in discrete mode :param values: list or array of values :param colors: list or array of colors (RGB or RGBA) .. py:method:: set_linear_values_colors(values: Union[list[float], numpy.ndarray], colors: Union[list[tuple[int]], numpy.ndarray, list[tuple[str]]]) Update the values and colors of the palette in linear mode :param values: list or array of values :param colors: list or array of colors (RGB or RGBA) .. py:method:: set_values(values: Union[list[float], numpy.ndarray]) Update the values of the palette .. py:method:: defaultgray() Default gray palette in WOLF .. py:method:: fill_segmentdata() Update the color palette .. py:method:: readfile(*args) Read the palette from a WOLF .pal file .. py:method:: is_valid() Check the validity of the palette .. py:method:: is_discrete() Vérification si la palette est en mode discret .. py:method:: set_discrete(is_discrete: bool = True) Définition du mode discret de la palette .. py:method:: savefile(*args) Lecture de la palette sur base d'un fichier WOLF .pal .. py:method:: isopop(array: numpy.ma.masked_array, nbnotnull: int = 99999) Remplissage des valeurs de palette sur base d'une équirépartition de valeurs .. py:method:: defaultgray_minmax(array: numpy.ma.masked_array, nbnotnull=99999) Remplissage des valeurs de palette sur base d'une équirépartition de valeurs .. py:method:: defaultblue_minmax(array: numpy.ma.masked_array, nbnotnull=99999) Remplissage des valeurs de palette sur base d'une équirépartition de valeurs .. py:method:: defaultred_minmax(array: numpy.ma.masked_array, nbnotnull=99999) Remplissage des valeurs de palette sur base d'une équirépartition de valeurs .. py:method:: defaultblue() Remplissage des valeurs de palette sur base d'une équirépartition de valeurs .. py:method:: defaultblue3() Remplissage des valeurs de palette sur base d'une équirépartition de valeurs