nomad_camels.frontpanels package
Subpackages
- nomad_camels.frontpanels.helper_panels package
- Submodules
- nomad_camels.frontpanels.helper_panels.button_move_scroll_area module
BidirectionalDict
DragButton
DropArea
Drop_Scroll_Area
Drop_Scroll_Area.add_button()
Drop_Scroll_Area.clear_area()
Drop_Scroll_Area.disable_run_buttons()
Drop_Scroll_Area.disable_single_run()
Drop_Scroll_Area.enable_run_buttons()
Drop_Scroll_Area.enable_single_run()
Drop_Scroll_Area.get_button_order()
Drop_Scroll_Area.order_changed
Drop_Scroll_Area.remove_button()
Drop_Scroll_Area.rename_button()
Drop_Scroll_Area.resizeEvent()
Drop_Scroll_Area.staticMetaObject
Drop_Scroll_Area.updateLayout()
MoveDialog
RenameTabWidget
RenameTabWidget.addPlusTab()
RenameTabWidget.addTab()
RenameTabWidget.add_button()
RenameTabWidget.clear_area()
RenameTabWidget.context_menu()
RenameTabWidget.create_new_tab()
RenameTabWidget.disable_run_buttons()
RenameTabWidget.disable_single_run()
RenameTabWidget.enable_run_buttons()
RenameTabWidget.enable_single_run()
RenameTabWidget.get_active_tab()
RenameTabWidget.get_button_order()
RenameTabWidget.get_tab_by_name()
RenameTabWidget.handle_editing_finished()
RenameTabWidget.make_tab()
RenameTabWidget.order_changed
RenameTabWidget.remove_button()
RenameTabWidget.rename_button()
RenameTabWidget.rename_tab()
RenameTabWidget.showEvent()
RenameTabWidget.staticMetaObject
RenameTabWidget.tab_removing()
RenameTabWidget.updateLayout()
RenameTabWidget.update_order()
- nomad_camels.frontpanels.helper_panels.enterTextDialog module
- nomad_camels.frontpanels.helper_panels.pass_ask module
- Module contents
Submodules
nomad_camels.frontpanels.flyer_window module
- class nomad_camels.frontpanels.flyer_window.FlyerButton(parent=None, flyer_data=None)
Bases:
QPushButton
- open_flyer_window()
- staticMetaObject = PySide6.QtCore.QMetaObject("FlyerButton" inherits "QPushButton": )
- class nomad_camels.frontpanels.flyer_window.FlyerDefiner(parent=None, flyer_data=None)
Bases:
QWidget
- get_data()
- name_changed
- read_rate_changed
- staticMetaObject = PySide6.QtCore.QMetaObject("FlyerDefiner" inherits "QWidget": Methods: #33 type=Signal, signature=name_changed(QString), parameters=QString #34 type=Signal, signature=read_rate_changed(QString), parameters=QString )
- class nomad_camels.frontpanels.flyer_window.FlyerWindow(parent=None, flyer_data=None)
Bases:
QDialog
- accept(self, /) None
- change_flyer_def(index)
- reject()
Overridden reject method that asks for confirmation before discarding changes.
- staticMetaObject = PySide6.QtCore.QMetaObject("FlyerWindow" inherits "QDialog": )
nomad_camels.frontpanels.instrument_config module
- class nomad_camels.frontpanels.instrument_config.Instrument_Config(active_instruments=None, parent=None)
Bases:
Ui_Form
,QWidget
- add_instance()
- build_table()
- get_all_names()
- get_config()
- get_current_config()
- name_config_changed(new_name)
- Parameters:
new_name
- remove_instance()
- show_hide_info()
- staticMetaObject = PySide6.QtCore.QMetaObject("Instrument_Config" inherits "QWidget": )
- table_click()
- update_channels()
Called when the active devices change. The channels in variables_handling are updated with the ones provided by the active devices.
nomad_camels.frontpanels.instrument_installer module
- class nomad_camels.frontpanels.instrument_installer.CustomTextEdit_new_painter
Bases:
QTextEdit
Custom QTextEdit that paints custom text when the text is empty.
- paintEvent(self, e: PySide6.QtGui.QPaintEvent, /) None
- staticMetaObject = PySide6.QtCore.QMetaObject("CustomTextEdit_new_painter" inherits "QTextEdit": )
- class nomad_camels.frontpanels.instrument_installer.Info_Widget(parent=None)
Bases:
QSplitter
- staticMetaObject = PySide6.QtCore.QMetaObject("Info_Widget" inherits "QSplitter": )
- update_texts(instr)
- class nomad_camels.frontpanels.instrument_installer.Install_Thread(devs, uninstall=False, parent=None)
Bases:
QThread
- error_signal
- info_step
- run()
- staticMetaObject = PySide6.QtCore.QMetaObject("Install_Thread" inherits "QThread": Methods: #12 type=Signal, signature=error_signal(PyObject), parameters=PyObject #13 type=Signal, signature=info_step(QString), parameters=QString #14 type=Signal, signature=val_step(int), parameters=int )
- val_step
- class nomad_camels.frontpanels.instrument_installer.Instrument_Installer(active_instruments=None, parent=None)
Bases:
Ui_Form
,QWidget
- build_table()
- checkBox_change(row)
- Parameters:
row
- get_checked_devs(ignore_version=False)
- Parameters:
ignore_version – (Default value = False)
- install_selected(uninstall=False)
- Parameters:
uninstall – (Default value = False)
- instruments_updated
param parent: handed over to QWidget. :type parent: QWidget
- propagate_exception(e: BaseException)
- select_all()
- select_none()
- show_hide_info()
- staticMetaObject = PySide6.QtCore.QMetaObject("Instrument_Installer" inherits "QWidget": Methods: #33 type=Signal, signature=instruments_updated() )
- table_click()
- thread_done()
- uninstall_selected()
- update_installed()
- nomad_camels.frontpanels.instrument_installer.getAllDevices()
So far only returns the installed devices, should in future work with the online repository of drivers.
- nomad_camels.frontpanels.instrument_installer.getInstalledDevices(force=False, return_packages=False)
Goes through the given device_driver_path and returns a list of the available devices.
- Parameters:
force – (Default value = False)
return_packages – (Default value = False)
- nomad_camels.frontpanels.instrument_installer.get_instr_license_text(instr_name)
- nomad_camels.frontpanels.instrument_installer.get_instr_readme_text(instr_name)
- nomad_camels.frontpanels.instrument_installer.install_instrument(device_name)
- Parameters:
device_name
nomad_camels.frontpanels.manage_instruments module
- class nomad_camels.frontpanels.manage_instruments.ManageInstruments(active_instruments=None, parent=None)
Bases:
QDialog
- accept() None
- closeEvent(a0: QCloseEvent) None
- Parameters:
a0 (QCloseEvent :)
- keyPressEvent(a0: QKeyEvent) None
Overwrites the keyPressEvent of the QDialog so that it does not close when pressing Enter/Return.
- Parameters:
a0 (QKeyEvent :)
- staticMetaObject = PySide6.QtCore.QMetaObject("ManageInstruments" inherits "QDialog": )
nomad_camels.frontpanels.plot_definer module
This module provides GUI dialogs and widgets for defining plot configurations and fit settings for NOMAD CAMELS. It uses PySide6 for the GUI and lmfit for fitting functions. The code defines several classes to store metadata (Plot_Info, Fit_Info) and multiple widgets for configuring different plot types (X-Y, Value-List, 2D) as well as fit definitions.
- class nomad_camels.frontpanels.plot_definer.Fit_Definer(fit_info: Fit_Info, parent=None, fit_to='')
Bases:
Ui_Fit_Definer
,QWidget
Widget for configuring a Fit_Info object.
Users can choose between a predefined or custom function, set initial parameters, and adjust bounds. This widget is based on the Qt Designer form compiled into Ui_Fit_Definer.
- change_func()
Enable or disable various fields depending on the user’s fit selections.
This method dynamically updates the UI elements based on whether the fit is enabled, if a custom function is chosen, and whether parameter guessing is enabled.
- get_data()
Store the current UI configuration into the Fit_Info object.
- load_data()
Load the Fit_Info configuration into the UI elements.
- staticMetaObject = PySide6.QtCore.QMetaObject("Fit_Definer" inherits "QWidget": )
- class nomad_camels.frontpanels.plot_definer.Fit_Info(do_fit=False, predef_func='', custom_func='', use_custom_func=False, guess_params=True, initial_params=None, y='', x='', additional_data=None, display_values=False)
Bases:
object
Stores all relevant settings for performing a curve fit.
- do_fit
Flag indicating if a fit should be performed.
- Type:
bool
- predef_func
Name of a predefined lmfit model.
- Type:
str
- custom_func
Custom function expression (if using a custom fit).
- Type:
str
- use_custom_func
Flag to choose between custom and predefined fit.
- Type:
bool
- guess_params
Flag to enable automatic parameter guessing.
- Type:
bool
- initial_params
Dictionary with keys “name”, “initial value”, “lower bound”, “upper bound” for parameters.
- Type:
dict
- y
Expression or variable representing the dependent data.
- Type:
str
- x
Expression or variable representing the independent data.
- Type:
str
- additional_data
Extra data used for the fit (if any).
- Type:
list
- display_values
Whether to display the fit parameter values on the plot.
- Type:
bool
- name
Auto-generated name for the fit.
- Type:
str
- get_name(stream='')
Generate a unique name for this fit.
- Parameters:
stream (str) – An identifier (e.g., a data stream name) to append.
- Returns:
A generated fit name (e.g., “Gaussian_channelY_v_channelX_stream”).
- Return type:
str
- get_variables(stream='')
Build a dictionary of parameter variable names for this fit.
Each parameter name is prefixed by the unique fit name.
- Parameters:
stream (str) – An identifier to append to parameter names.
- Returns:
A mapping {param_name: 1} for each parameter in initial_params.
- Return type:
dict
- class nomad_camels.frontpanels.plot_definer.Plot_Button_Overview(parent, plot_data=None)
Bases:
QWidget
Overview widget displaying a read-only table summarizing plot configurations and associated fits, along with a button to open the Plot_Definer dialog.
- define_plots()
Open the Plot_Definer dialog to edit the plot and fit configurations.
- keyPressEvent(event: QKeyEvent) None
Overridden to ignore the Enter/Return key to prevent premature dialog closure.
- Parameters:
event (QKeyEvent) – The key press event.
- staticMetaObject = PySide6.QtCore.QMetaObject("Plot_Button_Overview" inherits "QWidget": )
- class nomad_camels.frontpanels.plot_definer.Plot_Definer(parent=None, plot_data=None)
Bases:
QDialog
Dialog for defining or editing multiple Plot_Info objects.
It displays a table (AddRemoveTable) with existing plots and a child widget on the right for configuring details of the selected plot.
- accept() None
Overridden accept method to ensure that the current plot configuration is saved before closing the dialog.
- change_plot_def(index)
Called when the user selects a plot in the table.
Replaces the right-hand widget with the appropriate sub-definer based on the selected plot type.
- Parameters:
index (QModelIndex) – Index of the selected row.
- plot_added(n)
Slot called when a new plot row is added.
- Parameters:
n (int) – The index of the newly added row.
- plot_removed(n)
Slot called when a plot row is removed.
- Parameters:
n (int) – The index of the removed row.
- reject()
Overridden reject method that asks for confirmation before discarding changes.
- staticMetaObject = PySide6.QtCore.QMetaObject("Plot_Definer" inherits "QDialog": )
- class nomad_camels.frontpanels.plot_definer.Plot_Info(plt_type='X-Y plot', x_axis='', y_axes=None, title='', xlabel='', ylabel='', ylabel2='', do_plot=True, zlabel='', same_fit=False, fits=None, all_fit=None, z_axis='', logX=False, logY=False, logY2=False, top_left_x='', top_left_y='', plot_width='', plot_height='', checkbox_manual_plot_position=False, checkbox_show_in_browser=False, browser_port=8050)
Bases:
object
Holds all relevant metadata about a single plot configuration.
This includes information such as the type of plot, axis definitions, fit settings, manual positioning options, and display options.
- plt_type
The type of plot (e.g., “X-Y plot”, “Value-List”, “2D plot”).
- Type:
str
- x_axis
Expression or variable for the x-axis.
- Type:
str
- y_axes
Contains lists for ‘formula’ (expressions) and ‘axis’ (left/right assignment).
- Type:
dict
- z_axis
Expression or variable for the z-axis (used in 2D plots).
- Type:
str
- title
Plot title.
- Type:
str
- xlabel
Label for the x-axis.
- Type:
str
- ylabel
Label for the left y-axis (in XY plots).
- Type:
str
- ylabel2
Label for the right y-axis (if used).
- Type:
str
- zlabel
Label for the z-axis (in 2D plots).
- Type:
str
- logX
Whether to use logarithmic scaling for the x-axis.
- Type:
bool
- logY
Whether to use logarithmic scaling for the y-axis.
- Type:
bool
- logY2
Whether to use logarithmic scaling for the second y-axis.
- Type:
bool
- do_plot
Whether the plot should be rendered.
- Type:
bool
- same_fit
If True, the same fit settings apply to all y-axes.
- Type:
bool
- plot_all_available
For Value-List plots, plot all available channels.
- Type:
bool
- maxlen
Maximum number of data points to display (default: infinity).
- Type:
int or float
- top_left_x
Manual x-coordinate for plot placement.
- Type:
str/int
- top_left_y
Manual y-coordinate for plot placement.
- Type:
str/int
- plot_width
Manual width for the plot.
- Type:
str/int
- plot_height
Manual height for the plot.
- Type:
str/int
- checkbox_manual_plot_position
Flag indicating if manual positioning is enabled.
- Type:
bool
- checkbox_show_in_browser
Flag for showing the plot in a browser.
- Type:
bool
- browser_port
Port number for the browser-based plot.
- Type:
int
- name
A short name auto-generated from the plot properties.
- Type:
str
- get_fit_vars(stream='')
Collect all fit variable names needed for this plot.
- Parameters:
stream (str) – An identifier or suffix to append to variable names.
- Returns:
A dictionary mapping variable names to an initial value (1).
- Return type:
dict
- update_name()
Update the plot’s name attribute to a short descriptive string based on the current plot configuration.
- class nomad_camels.frontpanels.plot_definer.Single_Plot_Definer(plot_data: Plot_Info, parent=None)
Bases:
QWidget
Base class for a widget that defines a single plot.
Extended by subclasses for specific plot types (e.g., X-Y, Value-List, 2D).
- add_y(n)
Called when a new y-axis (or formula) row is added.
- Parameters:
n (int) – The index of the newly added row.
- get_data()
Retrieve the current plot configuration.
Child classes should override this method to update additional data.
- Returns:
The current plot configuration.
- Return type:
- remove_y(n)
Called when a y-axis (or formula) row is removed.
- Parameters:
n (int) – The index of the removed row.
- staticMetaObject = PySide6.QtCore.QMetaObject("Single_Plot_Definer" inherits "QWidget": )
- class nomad_camels.frontpanels.plot_definer.Single_Plot_Definer_2D(plot_data: Plot_Info, parent=None)
Bases:
Ui_Plot_Definer_2D
,Single_Plot_Definer
Widget to configure a “2D plot”.
This widget is based on the Qt Designer form compiled into Ui_Plot_Definer_2D.
- get_data()
Validate and retrieve data from the UI for the 2D plot.
- Returns:
The updated plot configuration.
- Return type:
- Raises:
ValueError – If any axis label contains invalid characters or if manual positioning/sizing is partially defined.
- hide_show_manual_position()
Toggle visibility of manual positioning fields based on the checkbox state.
- hide_show_show_in_browser()
Toggle visibility of the browser port selection based on the checkbox state.
- load_data()
Load manual positioning, sizing, and browser rendering options from Plot_Info.
- staticMetaObject = PySide6.QtCore.QMetaObject("Single_Plot_Definer_2D" inherits "Single_Plot_Definer": )
- class nomad_camels.frontpanels.plot_definer.Single_Plot_Definer_List(plot_data: Plot_Info, parent=None)
Bases:
Single_Plot_Definer
Widget to configure a “Value-List” plot.
This widget displays a checkbox to plot all available channels, a table for custom expressions, and fields for manual positioning and sizing.
- get_data()
Validate and retrieve data from the UI elements for the Value-List plot.
- Returns:
The updated plot configuration.
- Return type:
- Raises:
ValueError – If manual position/size is partially defined.
- load_data()
Load existing manual positioning and sizing data into the line edits.
- staticMetaObject = PySide6.QtCore.QMetaObject("Single_Plot_Definer_List" inherits "Single_Plot_Definer": )
- class nomad_camels.frontpanels.plot_definer.Single_Plot_Definer_XY(plot_data: Plot_Info, parent=None)
Bases:
Ui_Plot_Definer
,Single_Plot_Definer
Widget to configure a classic “X-Y plot”.
This widget is based on the Qt Designer form compiled into Ui_Plot_Definer.
- fit_change()
Switch the fit-defining widget based on the user’s selection.
Uses a single shared Fit_Definer if “same fit” is checked, or an individual Fit_Definer for the selected y-axis row otherwise.
- get_data()
Validate and retrieve data from the UI for the X-Y plot.
- Returns:
The updated plot configuration.
- Return type:
- Raises:
ValueError – If any label contains invalid characters or if manual position/size is partially defined.
- hide_show_manual_position()
Toggle visibility of manual positioning fields based on the checkbox state.
- hide_show_show_in_browser()
Toggle visibility of the browser port spinbox based on the checkbox state.
- load_data()
Populate UI fields with data from the Plot_Info object.
- staticMetaObject = PySide6.QtCore.QMetaObject("Single_Plot_Definer_XY" inherits "Single_Plot_Definer": )
- nomad_camels.frontpanels.plot_definer.add_fit(table_data, fit)
Helper function to add the appropriate fit function name into the table data.
- Parameters:
table_data (dict) – Dictionary used by an AddRemoveTable (keys include “fit”).
fit (Fit_Info) – The fit data object.
- nomad_camels.frontpanels.plot_definer.check_if_plotly_modules_are_available(self)
Check for the availability of required modules for browser-based plotting.
If any required modules are missing, prompt the user to install them.
- Parameters:
self – The calling widget instance (used to update UI elements based on the outcome).
- nomad_camels.frontpanels.plot_definer.is_module_available(module_name)
Check if a module is available for import.
- Parameters:
module_name (str) – The name of the module.
- Returns:
True if the module can be imported, False otherwise.
- Return type:
bool
- nomad_camels.frontpanels.plot_definer.make_table_data(plot_data)
Build a summary table data dictionary for an overview of plots and their fits.
- Parameters:
plot_data (list of Plot_Info) – List of plot configurations.
- Returns:
A dictionary with keys “plot-type”, “name”, and “fit” for the overview table.
- Return type:
dict
- nomad_camels.frontpanels.plot_definer.parse_int_field(text, min_value, fallback='')
Parse an integer from the provided text while enforcing a minimum value.
- Parameters:
text (str) – The string to parse.
min_value (int) – The minimum allowed value.
fallback (str) – The value to return if parsing fails.
- Returns:
The parsed integer (if successful) or the fallback.
- Return type:
int or str
nomad_camels.frontpanels.protocol_config module
- class nomad_camels.frontpanels.protocol_config.Protocol_Config(protocol=None, parent=None)
Bases:
Ui_Protocol_View
,QWidget
- accept() None
- accepted
- add_loop_step(step_type='', position=-1, parent=None, copied_step=False)
Add a loop_step of given step_type. Updates the current sequence into the protocol, then initializes the new step.
- Parameters:
step_type – (Default value = ‘’)
position – (Default value = -1)
parent – (Default value = None)
copied_step – (Default value = False)
- Returns:
step – the newly added loop_step
- Return type:
- build_protocol_sequence()
Shows / builds the protocol sequence in the treeView dependent on the loop_steps in the current_protocol.
- change_name()
- change_step_name()
Called when a loop_step changes its name, then updates the shown sequence, and also the protocol-data.
- check_file_name()
check if the filename contains any characters that might cause problems
- check_movability()
- check_protocol_name()
- closeEvent(a0: QCloseEvent) None
- Parameters:
a0 (QCloseEvent :)
- closing
- comment_loop_step(step_name)
- comment_shortcut()
- copy_loop_step(step_name)
Makes a deepcopy of the given step and stores it in copied_loop_step.
- Parameters:
step_name
- copy_shortcut()
- cut_loop_step(step_name)
Copies the given step, then removes it.
- Parameters:
step_name
- cut_shortcut()
- enable_step_move(enable)
- Parameters:
enable
- get_step_config()
Updates the data in the currently-to-configure loop_step.
- keyPressEvent(a0: QKeyEvent) None
Overwrites the keyPressEvent of the QDialog so that it does not close when pressing Enter/Return.
- Parameters:
a0 (QKeyEvent :)
- move_loop_step(up_down=0, in_out=0)
Moves a loop_step up or down in the sequence. It can also be moved in or out (into the loop_step above, it if accepts children).
- Parameters:
up_down – (Default value = 0)
in_out – (Default value = 0)
- paste_shortcut()
- remove_loop_step(ask=True)
After updating the loop_step order in the protocol, the selected loop step is deleted (if the messagebox is accepted).
- Parameters:
ask – (Default value = True)
- replace_loop_step(step_type='', position=-1, parent=None)
- sequence_right_click(pos)
Opens a specific Menu on right click in the protocol-sequence. If selection is not on a loop_step, it consists only of Add Step, otherwise it consists of Delete Step.
- Parameters:
pos
- staticMetaObject = PySide6.QtCore.QMetaObject("Protocol_Config" inherits "QWidget": Methods: #33 type=Signal, signature=accepted(PyObject), parameters=PyObject #34 type=Signal, signature=closing() )
- tree_click_sequence()
Called when clicking the treeView_protocol_sequence.
- update_add_step_actions()
Called when the devices change, updating the possible loopsteps to include new device steps.
- update_loop_step_order()
Goes through all the loop_steps in the sequence, then rearranges them in the protocol.
nomad_camels.frontpanels.settings_window module
- class nomad_camels.frontpanels.settings_window.Settings_Window(parent=None, settings=None)
Bases:
Ui_settings_window
,QDialog
Dialog to change the settings used in CAMELS.
- accept(self, /) None
- autosave_run_change()
- change_enable_API()
- change_theme()
- check_if_api_modules_are_available()
- confirm_delete_api_keys()
- copy_to_clipboard()
- generate_api_key()
- get_settings()
Reading all the UI-elements to get the selected settings, then returning those as a dictionary.
- keyPressEvent(a0: QKeyEvent) None
Overwrites the keyPressEvent of the QDialog so that it does not close when pressing Enter/Return.
- Parameters:
a0 (QKeyEvent :)
- number_change()
- open_api_docu()
- staticMetaObject = PySide6.QtCore.QMetaObject("Settings_Window" inherits "QDialog": )
- nomad_camels.frontpanels.settings_window.hash_api_key(api_key)
- nomad_camels.frontpanels.settings_window.is_module_available(module_name)
- nomad_camels.frontpanels.settings_window.store_api_key(api_key, conn)