def data(self, index, role): if not index.isValid(): qVariant = QtCore.QVariant() elif role != QtCore.Qt.DisplayRole: qVariant = QtCore.QVariant() else: worldName, runNumber = sorted( self.runData[self.selectedMetric].keys())[index.row()] selectedData = self.runData[self.selectedMetric][worldName, runNumber] if index.column() == 0: aggr = lambda x: float( numpy.min(map(itemgetter(1), selectedData))) elif index.column() == 1: aggr = lambda x: float( numpy.max(map(itemgetter(1), selectedData))) elif index.column() == 2: aggr = lambda x: float( numpy.mean(map(itemgetter(1), selectedData))) elif index.column() == 3: aggr = lambda x: float( numpy.std(map(itemgetter(1), selectedData))) elif index.column() == 4: aggr = lambda x: float( numpy.median(map(itemgetter(1), selectedData))) elif index.column() == 5: aggr = lambda x: float(map(itemgetter(1), selectedData)[-1]) elif index.column() == 6: aggr = lambda x: float(selectedData[-1][0]) qVariant = QtCore.QVariant(aggr(selectedData)) return qVariant
def headerData(self, index, orientation, role): if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole: qVariant = QtCore.QVariant(self.horizontalHeader[index]) elif orientation == QtCore.Qt.Vertical and role == QtCore.Qt.DisplayRole: qVariant = QtCore.QVariant(self.verticalHeader[index]) else: qVariant = None return qVariant
def headerData(self, index, orientation, role): self.lock.acquire() if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole: qVariant = QtCore.QVariant(self.horizontalHeader[index]) elif orientation == QtCore.Qt.Vertical and role == QtCore.Qt.DisplayRole: qVariant = QtCore.QVariant(self.verticalHeader[index]) else: qVariant = None self.lock.release() return qVariant