grapa.database.Database
- class grapa.database.Database(data, colLabels: list | None = None, rowLabels: list | None = None, rowLabelNums: list | None = None)
Bases:
objectDatabase is not quite a Graph. Used to store data as table with labels. Database can be instancied 2 ways:
by providing a Graph object
by provinding data: np.array, colLabels, rowLabels the labels of the columns, respetively the rows, and rowLabelNums a numeric index corresponding the row label.
- __init__(data, colLabels: list | None = None, rowLabels: list | None = None, rowLabelNums: list | None = None)
Methods
__init__(data[, colLabels, rowLabels, ...])clean()colIdFromLabel(y)colValuesFromId(x)deleteRow(row_idx)getAttr(key)getColLabel([i])Returns label of column i.
getRowLabel([i])Return the row label.
getRowLabelNum([i])Return the numeric equivalent for the row label.
mask_from_conditions(tests)merge(other)plot(x, y[, linespec, xlim, ylim, also])deprecated plot function
plot2(x, y[, linespec, xlim, ylim, ...])plot the data of the Database Possible use case: .
renameColumn(oldname, newname)Change the label of a column.
rowIdFromLabel(label)setRowLabel(newlabel[, i])Change the row label.
setValue(col, row, value[, silent])shape([idx])Returns the shape of the np.ndarray data container.
update(attr)value(col, row[, silent])- getColLabel(i=':')
Returns label of column i.
- getRowLabel(i=':')
Return the row label.
- getRowLabelNum(i=':')
Return the numeric equivalent for the row label.
- plot(x, y, linespec='x', xlim: list | None = None, ylim: list | None = None, also: list | None = None)
deprecated plot function
- plot2(x, y, linespec='x', xlim: list | None = None, ylim: list | None = None, complement: dict | None = None, also: list | None = None, filesavesuffix='')
plot the data of the Database Possible use case:
testEffId1 = [['Eff. [%]', '>=', 19], ['row', '<', 2700]] testEffId2 = [['Eff. [%]', '>=', 19], ['row', '>=', 2700], ['row', '<', 2884]] testEffId3 = [['Eff. [%]', '>=', 19], ['row', '>=', 2884]] def alsoEff(x, y, color): return [[x, y, 's'+color, testEffId1], [x, y, 'v'+color, testEffId2], [x, y, 'sr', testEffId3]] dbProcess.plot('row', 'Eff. [%]', linespec='xk', xlim=[2350, np.ceil(max(dbProcess.rowLabelNums)/50)*50], ylim=[15, 21], also=alsoEff('row', 'Eff. [%]', 'k'))
- renameColumn(oldname, newname)
Change the label of a column.
- setRowLabel(newlabel, i=-1)
Change the row label. If i=-1 self.rowLabel is modified (default ‘Growth TL nb’)
- shape(idx='')
Returns the shape of the np.ndarray data container.