quicknxs.views package
QuickNXS Views/Visual components.
Submodules
quicknxs.views.compare module
- class quicknxs.views.compare.CompareDialog(*args, **kwargs)[source]
Bases:
QDialogA simple dialog window with a CompareWidget.
quicknxs.views.deadtime_entry module
- class quicknxs.views.deadtime_entry.DeadTimeEntryPoint(title='Dead Time Correction')[source]
Bases:
QGroupBoxGroup box for dead-time correction settings.
- class VerifyChangeCheckBox(*args, **kwargs)[source]
Bases:
QCheckBoxCheckbox for applying dead-time correction.
Intercepts the state change to ask user to confirm the change in dead-time settings, since it requires reloading all files
- mousePressEvent(self, e: QMouseEvent | None)[source]
- reload_files_signal
Signal emitted when files should be reloaded.
quicknxs.views.deadtime_settings module
- class quicknxs.views.deadtime_settings.DeadTimeSettingsView(parent: QWidget)[source]
Bases:
QDialogDialog to choose the dead time correction options.
- accept()[source]
Read in the options on the form when the OK button is clicked and update the global configuration.
- check_values_changed()[source]
Check if the dialog settings entries have been changed by the user.
- Returns:
bool –
False if dialog values are the same as the global configuration
- Return type:
True if dialog values are different from the global configuration
- reload_files_signal
Signal emitted when files should be reloaded.
quicknxs.views.diagnostic_widget module
- class quicknxs.views.diagnostic_widget.DiagnosticWidget(parent=None)[source]
Bases:
objectStandalone widget for displaying diagnostic information when cross-sections cannot be loaded.
Initialize the diagnostic widget.
- Parameters:
parent – Parent widget (typically the main window)
- show(diag_data: DiagnosticData)[source]
Show diagnostic dialog with run information.
- Parameters:
diag_data – DiagnosticData containing information from the run
quicknxs.views.load_ui module
Python interface for the Qt UI files.
- class quicknxs.views.load_ui.Q
Generic type for QMainWindow, QDialog, or QWidget.
alias of TypeVar(‘Q’, ~PyQt5.QtWidgets.QMainWindow, ~PyQt5.QtWidgets.QDialog, ~PyQt5.QtWidgets.QWidget)
quicknxs.views.main_window module
- class quicknxs.views.main_window.MainWindow[source]
Bases:
QMainWindowMain application window.
Initialization.
- changeRegionValues()[source]
Called when the reflectivity extraction region has been changed.
Sets up a trigger to replot the reflectivity with a delay so a subsequent change can occur without several replots.
- change_active_cross_section(is_checked: bool)[source]
Update the run info and overview plots when the active cross section is changed.
The toggled() signal is emitted from both radio buttons whose states were changed, therefore, use the bool value to only perform update actions once.
- Parameters:
is_checked (bool) – The state of the radio button that emitted the signal.
- change_offspec_colorscale()[source]
Change the intensity limits for the color scale of the off-specular plots.
- direct_beam_table_changed(item: QTableWidgetItem)[source]
- file_loaded_signal
Signal emitted when a file is loaded.
- file_open_from_list()[source]
Called when a new file is selected from the file list. This is an event call.
- file_open_sum_dialog()[source]
Read a set of congruent file data sets.
Select a list of event or histogram files, check their metadata is compatible, and read-in.
- get_direct_beam()[source]
Retrieve the direct beam data for the active reflectivity data.
This is used to normalize the distributions we are plotting. See plotting.plot_xtof and plotting.plot_overview
- global_reflectivity_config_changed()[source]
Perform action upon change in global reflectivity configuration.
- initialize_instrument()[source]
Initialize instrument according to the instrument and saved parameters.
- initiate_projection_plot(bool)
Signal to initiate the projection plot.
- initiate_reflectivity_or_intensity_plot
Signal to initiate the reflectivity or intensity plot.
- match_direct_beam_clicked()[source]
Find the best direct beam run for the activate data set and compute the reflectivity as needed.
- open_deadtime_settings()[source]
Show the dialog for dead-time options.
Update global configuration parameters upon closing the dialog.
- plot_view
Setting auto_change_active = True bypasses execution of: - MainWindow.file_open_from_list() - MainWindow.changeRegionValues() - MainHandler.reduction_table_changed() - MainHandler.direct_beam_table_changed()
- propagate_binning_options_to_runs()[source]
Apply the binning options in the global reflectivity extraction panel to all runs.
- reduceDatasets()[source]
Open a dialog to select reduction options for the current list of reduction items.
- reload_all_files()[source]
Reload all previously loaded files upon change in loading configuration.
- set_active_direct_beam(checked: bool, row: int)[source]
Select a data set when the user changes the active run radio button (col 0) in the direct beam table.
- set_active_reduction_data(checked: bool, row: int)[source]
Select a data set (when checking the active box in the normalization/reduction table).
- stripOverlap()[source]
Remove overlapping points in the reflectivity.
Cutting is done from the lower Qz measurements.
- update_gisans_viewer
Signal to update the GISANS viewer.
- update_off_specular_viewer
Signal to update the off-specular viewer.
- update_specular_viewer
Signal to update the specular viewer.
quicknxs.views.offspec_slice_dialog module
Dialog to let the user configure off-specular Qz slice parameters.
- class quicknxs.views.offspec_slice_dialog.OffSpecSliceDialog(parent, data_manager: DataManager)[source]
Bases:
QDialogDialog to define off-specular Qz slice parameters with plot preview.
- INTENSITY_MAX = 1.0
- INTENSITY_MIN = 1e-06
- drawing = False
- get_parameters()[source]
Get the slice parameters as a dictionary.
- Returns:
Dictionary containing off-specular slice parameters
- Return type:
- on_coordinate_system_changed()[source]
Handle coordinate system change - update visibility and redraw plot.
quicknxs.views.plotting module
- class quicknxs.views.plotting.PlotView(main_window)[source]
Bases:
objectPlotView is responsible for plotting the data in the main window.
- plot_offspec(recalc=True, crop=False)[source]
Plot off-specular data.
Create an offspecular plot for all cross sections of the datasets in the reduction list. The user can define upper and lower bounds for the plotted intensity and select the coordinates to be either kiz-kfz vs. Qz, Qx vs. Qz or kiz vs. kfz.
- plot_projections(preserve_lim=False)[source]
Create projections of the data on the x and y axes.
The x-projection can also be done be means of quantile calculation, which means that the ToF intensities are calculation which are exceeded by a certain number of points. This can be helpful to better separate the specular reflection from bragg-sheets
- plot_reflectivity_or_intensity()[source]
Plot reflectivity data or intensity, depending on the type of the active run.
If the active run is a direct beam run (natively labeled as direct beam OR selected from the direct beam table), the intensity vs ToF (or wavelength) in the region-of-interest (ROI) is plotted.
If the active run is selected from the reduction/data table, the reflectivity of all datasets is plotted, even if that same run also exists in the direct beam table.
This allows users to compare different ROIs by adding the same run to both tables, with the plot type determined by which table the user is currently viewing from.
- Return type:
True if the plot was successful, False otherwise
quicknxs.views.reduction_dialog module
Modal dialog for reduction options.
Dialog to select reduction options to choose which outputs are needed and in which formats to write them.
quicknxs.views.result_viewer module
Dialog to show final reduced data.
- class quicknxs.views.result_viewer.ResultViewer(parent, data_manager: DataManager)[source]
Bases:
QDialogReduction dialog.
- default_template = '{instrument}_{numbers}_{peak}_{item}_{state}.{type}'
- update_gisans(crop: bool = False)[source]
Update the results viewer with the latest GISANS calculations.
- Parameters:
crop – If True, all the plots will be cropped to the ++ cross-section
quicknxs.views.smooth_dialog module
Dialog to configure off-specular parameters (smoothing and/or binning).
- class quicknxs.views.smooth_dialog.OffSpecParametersDialog(parent, data_manager: DataManager, show_smoothing: bool = False, show_binning: bool = False)[source]
Bases:
QDialogCombined dialog for off-specular smoothing and binning parameters.
Initialize the combined off-specular parameters dialog.
- Parameters:
parent (QWidget) – Parent widget
data_manager (DataManager) – Data manager instance
show_smoothing (bool) – Whether to show smoothing parameters
show_binning (bool) – Whether to show binning parameters
- GRID_OFFSET = 0.05
- INTENSITY_MAX = 1.0
- INTENSITY_MIN = 1e-06
- drawing = False
- get_parameters()[source]
Get the parameters as a dictionary.
- Returns:
Dictionary containing off-specular parameters
- Return type:
- on_coordinate_system_changed()[source]
Handle coordinate system radio button changes - recalculate ranges from data.
quicknxs.views.status_bar module
quicknxs.views.widgets.accept_reject_dialog module
Zoo for customized simple widgets.
quicknxs.views.widgets.binning_type_combobox module
- class quicknxs.views.widgets.binning_type_combobox.BinningTypeSelection(on_change_handler=None, row=None, parent=None)[source]
Bases:
QComboBoxCombo box for binning types.
Initialize the BinningTypeSelection combo box.
- Parameters:
on_change_handler (Callable | None) – A function to be called when the selection changes. It should accept two arguments: the new index and the row identifier.
row (int | None) – An identifier for the row associated with this combo box, useful when the combo box is used in a table or list context.
parent (QWidget | None) – The parent widget.
quicknxs.views.widgets.mplwidget module
Plotting widget taken from QuickNXS.
#TODO: refactor this or replace it with a standard solution
- class quicknxs.views.widgets.mplwidget.MPLWidget(parent=None, with_toolbar=True, coordinates=False)[source]
Bases:
QWidgetA widget for displaying matplotlib plots, with a navigation toolbar.
- cbar = None
- cplot = None
- imshow(data, log=False, imin=None, imax=None, update=True, **opts)[source]
Convenience wrapper for self.canvas.ax.plot.
- leaveEvent(event)[source]
Make sure the cursor is reset to it’s default when leaving the widget.
In some cases the zoom cursor does not reset when leaving the plot.
- pcolormesh(datax, datay, dataz, log=False, imin=None, imax=None, update=False, **opts)[source]
Convenience wrapper for self.canvas.ax.plot.
- class quicknxs.views.widgets.mplwidget.MplCanvas(parent=None, width=3, height=3, dpi=100, sharex=None, sharey=None, adjust={})[source]
Bases:
FigureCanvasQTAggA canvas for matplotlib figures, used in the MPLWidget.
Bases:
NavigationToolbar2QTA small change to the original navigation toolbar.
coordinates: should we show the coordinates on the right?
Save the plot to a temporary png file and show a preview dialog also used for printing.
Save the current plot data to file (.dat, .npz, or .pkl).
Save the current figure.
Bases:
NavigationToolbarA navigation toolbar for a generic plot.
coordinates: should we show the coordinates on the right?
Bases:
NavigationToolbarA navigation toolbar for reflectivity plots created using matplotlib’s errorbar function.
coordinates: should we show the coordinates on the right?
Toggle lines between points in the plot.
Toggle between plotting R and R * Q^4.
Toggle between linear and logarithmic x-axis.
Toggle between linear and logarithmic y-axis.