sorbetto.flavor.abstract_symbolic_flavor module
- class sorbetto.flavor.abstract_symbolic_flavor.AbstractSymbolicFlavor(name: str = 'Unnamed Symbolic Flavor', colormap: Any = None)[source]
Bases:
AbstractFlavor,Generic[T]A symbolic flavor is a function that gives something to show on a Tile for any given importance values.
- abstract getCodomain() set[T][source]
Returns the codomain of the flavor. See https://en.wikipedia.org/wiki/Codomain
- Returns:
The codomain of the flavor.
- mapper(value: T) int[source]
Maps a value in the codomain to an integer in [1, n], where n is the size of the codomain.
This is stable as long as the codomain does not change.
- Parameters:
value (T) – A value in the codomain.
- Returns:
An integer in [1, n], where n is the size of the codomain.
- Return type:
int
- reverse_mapper(index: int) T[source]
Maps an integer in [1, n], where n is the size of the codomain, to a value in the codomain.
This is stable as long as the codomain does not change.
- Parameters:
index (int) – An integer in [1, n], where n is the size of the codomain.
- Returns:
A value in the codomain.
- Return type:
T