MDA File Table View#

MDA file table view for data field selection and 2D plotting controls.

This module provides the MDAFileTableView widget which displays a table of MDA file data fields with checkboxes for selection. It supports both 1D and 2D data visualization with specialized controls for 2D plotting including X2 slice selection, X1/X2 positioner selection, Y detector selection, and I0 normalization.

For 1D data, users can select X, Y, I0, and Unscaled fields for plotting. For 2D data, additional controls are available for: - X2 slice selection (spinbox) - X1/X2 positioner selection (comboboxes) - Y detector selection (combobox) - I0 normalization (combobox) - Plot type selection (Heatmap/Contour) - Color palette selection - Log scale options

Uses mda_file_table_model.MDAFileTableModel for data display.

MDAFileTableView(*args, **kwargs)

HEADERS

Built-in immutable sequence.

COLUMNS

Built-in mutable sequence.

class mdaviz.mda_file_table_view.MDAFileTableView(*args: Any, **kwargs: Any)[source]#
_setupYDetControlsDelayed()[source]#

Setup Y DET controls after UI is fully loaded.

_trigger2DPlot()[source]#

Helper method to trigger 2D plotting with current selections.

_updateX2ValueLabel(x2_index, x2_positioner_info)[source]#

Update the X2 value label with the current positioner value.

Parameters:

x2_index (int): The current X2 index x2_positioner_info (dict): Information about the X2 positioner

data()[source]#

Return the data from the table view: self.data= {“fileInfo”: fileInfo, “fields”: fields}

data2Plot(selections)[source]#

Extracts selected datasets for plotting from scanDict based on user selections.

Parameters:
  • selections: A dictionary with keys “X”, “Y”, and optionally “I0”, where “X” is the index for the x-axis data, “Y” is a list of indices for the y-axis data, and “I0” is the index for normalization data.

Returns:
  • A tuple of (datasets, plot_options), where datasets is a list of tuples containing the data and options (label) for each dataset, and plot_options contains overall plotting configurations.

data2Plot2D(selections)[source]#

Extracts 2D datasets for plotting from scanDict2D based on user selections.

Parameters:
  • selections: A dictionary with keys “X”, “Y”, where “X” is the index for the x-axis data, “Y” is a list of indices for the y-axis data.

Returns:
  • A tuple of (datasets, plot_options), where datasets contains 2D data arrays, and plot_options contains overall plotting configurations.

get2DSelections()[source]#

Get current 2D plotting selections.

getX2Value()[source]#

Get the current X2 value from the spinbox.

onColorPaletteChanged(index)[source]#

Handle color palette selection change.

onI0SelectionChanged(index)[source]#

Handle I0 detector selection change.

onLogScaleChanged(checked)[source]#

Handle log scale checkbox changes.

onPlotButtonClicked()[source]#

Handle plot button click.

onPlotTypeChanged(index)[source]#

Handle plot type selection change.

onX1SelectionChanged(index)[source]#

Handle X1 positioner selection change.

onX2SelectionChanged(index)[source]#

Handle X2 positioner selection change.

onX2ValueChanged(value)[source]#

Handle X2 spinbox value changes.

onYDetSelectionChanged(index)[source]#

Handle Y detector selection change.

populate2DControls()[source]#

Populate all 2D control comboboxes with data from current file.

populateI0ComboBox()[source]#

Populate I0 detector combobox with available detectors from scanDict2D.

populateX1ComboBox()[source]#

Populate X1 combobox with available positioners from scanDictInner.

populateX2ComboBox()[source]#

Populate X2 combobox with available positioners from scanDict (outer dimension).

populateYDetComboBox()[source]#

Populate Y detector combobox with available detectors from scanDict2D.

setData()[source]#

Populates the _data attribute with file information and data extracted from a file.

The populated _data dictionary includes:
  • fileInfo (dict): A dictionary of all the file information:
    • fileName (str): The name of the file without its extension.

    • filePath (str): The full path of the file.

    • folderPath (str): The full path of the parent folder.

    • metadata (dict): The extracted metadata from the file.

    • scanDict (dict): A dictionary of positioner & detector dataset for plot.

    • firstPos (float): The first positioner (P1, or if no positioner, P0 = index).

    • firstDet (float): The first detector (D01).

    • pvList (list of str): List of detectors PV names as strings.

  • field (list): List of TableField object, one for each det/pos:

    ([TableField(name=’P0’, selection=None,… …desc=’Index’, pv=’Index’, unit=’a.u’),…])

setup2DControls()[source]#

Setup 2D data controls (X2 selection).

setupYDetControls()[source]#

Setup Y DET selection controls for 2D plotting.

update2DControls(is_multidimensional=False, dimensions=None, acquired_dimensions=None, x2_positioner_info=None)[source]#

Update 2D controls visibility and settings based on data dimensions.

Parameters:

is_multidimensional (bool): Whether the data is multidimensional dimensions (list): List of intended dimensions [X2_points, X1_points, …] acquired_dimensions (list): List of actual acquired dimensions [X2_points, X1_points, …] x2_positioner_info (dict): Information about the X2 positioner (name, unit, data)