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 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.
|
|
|
Built-in immutable sequence. |
|
Built-in mutable sequence. |
- class mdaviz.mda_file_table_view.MDAFileTableView(*args: Any, **kwargs: Any)[source]#
-
- _apply2DSelectionImpl(selection_by_pv, fileInfo)[source]#
Apply PV-based selection to controls (called with _applying_2d_selection True).
- _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
- apply2DSelection(selection_by_pv)[source]#
Apply PV-based 2D selection to this file’s controls; use defaults when a PV is missing.
- 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. Slice (if multidimensional) and/or normalize the data as needed.
- Parameters:
- selections: A dictionary with keys:
“X”: The index for the x-axis data
“Y”: A list of indices for the y-axis data
“I0” (optional): The index for normalization data
e.g. selections = {“X”: 1, “Y”: [2, 3, 5], “I0”: 4}
- 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”: The index for the x1-axis data
“X2”: The index for the x2-axis data
“Y”: A list of indices for the y-axis data (only the 1st element is used)
“I0” (optional): The index for normalization data
e.g. selections = {“X”: 1, “X2”: 2 ,”Y”: [3], “I0”: 4}
- Returns:
A tuple of (datasets, plot_options), where datasets contains 2D data arrays, and plot_options contains overall plotting configurations.
- get2DSelectionsByPV()[source]#
Return current 2D selection using PV/field names instead of internal ids.
- Structure:
- {
“X1_pv”: str | None, “X2_pv”: str | None, “Y_pv”: str | None, “I0_pv”: str | None, “plot_type”: str | None, “color_palette”: str | None, “log_y”: bool, “x2_slice”: int,
}
- populateI0ComboBox()[source]#
Populate I0 detector combobox with available detectors from scanDict2D.
- 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.
scanDict2D (dict): For 2D data
scanDictInner (dict): For 2D data
isMultidimensional (bool)
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’),…])
- 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)