MDA File Table Model#

Select data fields for 1-D plotting: QAbstractTableModel.

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

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)

    • “I0” : 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 “I0”.

  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.

columnCount(parent=None)[source]#

Return the number of columns in the table.

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.

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)

rowCount(parent=None)[source]#

Number of fields.

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.

setFields(fields)[source]#

Define the data fields (rows) for the table.

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.