MDA File Viz#

MDA File Visualization Module

Classes:

MDAFileVisualization: Main widget for displaying MDA file contents with tabbed interface MetadataSearchDialog: Dialog for searching within metadata text

Key Features:
  • Tabbed interface for Data, Plot, Metadata, and 2D visualization

  • Integrated 1D and 2D plotting with ChartView and ChartView2D

  • Interactive controls for curve fitting, styling, and log scales

  • Metadata search functionality

  • Dynamic tab visibility based on data dimensionality

  • Persistent UI state management

Dependencies:
  • PyQt6: GUI framework

  • mdaviz.chartview: 1D and 2D plotting widgets

  • mdaviz.data_table_view: Data table display

  • mdaviz.fit_models: Curve fitting functionality

  • mdaviz.utils: Utility functions for UI loading

Usage:

The MDAFileVisualization widget is typically instantiated as part of the main application window and receives MDA file data through: - setTableData(): Sets the data table content from MDA file - setMetadata(): Sets the metadata text content - setPlot(): Sets the 1D plotting widget (ChartView) with data from user selections - set2DData(): Sets 2D data for multi-dimensional arrays - update2DPlot(): Updates 2D plots based on user selections in 2D controls

class mdaviz.mda_file_viz.MDAFileVisualization(*args: Any, **kwargs: Any)[source]#

The panel to show the contents of a file.

_updateTabWidgetMaxHeight()[source]#

Update the tab widget’s maximum height to match the plot height setting.

clearContents(plot=True, data=True, metadata=True)[source]#

Clears content from the specified components of the visualization.

Parameters: - plot (bool, optional): If True, clears the plot content. Defaults to True. - data (bool, optional): If True, clears the data table content. Defaults to True. - metadata (bool, optional): If True, clears the metadata content. Defaults to True.

connectToFileTabChanges()[source]#

Connect to file tab changes to update 2D plot when needed.

getCurrentFileTableview()[source]#

Get the current file table view from the parent.

getLogScaleState()[source]#

Get the current log scale state.

isPlotBlank()[source]#

Check if the plot area is blank (no data displayed).

onClearFitsButtonClicked()[source]#

Handle clear fits button click.

onCurveStyleChanged(style_name: str)[source]#

Handle curve style change.

onFileTabChanged(tab_index, file_path, file_data, selection_field)[source]#

Handle file tab changes and update 2D plot if on 2D tab.

Parameters:

tab_index (int): Index of the newly selected file tab file_path (str): Path of the file associated with the new tab file_data (dict): Contains metadata and table data for the file selection_field (dict): Specifies the fields (POS/DET) selected for plotting

onFitButtonClicked()[source]#

Handle fit button click.

onLogScaleChanged()[source]#

Handle log scale checkbox changes.

onTabChanged(index)[source]#

Handle tab changes.

Parameters:

index (int): Index of the newly selected tab

set2DData(data)[source]#

Set 2D data for plotting.

Parameters:

data (dict or None): 2D data dictionary with scanDict2D and metadata, or None to clear

setLogScaleState(log_x: bool, log_y: bool)[source]#

Set the log scale state and update checkboxes.

setMetadata(text, *args, **kwargs)[source]#

Set text content for the metadata display.

Parameters:

text (str): Text content to display

setPlot(plot_widget)[source]#

Set the plot widget for the visualization tab.

Parameters:

plot_widget: The plot widget to add to the layout

setStatus(text)[source]#

Set the status bar text.

Parameters:

text (str): Status message to display

setTableData(data)[source]#

Set data for the data table view.

Parameters:

data: Data to display in the table

setup()[source]#

Setup the UI components and connections.

setup2DFunctionality()[source]#

Setup 2D plotting functionality.

setupCurveStyleUI()[source]#

Setup the curve style UI components and connections.

setupFitUI()[source]#

Setup the fit UI components and connections.

setupLogScaleUI()[source]#

Setup the log scale UI components and connections.

setupSearchFunctionality()[source]#

Setup search functionality for the metadata widget.

show1DControls(show: bool)[source]#

Show or hide 1D-specific controls by hiding/showing the entire curves widget.

showModeControls(show: bool)[source]#

Show or hide mode controls (autoBox, clearButton, etc.).

showSearchDialog()[source]#

Show the search dialog for the metadata widget.

syncLogScaleCheckboxes()[source]#

Sync checkbox states with the stored log scale state.

update2DPlot()[source]#

Update the 2D plot with current data.

update2DTabVisibility(show_2d_tab=False)[source]#

Update 2D tab visibility based on data dimensions.

Parameters:

show_2d_tab (bool): Whether to show the 2D tab

updateControlVisibility(tab_index)[source]#

Update control visibility based on the selected tab (1D vs 2D).

Parameters:

tab_index (int): Index of the selected tab

updatePlotControls(curve_selected: bool)[source]#

Update plot control states based on curve selection.

Parameters: - curve_selected: Whether a curve is currently selected

class mdaviz.mda_file_viz.MetadataSearchDialog(*args: Any, **kwargs: Any)[source]#

A simple search dialog for the metadata widget.

findNext()[source]#

Find next occurrence of the search text.

findPrevious()[source]#

Find previous occurrence of the search text.

findText()[source]#

Find text as user types.

keyPressEvent(event)[source]#

Handle key press events.

setupUI()[source]#

Setup the search dialog UI.