nomad_camels_toolbox package

Subpackages

Submodules

nomad_camels_toolbox.data_reader module

nomad_camels_toolbox.data_reader.decide_entry_key(file_handle, entry_key: str = '')
nomad_camels_toolbox.data_reader.h5_group_to_dict(group)
Parameters:

group

nomad_camels_toolbox.data_reader.read_camels_file(file_path, data_set_key: str = '', entry_key: str = '', return_dataframe: bool = True, read_variables: bool = True, return_fits: bool = False, read_all_datasets: bool = False)

Read data from a CAMELS file.

Parameters:
  • file_path (str) – Path to the CAMELS file.

  • data_set_key (str, optional (default: "")) – Key of the data set to read. If not specified, the main data set is read.

  • entry_key (str, optional (default: "")) – Entry-Key to read. If not specified and there is more than one entry, the user is asked to select one. Usually files only have one entry “CAMELS_entry”, i.e. this is not needed.

  • return_dataframe (bool, optional (default: True)) – Whether to return the data as a pandas DataFrame. Requires pandas to be installed if pandas is not installed, this parameter is ignored.

  • read_variables (bool, optional (default: True)) – Whether to read the variables from the data set.

  • return_fits (bool, optional (default: False)) – Whether to return the fits of the data set.

  • read_all_datasets (bool, optional (default: False)) – Whether to read all datasets in the file. If True, the data_set_key parameter is ignored. If True, a dictionary with the data sets is returned.

Returns:

  • data (dict or pd.DataFrame) – The data from the data set.

  • fit_dict (dict) – The fits of the data set, only returned if return_fits is True.

nomad_camels_toolbox.plotting module

nomad_camels_toolbox.qt_viewer module

CAMELS Data Viewer - NOMAD CAMELS Toolbox

This module implements a graphical user interface to visualize CAMELS data files. It uses PySide6 for the GUI, pyqtgraph for interactive plotting, and h5py/numpy for data handling. The viewer supports drag-and-drop file loading, multiple plot types, and interactive image/intensity analysis.

class nomad_camels_toolbox.qt_viewer.Box_and_Line_Widget(parent=None)

Bases: QWidget

addItems(items)

Add items to the combo box.

Parameters:

items (list) – List of items to add to the combo box.

clear()

Clear the combo box and line edit.

currentText()

Get the current text from the combo box or line edit.

Returns:

The current text.

Return type:

str

setText(text)

Set the text of the line edit.

Parameters:

text (str) – The text to set in the line edit.

staticMetaObject = PySide6.QtCore.QMetaObject("Box_and_Line_Widget" inherits "QWidget": Methods:   #33 type=Signal, signature=textChanged(QString), parameters=QString )
textChanged
class nomad_camels_toolbox.qt_viewer.CAMELS_Viewer(parent=None)

Bases: QMainWindow

Main window class for the CAMELS Data Viewer application.

This class creates a user interface which allows the user to load CAMELS data files, visualize 1D plots or integrated image data, and interactively filter and analyze the data.

add_table_row(data, fname='', entry_name='')

Add a new row to the plot table to represent a new dataset/plot.

Parameters:
  • data (dict) – The loaded CAMELS data.

  • fname (str) – File name of the loaded data.

  • entry_name (str) – Specific entry name within the file.

check_change(index)

Handler for clicks on the plot table. Updates the plot based on changes.

Parameters:

index (QModelIndex) – Index of the cell clicked.

load_data(file_paths)

Load data from each given file path.

Parameters:

file_paths (list) – List of paths to HDF5/NeXus files.

load_measurement()

Open a file dialog to select and load one or multiple measurement files.

make_multi_selection_widget(number)

Create and display the multi-selection widget to set image axis selections and data filters.

Parameters:

number (int) – Row index from the plot table for which to configure the widget.

staticMetaObject = PySide6.QtCore.QMetaObject("CAMELS_Viewer" inherits "QMainWindow": )
update_image(number)

Update the image plot using filters and current selections from the multi-selection widget.

Parameters:

number (int) – Row number in the plot table.

update_intensity_line()

Hides image-related plots.

update_plot()

Refresh the entire plot area by clearing and re-adding all plot items.

class nomad_camels_toolbox.qt_viewer.DragDropGraphicLayoutWidget(parent=None)

Bases: GraphicsLayoutWidget

Custom GraphicsLayoutWidget that supports drag-and-drop of files.

Signal:

dropped (list): Emits a list of file paths dropped onto the widget.

dragEnterEvent(event)

Handle the drag enter event to allow file drops.

dragMoveEvent(event)

Handle the drag move event by setting the drop action (for visuals).

dropEvent(event)

Handle the drop event by extracting file paths and emitting them.

dropped
staticMetaObject = PySide6.QtCore.QMetaObject("DragDropGraphicLayoutWidget" inherits "GraphicsLayoutWidget": Methods:   #50 type=Signal, signature=dropped(QVariantList), parameters=QVariantList )
class nomad_camels_toolbox.qt_viewer.Multi_Selection_Widget(data, parent=None, x_selection=None, y_selection=None)

Bases: QWidget

A widget for selecting image axes and applying filters to the dataset.

Provides combo boxes to choose which columns to use as X and Y axes for generating integrated images and a set of checkboxes and combo boxes for filtering.

filter_signal
get_filters()

Retrieve current filters based on checked options.

Returns:

A dictionary mapping data keys to selected filter values.

Return type:

dict

staticMetaObject = PySide6.QtCore.QMetaObject("Multi_Selection_Widget" inherits "QWidget": Methods:   #33 type=Signal, signature=filter_signal(QVariantMap), parameters=QVariantMap   #34 type=Signal, signature=x_selection_signal(QString), parameters=QString   #35 type=Signal, signature=y_selection_signal(QString), parameters=QString )
x_selection_signal
y_selection_signal
nomad_camels_toolbox.qt_viewer.ask_for_input_box(values)

Open a dialog for the user to select one option from a list.

Parameters:

values (list) – List of possible values.

Returns:

The value selected by the user.

Return type:

str

nomad_camels_toolbox.qt_viewer.run_viewer()

Initialize and run the CAMELS Viewer application.

nomad_camels_toolbox.qt_viewer.set_theme(set_dark_mode=None)

Set the application’s theme based on the dark_mode flag.

Parameters:

dark_mode (bool) – If True, set dark theme. Otherwise, use light theme.

Module contents