puzzlestream.backend.numpymodel2D module¶
QAbstractTableModel for 2D arrays module.
contains PSNumpyModel2D
-
class
puzzlestream.backend.numpymodel2D.
PSNumpyModel2D
(narray: numpy.ndarray, parent: PyQt5.QtCore.QObject = None)[source]¶ Bases:
PyQt5.QtCore.QAbstractTableModel
Subclass of QAbstractTableModel used to display numpy 2D arrays.
-
property
array
¶ Numpy array underlying this model.
-
columnCount
(parent: PyQt5.QtCore.QObject = None) → int[source]¶ Return number of columns.
- Returns:
Number of columns (int).
-
data
(index: PyQt5.QtCore.QModelIndex, role=0) → PyQt5.QtCore.QVariant[source]¶ Data at index.
- Args:
index (QModelIndex): Table index. role (Qt role): Qt role, defaults to Qt.DisplayRole
- Returns:
QVariant containing the str(data) at index.
-
getColumn
(index: int) → numpy.ndarray[source]¶ Return single column.
- Args:
index (int): Column index.
- Returns:
One dimensional numpy.ndarray containing the requested column.
-
getItemAt
(row: int, column: int) → numpy.ndarray[source]¶ Return data at specified row and column.
- Args:
row (int): Table row. column (int): Table column.
- Returns:
Numpy array element at [row, column]
-
getRow
(index: int) → numpy.ndarray[source]¶ Return single row.
- Args:
index (int): Row index.
- Returns:
One dimensional numpy.ndarray containing the requested row.
-
headerData
(section: int, orientation, role=0) → PyQt5.QtCore.QVariant[source]¶ Numbers in the header, starting from zero.
- Args:
section (int): Header section for which the data is requested. orientation (Qt orientation): Horizontal or vertical. role (Qt role): Default is DisplayRole.
- Returns:
Header data, which is just the section number (QVariant).
-
property