Table parameter
A QTableWidget-based editor for numpy structured arrays, used in parameter trees.
Overview
quatm/GUI/widgets/table_parameter.py provides a table editing node for ParameterTree: the
table_parameter parameter type works together with the table_parameterItem widget item to edit
numpy structured arrays (such as calibration tables and scan sequences) directly in the parameter
tree.
Components
| Component | Description |
|---|---|
table_parameter | Parameter type: accepts a numpy structured array as its value |
table_parameterItem | Corresponding widget item: creates a QTableWidget as the editor from the array dtype |
table_parameterItem creates columns from the array dtype (including field name/type), and cell
edits are written back to the array immediately; valueIsDefault() is used to decide whether the
value needs to be persisted separately.
Usage
from quatm.GUI.widgets.table_parameter import table_parameter
import numpy as np
dt = np.dtype([("freq", float), ("amp", float)])
param = table_parameter(name="scan_table", value=np.zeros(10, dtype=dt))