iblqt.core.ColoredDataFrameTableModel

class iblqt.core.ColoredDataFrameTableModel[source]

Bases: DataFrameTableModel

Extension of DataFrameTableModel providing color-mapped numerical data.

__init__(parent=None, dataFrame=None, colormap='plasma', alpha=255)[source]

Initialize the ColoredDataFrameTableModel.

Parameters:
  • parent (QObject, optional) – The parent object.

  • dataFrame (DataFrame, optional) – The Pandas DataFrame to be represented by the model.

  • colormap (str) – The colormap to be used. Can be the name of a valid colormap from matplotlib or colorcet.

  • alpha (int) – The alpha value of the colormap. Must be between 0 and 255.

  • *args (tuple) – Positional arguments passed to the parent class.

  • **kwargs (dict) – Keyword arguments passed to the parent class.

data(index, role=0)[source]

Get the data for the specified index.

Parameters:
  • index (QModelIndex) – The index of the data.

  • role (int, optional) – The role of the data.

Returns:

The data for the specified index.

Return type:

Any

getAlpha()[source]

Return the alpha value of the colormap.

Returns:

The alpha value of the colormap.

Return type:

int

getColormap()[source]

Return the name of the current colormap.

Returns:

The name of the current colormap

Return type:

str

setAlpha(alpha=255)[source]

Set the alpha value of the colormap.

Parameters:

alpha (int) – The alpha value of the colormap. Must be between 0 and 255.

setColormap(name)[source]

Set the colormap.

Parameters:

name (str) – Name of the colormap to be used. Can be the name of a valid colormap from matplotlib or colorcet.

alpha: pyqtProperty

The alpha value of the colormap.

alphaChanged(int): Signal

Emitted when the alpha value has been changed.

colormap: pyqtProperty

The name of the colormap.

colormapChanged(str): Signal

Emitted when the colormap has been changed.