MDA File Table Model#

Select data fields for 1-D plotting: QAbstractTableModel.

General plot model is: Y/Mon vs X. If X is not selected, use index number. If Mon is not selected, use 1.0 (trivial case, do not divide by Mon).

Data Field Selection Rules:

  1. A data field selection could have one of four states:
    • unselected (None)

    • “X”: abscissa (independent axis)

    • “Y” : ordinate (dependent axes)

    • “Mon” : divide this array into each Y

  2. Only zero or one data field can be selected as “X”.

  3. Only zero or one data field can be selected as “Mon”.

  4. One or more data fields can be selected as “Y”.

When Model/View is created, the view should call ‘model.setFields(fields)’ with the list of field names for selection. (If ‘fields’ is a different structure, such a ‘list(object)’ or ‘dict(str=object)’, then change both ‘columns()’ and ‘fields()’ so that each returns ‘list(str)’.) Note that ‘model.setFields(fields)’ can only be called once.

MDAFileTableModel(*args, **kwargs)

Select fields for plots.

ColumnDataType()

Data types expected by TableColumn.column_type.

FieldRuleType()

Data field selection rule types.

TableColumn(name, column_type, *[, rule])

One column of the table.

TableField(name[, selection, desc, pv, unit])

One data field candidate for user-selection.

class mdaviz.mda_file_table_model.ColumnDataType[source]#

Data types expected by TableColumn.column_type.

class mdaviz.mda_file_table_model.FieldRuleType[source]#

Data field selection rule types.

apply(*args, **kwargs)[source]#

Apply the selection rule.

class mdaviz.mda_file_table_model.MDAFileTableModel(*args: Any, **kwargs: Any)[source]#

Select fields for plots.

rowCount([parent])

Number of fields.

columnCount([parent])

Return the number of columns in the table.

data(index, role)

Return the data for the given index and role.

headerData(section, orientation, role)

Return the header data for the given section and role.

setData(index, value, role)

Set the data for the given index and role.

flags(index)

Return the flags for the given index.

checkbox(index)

Return the checkbox state for a given cell: (row, column) = (index.row(), index.column()).

applySelectionRules(index[, changes])

Apply selection rules 2-4.

updateCheckboxes([new_selection, ...])

Update checkboxes to agree with self.selections.

logCheckboxSelections()

columnName(column)

columnNumber(column_name)

columns()

setColumns(columns)

Define the columns for the table.

fieldName(row)

fieldText(index)

fields()

Return a list of the field names.

setFields(fields)

Define the data fields (rows) for the table.

plotFields()

Returns a dictionary with the selected fields to be plotted.

https://doc.qt.io/qtforpython-5/PySide2/QtCore/QAbstractTableModel.html

applySelectionRules(index, changes=False)[source]#

Apply selection rules 2-4.

checkbox(index)[source]#

Return the checkbox state for a given cell: (row, column) = (index.row(), index.column()).

checkboxStateChanged#

alias of dict

clearAllCheckboxes()[source]#

Clears (unchecks) all checkboxes in the model.

clearData() None[source]#

Clear all data.

columnCount(parent=None)[source]#

Return the number of columns in the table.

columnLabels() List[str][source]#

Return the column labels.

data(index, role)[source]#

Return the data for the given index and role.

fields()[source]#

Return a list of the field names.

flags(index)[source]#

Return the flags for the given index.

getAllData() Dict[str, List][source]#

Return all data as a dictionary.

getDateList() List[str][source]#

Return the list of dates.

getDimensionList() List[int][source]#

Return the list of dimensions.

getFileList() List[str][source]#

Return the list of file names.

getNumberList() List[int][source]#

Return the list of numbers.

getPointsList() List[int][source]#

Return the list of points.

getPositionerList() List[str][source]#

Return the list of positioners.

getPrefixList() List[str][source]#

Return the list of prefixes.

getRowData(row: int) Tuple[str, str, int, int, int, str, str, str][source]#

Return the data for a specific row.

getSizeList() List[str][source]#

Return the list of sizes.

headerData(section, orientation, role)[source]#

Return the header data for the given section and role.

isI0Selected()[source]#

Check if I0 is selected in any row.

plotFields()[source]#

Returns a dictionary with the selected fields to be plotted.

key=column_name, value= row_number(s) or fieldName(s)

rowCount(parent=None)[source]#

Number of fields.

setAllData(data: Dict[str, List]) None[source]#

Set all data from a dictionary.

setCheckbox(index, state)[source]#

Set the checkbox state.

setColumns(columns)[source]#

Define the columns for the table.

setData(index, value, role)[source]#

Set the data for the given index and role.

setDateList(date_list: List[str]) None[source]#

Set the list of dates.

setDimensionList(dimension_list: List[int]) None[source]#

Set the list of dimensions.

setFields(fields)[source]#

Define the data fields (rows) for the table.

setFileList(file_list: List[str]) None[source]#

Set the list of file names.

setNumberList(number_list: List[int]) None[source]#

Set the list of numbers.

setPointsList(points_list: List[int]) None[source]#

Set the list of points.

setPositionerList(positioner_list: List[str]) None[source]#

Set the list of positioners.

setPrefixList(prefix_list: List[str]) None[source]#

Set the list of prefixes.

setRowData(row: int, data: Tuple[str, str, int, int, int, str, str, str]) None[source]#

Set the data for a specific row.

setSizeList(size_list: List[str]) None[source]#

Set the list of sizes.

sort(column, order)[source]#

Sort the data by the given column and order.

updateCheckboxes(new_selection=None, old_selection=None, update_mda_mvc=True)[source]#

Update checkboxes to agree with self.selections.

class mdaviz.mda_file_table_model.TableColumn(name: str, column_type: str, *, rule: FieldRuleType | None = None)[source]#

One column of the table.

class mdaviz.mda_file_table_model.TableField(name: str, selection: str | None = None, *, desc: str = '', pv: str = '', unit: str = '')[source]#

One data field candidate for user-selection.

NOTE: Data for the “Description” and “PV” TableColumns is provided by the “description” and “pv” attributes here using cname.lower(). # WARNING: This could break if attribute names change.