porescene.color.gradient module

class porescene.color.gradient.DiscreteGradient(pairs, /, color_nan=Color('#888888'))[source]

Bases: object

This gradient can be used to map colors to a fixed set of values.

get_color(values)[source]
Return type:

list[Color]

property color_nan: Color

Color of NaN values.

property colors: list[Color]
property labels: list[str]
class porescene.color.gradient.Gradient(colors=[Color('#FFFFFF'), Color('#000000')], boundary_lower=0.0, boundary_upper=1.0, /, color_nan=Color('#888888'), color_below=Color('#FFFFFF'), color_above=Color('#000000'), fit=False)[source]

Bases: ABC

Abstract base class for all types of gradient.

abstractmethod get_color(values)[source]

Returns the equivalent Color to values.

Returns list of Color, if several values given.

Return type:

list[Color]

property boundary_lower: float

Minimum of the covered numerical range.

property boundary_upper: float

Maximum of the covered numerical range.

property color_above: Color

Color for values that exceed the nominal range at the upper boundary.

property color_below: Color

Color for values that exceed the nominal range at the lower boundary.

property color_nan: Color

Color of NaN values.

property colors: list[Color]
property fit: bool

If true, values which exceed the given range, will be clipped to either the lower or upper boundary.

property len_segment: float

Length of each segment.

abstract property n_segments: int

Number of color segments.

property range

Nominal range which needs to be covered with colors.

class porescene.color.gradient.SegmentedGradient(colors=[Color('#FFFFFF'), Color('#000000')], boundary_lower=0.0, boundary_upper=1.0, /, color_nan=Color('#888888'), color_below=Color('#FFFFFF'), color_above=Color('#000000'), fit=False)[source]

Bases: Gradient

A gradient, which holds some segments with a color assigned to. Returns for a data-value the color of the corresponding segment.

get_color(values)[source]

Returns the equivalent Color to values.

Returns list of Color, if several values given.

Return type:

list[Color]

property n_segments: int

Number of color segments.

class porescene.color.gradient.SmoothGradient(colors=[Color('#FFFFFF'), Color('#000000')], boundary_lower=0.0, boundary_upper=1.0, /, color_nan=Color('#888888'), color_below=Color('#FFFFFF'), color_above=Color('#000000'), fit=False)[source]

Bases: Gradient

A gradient which maps numerical values to a range of colors. Each numerical value has a distinct corresponding color.

get_color(values)[source]

Returns the equivalent Color to values.

Returns list of Color, if several values given.

Return type:

list[Color]

property n_segments: int

Number of color segments.