heatmaps¶
Heatmaps
Classes
|
A concrete extension of ChessMoveHeatmapT for tracking move-related piece counts. |
|
A gradient heatmap that additionally tracks chess piece counts per square. |
|
A subclass of GradientHeatmapT that supports additional operations like normalization and color conversion. |
A base class representing a gradient heatmap for a chessboard position. |
- class heatmaps.ChessMoveHeatmap(piece_counts: Optional[NDArray[Dict[Piece, float64]]] = None, **kwargs)¶
Bases:
ChessMoveHeatmapT
A concrete extension of ChessMoveHeatmapT for tracking move-related piece counts.
This class refines ChessMoveHeatmapT by optionally initializing the piece counts from an external source. If neither piece_counts nor an existing heatmap data object is provided, the default initialization from ChessMoveHeatmapT is used.
- add_piece_counts(other_piece_counts: ndarray[Any, dtype[Dict[Piece, float64]]]) ndarray[Any, dtype[Dict[Piece, float64]]] ¶
- Parameters:
- other_piece_countsNDArray[Dict[Piece, float64]]
- Returns:
- NDArray[Dict[Piece, float64]]
- property colors: ndarray[Any, dtype[str_]]¶
Generate an array of color strings for each square.
Each square’s color is determined by converting its normalized red and blue intensity values (extracted from the normalized data array) using the intensity_to_color function.
- Returns:
- numpy.ndarray
NumPy array of hexadecimal color codes.
- property data: ndarray[Any, dtype[float64]]¶
Return the heatmap data.
- property piece_counts: ndarray[Any, dtype[Dict[Piece, float64]]]¶
Get the piece count array.
- Returns:
- NDArray[Dict[Piece, np.float64]]
A NumPy array of length 64 where each element is a dictionary mapping chess pieces to their associated count or intensity.
- property shape: Tuple[int, int]¶
Return the shape of the heatmap.
- class heatmaps.ChessMoveHeatmapT(**kwargs)¶
Bases:
GradientHeatmap
A gradient heatmap that additionally tracks chess piece counts per square.
This class extends GradientHeatmap by maintaining, for each square, a dictionary mapping each chess piece to a floating point value. This value can represent an intensity or count of moves involving that piece on the square.
- Attributes:
piece_counts
numpy.ndarray of dictGet the piece count array.
- add_piece_counts(other_piece_counts: ndarray[Any, dtype[Dict[Piece, float64]]]) ndarray[Any, dtype[Dict[Piece, float64]]] ¶
- Parameters:
- other_piece_countsNDArray[Dict[Piece, float64]]
- Returns:
- NDArray[Dict[Piece, float64]]
- property colors: ndarray[Any, dtype[str_]]¶
Generate an array of color strings for each square.
Each square’s color is determined by converting its normalized red and blue intensity values (extracted from the normalized data array) using the intensity_to_color function.
- Returns:
- numpy.ndarray
NumPy array of hexadecimal color codes.
- property data: ndarray[Any, dtype[float64]]¶
Return the heatmap data.
- property piece_counts: ndarray[Any, dtype[Dict[Piece, float64]]]¶
Get the piece count array.
- Returns:
- NDArray[Dict[Piece, np.float64]]
A NumPy array of length 64 where each element is a dictionary mapping chess pieces to their associated count or intensity.
- property shape: Tuple[int, int]¶
Return the shape of the heatmap.
- class heatmaps.GradientHeatmap(data: Optional[Union[NDArray[float64], GradientHeatmapT, ArrayLike]] = None)¶
Bases:
GradientHeatmapT
A subclass of GradientHeatmapT that supports additional operations like normalization and color conversion.
- property colors: ndarray[Any, dtype[str_]]¶
Generate an array of color strings for each square.
Each square’s color is determined by converting its normalized red and blue intensity values (extracted from the normalized data array) using the intensity_to_color function.
- Returns:
- numpy.ndarray
NumPy array of hexadecimal color codes.
- property data: ndarray[Any, dtype[float64]]¶
Return the heatmap data.
- property shape: Tuple[int, int]¶
Return the shape of the heatmap.