Panel#

The datalab.gui.panel package provides the panel objects for signals and images.

Three types of panels are available:

Signal and Image Panels are called Data Panels and are used to display and handle signals and images in the main window of DataLab.

Data Panels rely on the datalab.gui.panel.base.ObjectProp class (managing the object properties) and a set of modules to handle the GUI features:

The Macro Panel is used to display and run macros. It relies on the datalab.gui.macroeditor module to handle the macro edition and execution.

Base features#

datalab.gui.panel.base.is_plot_item_serializable(item: Any) bool[source]#

Return True if plot item is serializable

datalab.gui.panel.base.is_hdf5_file(filename: str, check_content: bool = False) bool[source]#

Return True if filename has an HDF5 extension or is an HDF5 file.

Parameters:
  • filename – Path to the file to check

  • check_content – If True, also attempts to open the file to verify it’s a valid HDF5 file. If False, only checks the file extension.

Returns:

True if the file is (likely) an HDF5 file, False otherwise.

class datalab.gui.panel.base.ProcessingReport(success: bool, obj_uuid: str | None = None, message: str | None = None)[source]#

Report of processing operation

Parameters:
  • success – True if processing succeeded

  • obj_uuid – UUID of the processed object

  • message – Optional message (error or info)

class datalab.gui.panel.base.ObjectProp(panel: BaseDataPanel, objclass: SignalObj | ImageObj)[source]#

Object handling panel properties

Parameters:
  • panel – parent data panel

  • objclass – class of the object handled by the panel (SignalObj or ImageObj)

display_analysis_parameters(obj: SignalObj | ImageObj) bool[source]#

Set analysis parameter label.

Parameters:

obj – Signal or Image object

Returns:

True if analysis parameters were found and displayed, False otherwise.

display_processing_history(obj: SignalObj | ImageObj) bool[source]#

Display processing history.

Parameters:

obj – Signal or Image object

Returns:

True if processing history was found and displayed, False otherwise.

update_properties_from(obj: SignalObj | ImageObj | None = None, force_tab: Literal['creation', 'processing', 'analysis', None] | None = None) None[source]#

Update properties panel (properties, creation, processing) from object.

Parameters:
  • obj – Signal or Image object

  • force_tab – Force a specific tab to be current

mark_as_newly_created(obj: SignalObj | ImageObj) None[source]#

Mark object to show Creation tab on next selection.

Parameters:

obj – Object to mark

mark_as_freshly_processed(obj: SignalObj | ImageObj) None[source]#

Mark object to show Processing tab on next selection.

Parameters:

obj – Object to mark

mark_as_fresh_analysis(obj: SignalObj | ImageObj) None[source]#

Mark object to show Analysis tab on next selection.

Parameters:

obj – Object to mark

get_changed_properties() dict[str, Any][source]#

Get dictionary of properties that have changed from original values.

Returns:

Dictionary mapping property names to their new values, containing only the properties that were modified by the user.

update_original_values() None[source]#

Update the stored original values to the current dataset values.

This should be called after applying changes to reset the baseline for detecting future changes.

setup_creation_tab(obj: SignalObj | ImageObj, set_current: bool = False) bool[source]#

Setup the Creation tab with parameter editor for interactive object creation.

Parameters:
  • obj – Signal or Image object

  • set_current – If True, set the Creation tab as current after creation

Returns:

True if Creation tab was set up, False otherwise

apply_creation_parameters() None[source]#

Apply creation parameters: recreate object with updated parameters.

setup_processing_tab(obj: SignalObj | ImageObj, reset_params: bool = True, set_current: bool = False) bool[source]#

Setup the Processing tab with parameter editor for re-processing.

Parameters:
  • obj – Signal or Image object

  • reset_params – If True, call update_from_obj() to reset parameters from source object. If False, use parameters as stored in metadata.

  • set_current – If True, set the Processing tab as current after creation

Returns:

True if Processing tab was set up, False otherwise

apply_processing_parameters(obj: SignalObj | ImageObj | None = None, interactive: bool = True) ProcessingReport[source]#

Apply processing parameters: re-run processing with updated parameters.

Parameters:
  • obj – Signal or Image object to reprocess. If None, uses the current object.

  • interactive – If True, show progress and error messages in the UI.

Returns:

ProcessingReport with success status, object UUID, and optional message.

class datalab.gui.panel.base.AbstractPanelMeta(name, bases, namespace, **kwargs)[source]#

Mixed metaclass to avoid conflicts

class datalab.gui.panel.base.AbstractPanel(parent)[source]#

Object defining DataLab panel interface, based on a vertical QSplitter widget

A panel handle an object list (objects are signals, images, macros…). Each object must implement datalab.gui.ObjItf interface

get_serializable_name(obj: ObjItf) str[source]#

Return serializable name of object

serialize_object_to_hdf5(obj: ObjItf, writer: NativeH5Writer) None[source]#

Serialize object to HDF5 file

deserialize_object_from_hdf5(reader: NativeH5Reader, name: str, reset_all: bool = False) ObjItf[source]#

Deserialize object from a HDF5 file

Parameters:
  • reader – HDF5 reader

  • name – Object name in HDF5 file

  • reset_all – If True, preserve original UUIDs (workspace reload). If False, regenerate UUIDs (importing objects).

abstract serialize_to_hdf5(writer: NativeH5Writer) None[source]#

Serialize whole panel to a HDF5 file

abstract deserialize_from_hdf5(reader: NativeH5Reader, reset_all: bool = False) None[source]#

Deserialize whole panel from a HDF5 file

Parameters:
  • reader – HDF5 reader

  • reset_all – If True, preserve original UUIDs (workspace reload). If False, regenerate UUIDs (importing objects).

abstract create_object() ObjItf[source]#

Create and return object

abstract add_object(obj: ObjItf) None[source]#

Add object to panel

abstract remove_all_objects()[source]#

Remove all objects

class datalab.gui.panel.base.PasteMetadataParam[source]#

Paste metadata parameters

keep_roi#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

keep_geometry#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

keep_tables#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

keep_other#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(keep_roi: bool, keep_geometry: bool, keep_tables: bool, keep_other: bool) datalab.gui.panel.base.PasteMetadataParam#

Returns a new instance of PasteMetadataParam with the fields set to the given values.

Parameters:
  • keep_roi (bool) – Default: True.

  • keep_geometry (bool) – Default: False.

  • keep_tables (bool) – Default: False.

  • keep_other (bool) – Default: True.

Returns:

New instance of PasteMetadataParam.

class datalab.gui.panel.base.NonModalInfoDialog(parent: QWidget, title: str, text: str)[source]#

Non-modal information message box with selectable text.

This widget displays an information message in a message dialog box, allowing users to select and copy the text content.

class datalab.gui.panel.base.SaveToDirectoryGUIParam[source]#

Save to directory parameters

directory#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.DirectoryItem

basename#

Basename pattern. Python format string. See description for details. Default: β€˜{title}’.

Type:

guidata.dataset.dataitems.StringItem

help#

Default: None.

Type:

guidata.dataset.dataitems.ButtonItem

extension#

Default: None.

Type:

guidata.dataset.dataitems.ChoiceItem

overwrite#

Overwrite existing files. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

preview#

String, regexp: ^(?!invalid).\*. Default: None.

Type:

guidata.dataset.dataitems.TextItem

classmethod create(directory: str, basename: str, help: type, extension: Any, overwrite: bool, preview: str) datalab.gui.panel.base.SaveToDirectoryGUIParam#

Returns a new instance of SaveToDirectoryGUIParam with the fields set to the given values.

Parameters:
  • directory (str) – Default: β€˜β€™.

  • basename (str) – Basename pattern. Python format string. See description for details. Default: β€˜{title}’.

  • help (type) – Default: None.

  • extension (Any) – Default: None.

  • overwrite (bool) – Overwrite existing files. Default: False.

  • preview (str) – String, regexp: ^(?!invalid).\*. Default: None.

Returns:

New instance of SaveToDirectoryGUIParam.

on_button_click(_item: ButtonItem, _value: None, parent: QWidget) None[source]#

Help button callback.

get_extension_choices(_item=None, _value=None)[source]#

Return list of available extensions for choice item.

build_filenames(objs: list[TypeObj] | None = None) list[str][source]#

Build filenames according to current parameters.

generate_filepath_obj_pairs(objs: list[TypeObj]) Generator[tuple[str, TypeObj], None, None][source]#

Iterate over (filepath, object) pairs to be saved.

update_preview(_item=None, _value=None) None[source]#

Update preview.

class datalab.gui.panel.base.AddMetadataParam[source]#

Add metadata parameters

metadata_key#

The key name for the metadata item. String, not empty, regexp: ^[a-za-z_][a-za-z0-9_]\*$. Default: β€˜custom_key’.

Type:

guidata.dataset.dataitems.StringItem

value_pattern#

Python format string. See description for details. Default: β€˜{index}’.

Type:

guidata.dataset.dataitems.StringItem

help#

Default: None.

Type:

guidata.dataset.dataitems.ButtonItem

conversion#

Default: β€˜string’.

Type:

guidata.dataset.dataitems.ChoiceItem

preview#

String, regexp: ^(?!invalid).\*. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.TextItem

classmethod create(metadata_key: str, value_pattern: str, help: type, conversion: Any, preview: str) datalab.gui.panel.base.AddMetadataParam#

Returns a new instance of AddMetadataParam with the fields set to the given values.

Parameters:
  • metadata_key (str) – The key name for the metadata item. String, not empty, regexp: ^[a-za-z_][a-za-z0-9_]\*$. Default: β€˜custom_key’.

  • value_pattern (str) – Python format string. See description for details. Default: β€˜{index}’.

  • help (type) – Default: None.

  • conversion (Any) – Default: β€˜string’.

  • preview (str) – String, regexp: ^(?!invalid).\*. Default: β€˜β€™.

Returns:

New instance of AddMetadataParam.

on_help_button_click(_item: ButtonItem, _value: None, parent: QWidget) None[source]#

Help button callback.

get_conversion_choices(_item=None, _value=None)[source]#

Return list of available conversion choices.

build_values(objs: list[TypeObj] | None = None) list[str | float | int | bool][source]#

Build values according to current parameters.

Raises:

ValueError – If a value cannot be converted to the target type.

update_preview(_item=None, _value=None) None[source]#

Update preview.

class datalab.gui.panel.base.BaseDataPanel(parent: QWidget)[source]#

Object handling the item list, the selected item properties and plot

abstract static get_roi_class() Type[TypeROI][source]#

Return ROI class

abstract static get_roieditor_class() Type[TypeROIEditor][source]#

Return ROI editor class

closeEvent(event)[source]#

Reimplement QMainWindow method

plot_item_parameters_changed(item: CurveItem | MaskedXYImageItem | LabelItem) None[source]#

Plot items changed: update metadata of all objects from plot items

plot_item_moved(item: LabelItem, x0: float, y0: float, x1: float, y1: float) None[source]#

Plot item moved: update metadata of all objects from plot items

Parameters:
  • item – Plot item

  • x0 – new x0 coordinate

  • y0 – new y0 coordinate

  • x1 – new x1 coordinate

  • y1 – new y1 coordinate

serialize_object_to_hdf5(obj: TypeObj, writer: NativeH5Writer) None[source]#

Serialize object to HDF5 file

serialize_to_hdf5(writer: NativeH5Writer) None[source]#

Serialize whole panel to a HDF5 file

deserialize_from_hdf5(reader: NativeH5Reader, reset_all: bool = False) None[source]#

Deserialize whole panel from a HDF5 file

Parameters:
  • reader – HDF5 reader

  • reset_all – If True, preserve original UUIDs (workspace reload). If False, regenerate UUIDs (importing objects).

create_object() TypeObj[source]#

Create object (signal or image)

Returns:

SignalObj or ImageObj object

add_object(obj: TypeObj, group_id: str | None = None, set_current: bool = True) None[source]#

Add object

Parameters:
  • obj – SignalObj or ImageObj object

  • group_id – group id to which the object belongs. If None or empty string, the object is added to the current group.

  • set_current – if True, set the added object as current

remove_all_objects() None[source]#

Remove all objects

setup_panel() None[source]#

Setup panel

refresh_plot(what: str, update_items: bool = True, force: bool = False, only_visible: bool = True, only_existing: bool = False) None[source]#

Refresh plot.

Parameters:
  • what – string describing the objects to refresh. Valid values are β€œselected” (refresh the selected objects), β€œall” (refresh all objects), β€œexisting” (refresh existing plot items), or an object uuid.

  • update_items – if True, update the items. If False, only show the items (do not update them). Defaults to True.

  • force – if True, force refresh even if auto refresh is disabled. Defaults to False.

  • only_visible – if True, only refresh visible items. Defaults to True. Visible items are the ones that are not hidden by other items or the items except the first one if the option β€œShow first only” is enabled. This is useful for images, where the last image is the one that is shown. If False, all items are refreshed.

  • only_existing – if True, only refresh existing items. Defaults to False. Existing items are the ones that have already been created and are associated to the object uuid. If False, create new items for the objects that do not have an item yet.

Raises:

ValueError – if what is not a valid value

manual_refresh() None[source]#

Manual refresh

get_category_actions(category: ActionCategory) list[QAction][source]#

Return actions for category

get_context_menu() QMenu[source]#

Update and return context menu

add_group(title: str, select: bool = False) ObjectGroup[source]#

Add group

Parameters:
  • title – group title

  • select – if True, select the group in the tree view. Defaults to False.

Returns:

Created group object

duplicate_object() None[source]#

Duplication signal/image object

copy_metadata() None[source]#

Copy object metadata

paste_metadata(param: PasteMetadataParam | None = None) None[source]#

Paste metadata to selected object(s)

add_metadata(param: AddMetadataParam | None = None) None[source]#

Add metadata item to selected object(s)

Parameters:

param – Add metadata parameters

copy_roi() None[source]#

Copy regions of interest

paste_roi() None[source]#

Paste regions of interest

remove_object(force: bool = False) None[source]#

Remove signal/image object

Parameters:

force – if True, remove object without confirmation. Defaults to False.

delete_all_objects() None[source]#

Confirm before removing all objects

delete_metadata(refresh_plot: bool = True, keep_roi: bool | None = None) None[source]#

Delete metadata of selected objects

Parameters:
  • refresh_plot – Refresh plot. Defaults to True.

  • keep_roi – Keep regions of interest, if any. Defaults to None (ask user).

add_annotations_from_items(items: list, refresh_plot: bool = True) None[source]#

Add object annotations (annotation plot items).

Parameters:
  • items – annotation plot items

  • refresh_plot – refresh plot. Defaults to True.

update_metadata_view_settings() None[source]#

Update metadata view settings

copy_titles_to_clipboard() None[source]#

Copy object titles to clipboard (for reproducibility)

new_group() None[source]#

Create a new group

rename_selected_object_or_group(new_name: str | None = None) None[source]#

Rename selected object or group

Parameters:

new_name – new name (default: None, i.e. ask user)

abstract get_newparam_from_current(newparam: NewSignalParam | NewImageParam | None = None) NewSignalParam | NewImageParam | None[source]#

Get new object parameters from the current object.

Parameters:

newparam – new object parameters. If None, create a new one.

Returns:

New object parameters

abstract new_object(param: NewSignalParam | NewImageParam | None = None, edit: bool = False, add_to_panel: bool = True) TypeObj | None[source]#

Create a new object (signal/image).

Parameters:
  • param – new object parameters

  • edit – Open a dialog box to edit parameters (default: False). When False, the object is created with default parameters and creation parameters are stored in metadata for interactive editing.

  • add_to_panel – Add object to panel (default: True)

Returns:

New object

set_current_object_title(title: str) None[source]#

Set current object title

load_from_directory(directory: str | None = None) list[TypeObj][source]#

Open objects from directory (signals or images, depending on the panel), add them to DataLab and return them. If the directory is not specified, ask the user to select a directory.

Parameters:

directory – directory name

Returns:

list of new objects

load_from_files(filenames: list[str] | None = None, create_group: bool = False, add_objects: bool = True, ignore_errors: bool = False) list[TypeObj][source]#

Open objects from file (signals/images), add them to DataLab and return them.

Parameters:
  • filenames – File names

  • create_group – if True, create a new group if more than one object is loaded for a single file. Defaults to False: all objects are added to the current group.

  • add_objects – if True, add objects to the panel. Defaults to True.

  • ignore_errors – if True, ignore errors when loading files. Defaults to False.

Returns:

list of new objects

save_to_files(filenames: list[str] | str | None = None) None[source]#

Save selected objects to files (signal/image).

Parameters:

filenames – File names

save_to_directory(param: SaveToDirectoryParam | None = None) None[source]#

Save signals or images to directory using a filename pattern.

Opens a dialog to select the output directory, the basename pattern and the extension.

Parameters:

param – parameters.

handle_dropped_files(filenames: list[str] | None = None) None[source]#

Handle dropped files

Parameters:

filenames – File names

Returns:

None

exec_import_wizard() None[source]#

Execute import wizard

import_metadata_from_file(filename: str | None = None) None[source]#

Import metadata from file (JSON).

Parameters:

filename – File name

export_metadata_from_file(filename: str | None = None) None[source]#

Export metadata to file (JSON).

Parameters:

filename – File name

copy_annotations() None[source]#

Copy annotations from selected object

paste_annotations() None[source]#

Paste annotations to selected object(s)

import_annotations_from_file(filename: str | None = None) None[source]#

Import annotations from file (JSON).

Parameters:

filename – File name

export_annotations_from_file(filename: str | None = None) None[source]#

Export annotations to file (JSON).

Parameters:

filename – File name

delete_annotations() None[source]#

Delete all annotations from selected object(s)

import_roi_from_file(filename: str | None = None) None[source]#

Import regions of interest from file (JSON).

Parameters:

filename – File name

export_roi_to_file(filename: str | None = None) None[source]#

Export regions of interest to file (JSON).

Parameters:

filename – File name

selection_changed(update_items: bool = False) None[source]#

Object selection changed: update object properties, refresh plot and update object view.

Parameters:

update_items – Update plot items (default: False)

properties_changed() None[source]#

The properties β€˜Apply’ button was clicked: update object properties, refresh plot and update object view.

recompute_processing() None[source]#

Recompute/rerun selected objects or group with stored processing parameters.

This method handles both single objects and groups. For each object, it checks if it has 1-to-1 processing parameters that can be recomputed. Objects without recomputable parameters are skipped.

select_source_objects() None[source]#

Select source objects associated with the selected object’s processing.

This method retrieves the source object UUIDs from the selected object’s processing parameters and selects them in the object view.

add_plot_items_to_dialog(dlg: PlotDialog, oids: list[str]) None[source]#

Add plot items to dialog

Parameters:
  • dlg – Dialog

  • oids – Object IDs

open_separate_view(oids: list[str] | None = None, edit_annotations: bool = False) PlotDialog | None[source]#

Open separate view for visualizing selected objects

Parameters:
  • oids – Object IDs (default: None)

  • edit_annotations – Edit annotations (default: False)

Returns:

Instance of PlotDialog

view_images_side_by_side(oids: list[str] | None = None) None[source]#

View selected images side-by-side in a grid layout

Parameters:

oids – Object IDs (default: None, uses selected objects)

get_dialog_size() tuple[int, int][source]#

Get dialog size (minimum and maximum)

create_new_dialog(edit: bool = False, toolbar: bool = True, title: str | None = None, name: str | None = None, options: dict[str, Any] | None = None) PlotDialog | None[source]#

Create new pop-up signal/image plot dialog.

Parameters:
  • edit – Edit mode

  • toolbar – Show toolbar

  • title – Dialog title

  • name – Dialog object name

  • options – Plot options

Returns:

Plot dialog instance

get_roi_editor_output(mode: Literal['apply', 'extract', 'define'] = 'apply') tuple[TypeROI, bool] | None[source]#

Get ROI data (array) from specific dialog box.

Parameters:

mode – Mode of operation, either β€œapply” (define ROI, then apply it to selected objects), β€œextract” (define ROI, then extract data from it), or β€œdefine” (define ROI without applying or extracting).

Returns:

A tuple containing the ROI object and a boolean indicating whether the dialog was accepted or not.

get_objects_with_dialog(title: str, comment: str = '', nb_objects: int = 1, parent: QW.QWidget | None = None) TypeObj | None[source]#

Get object with dialog box.

Parameters:
  • title – Dialog title

  • comment – Optional dialog comment

  • nb_objects – Number of objects to select

  • parent – Parent widget

Returns:

Object(s) (signal(s) or image(s), or None if dialog was canceled)

show_results() None[source]#

Show results

toggle_result_label_visibility(state: bool) None[source]#

Toggle the visibility of the merged result label on the plot.

Parameters:

state – True to show the label, False to hide it

plot_results(kind: str | None = None, xaxis: str | None = None, yaxis: str | None = None) None[source]#

Plot results

Parameters:
  • kind – Plot kind. Either β€œone_curve_per_object” or β€œone_curve_per_title”. If None, show dialog to get parameters.

  • xaxis – X axis column name. If None, show dialog to get parameters.

  • yaxis – Y axis column name. If None, show dialog to get parameters.

delete_results() None[source]#

Delete results

add_label_with_title(title: str | None = None, ignore_msg: bool = True) None[source]#

Add a label with object title on the associated plot

Parameters:
  • title – Label title. Defaults to None. If None, the title is the object title.

  • ignore_msg – If True, do not show the information message. Defaults to True. If False, show a message box to inform the user that the label has been added as an annotation, and that it can be edited or removed using the annotation editing window.

Signal panel#

class datalab.gui.panel.signal.SignalPanel(parent: QW.QWidget, dockableplotwidget: DockablePlotWidget, panel_toolbar: QW.QToolBar)[source]#

Object handling the item list, the selected item properties and plot, specialized for Signal objects

PARAMCLASS#

Signal object

title#

Signal title. Default: β€˜Untitled’.

Type:

guidata.dataset.dataitems.StringItem

xydata#

Default: None.

Type:

guidata.dataset.dataitems.FloatArrayItem

metadata#

Default: {}.

Type:

guidata.dataset.dataitems.DictItem

annotations#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

xlabel#

Title. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

xunit#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

ylabel#

Title. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

yunit#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

autoscale#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

xscalelog#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

xscalemin#

Lower bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xscalemax#

Upper bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

yscalelog#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

yscalemin#

Lower bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

yscalemax#

Upper bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

alias of SignalObj

classmethod PARAMCLASS.create(title: str, xydata: numpy.ndarray, metadata: dict, annotations: str, xlabel: str, xunit: str, ylabel: str, yunit: str, autoscale: bool, xscalelog: bool, xscalemin: float, xscalemax: float, yscalelog: bool, yscalemin: float, yscalemax: float) sigima.objects.signal.object.SignalObj#

Returns a new instance of SignalObj with the fields set to the given values.

Parameters:
  • title (str) – Signal title. Default: β€˜Untitled’.

  • xydata (numpy.ndarray) – Default: None.

  • metadata (dict) – Default: {}.

  • annotations (str) – Default: β€˜β€™.

  • xlabel (str) – Title. Default: β€˜β€™.

  • xunit (str) – Default: β€˜β€™.

  • ylabel (str) – Title. Default: β€˜β€™.

  • yunit (str) – Default: β€˜β€™.

  • autoscale (bool) – Default: True.

  • xscalelog (bool) – Default: False.

  • xscalemin (float) – Lower bound. Default: None.

  • xscalemax (float) – Upper bound. Default: None.

  • yscalelog (bool) – Default: False.

  • yscalemin (float) – Lower bound. Default: None.

  • yscalemax (float) – Upper bound. Default: None.

Returns:

New instance of SignalObj.

IO_REGISTRY#

alias of SignalIORegistry

static get_roi_class() Type[SignalROI][source]#

Return ROI class

static get_roieditor_class() Type[SignalROIEditor][source]#

Return ROI editor class

get_newparam_from_current(newparam: NewSignalParam | None = None, title: str | None = None) NewSignalParam | None[source]#

Get new object parameters from the current object.

Parameters:
  • newparam (guidata.dataset.DataSet) – new object parameters. If None, create a new one.

  • title – new object title. If None, use the current object title, or the default title.

Returns:

New object parameters

new_object(param: NewSignalParam | None = None, edit: bool = False, add_to_panel: bool = True) SignalObj | None[source]#

Create a new object (signal).

Parameters:
  • param (guidata.dataset.DataSet) – new object parameters

  • edit (bool) – Open a dialog box to edit parameters (default: False). When False, the object is created with default parameters and creation parameters are stored in metadata for interactive editing.

  • add_to_panel (bool) – Add the new object to the panel (default: True)

Returns:

New object

toggle_anti_aliasing(state: bool) None[source]#

Toggle anti-aliasing on/off

Parameters:

state – state of the anti-aliasing

reset_curve_styles() None[source]#

Reset curve styles

Image panel#

class datalab.gui.panel.image.ImagePanel(parent: QW.QWidget, dockableplotwidget: DockablePlotWidget, panel_toolbar: QW.QToolBar)[source]#

Object handling the item list, the selected item properties and plot, specialized for Image objects

PARAMCLASS#

Image object

data#

Default: None.

Type:

guidata.dataset.dataitems.FloatArrayItem

metadata#

Default: {}.

Type:

guidata.dataset.dataitems.DictItem

annotations#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

is_uniform_coords#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

x0#

X0. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

y0#

Y0. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

dx#

Ξ”x. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

dy#

Ξ”y. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

xmin#

XMIN. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xmax#

XMAX. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

ymin#

YMIN. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

ymax#

YMAX. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xcoords#

X coordinates. Default: array([], dtype=float64).

Type:

guidata.dataset.dataitems.FloatArrayItem

ycoords#

Y coordinates. Default: array([], dtype=float64).

Type:

guidata.dataset.dataitems.FloatArrayItem

title#

Image title. Default: β€˜Untitled’.

Type:

guidata.dataset.dataitems.StringItem

xlabel#

Title. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

xunit#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

ylabel#

Title. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

yunit#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

zlabel#

Title. Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

zunit#

Default: β€˜β€™.

Type:

guidata.dataset.dataitems.StringItem

autoscale#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

xscalelog#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

xscalemin#

Lower bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xscalemax#

Upper bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

yscalelog#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

yscalemin#

Lower bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

yscalemax#

Upper bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

zscalemin#

Lower bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

zscalemax#

Upper bound. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

alias of ImageObj

classmethod PARAMCLASS.create(data: numpy.ndarray, metadata: dict, annotations: str, is_uniform_coords: bool, x0: float, y0: float, dx: float, dy: float, xmin: float, xmax: float, ymin: float, ymax: float, xcoords: numpy.ndarray, ycoords: numpy.ndarray, title: str, xlabel: str, xunit: str, ylabel: str, yunit: str, zlabel: str, zunit: str, autoscale: bool, xscalelog: bool, xscalemin: float, xscalemax: float, yscalelog: bool, yscalemin: float, yscalemax: float, zscalemin: float, zscalemax: float) sigima.objects.image.object.ImageObj#

Returns a new instance of ImageObj with the fields set to the given values.

Parameters:
  • data (numpy.ndarray) – Default: None.

  • metadata (dict) – Default: {}.

  • annotations (str) – Default: β€˜β€™.

  • is_uniform_coords (bool) – Default: True.

  • x0 (float) – X0. Default: 0.0.

  • y0 (float) – Y0. Default: 0.0.

  • dx (float) – Ξ”x. Default: 1.0.

  • dy (float) – Ξ”y. Default: 1.0.

  • xmin (float) – XMIN. Default: None.

  • xmax (float) – XMAX. Default: None.

  • ymin (float) – YMIN. Default: None.

  • ymax (float) – YMAX. Default: None.

  • xcoords (numpy.ndarray) – X coordinates. Default: array([], dtype=float64).

  • ycoords (numpy.ndarray) – Y coordinates. Default: array([], dtype=float64).

  • title (str) – Image title. Default: β€˜Untitled’.

  • xlabel (str) – Title. Default: β€˜β€™.

  • xunit (str) – Default: β€˜β€™.

  • ylabel (str) – Title. Default: β€˜β€™.

  • yunit (str) – Default: β€˜β€™.

  • zlabel (str) – Title. Default: β€˜β€™.

  • zunit (str) – Default: β€˜β€™.

  • autoscale (bool) – Default: True.

  • xscalelog (bool) – Default: False.

  • xscalemin (float) – Lower bound. Default: None.

  • xscalemax (float) – Upper bound. Default: None.

  • yscalelog (bool) – Default: False.

  • yscalemin (float) – Lower bound. Default: None.

  • yscalemax (float) – Upper bound. Default: None.

  • zscalemin (float) – Lower bound. Default: None.

  • zscalemax (float) – Upper bound. Default: None.

Returns:

New instance of ImageObj.

IO_REGISTRY#

alias of ImageIORegistry

static get_roi_class() Type[ImageROI][source]#

Return ROI class

static get_roieditor_class() Type[ImageROIEditor][source]#

Return ROI editor class

plot_lut_changed(plot: BasePlot) None[source]#

The LUT of the plot has changed: updating image objects accordingly

Parameters:

plot – Plot object

get_newparam_from_current(newparam: NewImageParam | None = None, title: str | None = None) NewImageParam | None[source]#

Get new object parameters from the current object.

Parameters:
  • newparam (guidata.dataset.DataSet) – new object parameters. If None, create a new one.

  • title – new object title. If None, use the current object title, or the default title.

Returns:

New object parameters

new_object(param: NewImageParam | None = None, edit: bool = False, add_to_panel: bool = True) ImageObj | None[source]#

Create a new object (image).

Parameters:
  • param (guidata.dataset.DataSet) – new object parameters

  • edit (bool) – Open a dialog box to edit parameters (default: False). When False, the object is created with default parameters and creation parameters are stored in metadata for interactive editing.

  • add_to_panel (bool) – Add the object to the panel (default: True)

Returns:

New object

toggle_show_contrast(state: bool) None[source]#

Toggle show contrast option

Macro panel#

class datalab.gui.panel.macro.MacroTabs(parent=None)[source]#

Macro tabwidget

Parameters:

parent (QWidget) – Parent widget

clear() None[source]#

Override Qt method

contextMenuEvent(event)[source]#

Override Qt method

add_tab(macro: Macro) int[source]#

Add tab

Parameters:

macro – Macro object

Returns:

Number of the tab (starting at 1)

Return type:

int

remove_tab(number: int) None[source]#

Remove tab

Parameters:

number – Number of the tab (starting at 1)

get_widget(number: int) CodeEditor[source]#

Return macro editor widget at number

Parameters:

number – Number of the tab (starting at 1)

Returns:

Macro editor widget

set_current_number(number: int) None[source]#

Set current tab number

Parameters:

number – Number of the tab (starting at 1)

get_current_number() int[source]#

Return current tab number

Returns:

Number of the tab (starting at 1)

Return type:

int

set_tab_title(number: int, name: str) None[source]#

Set tab title

Parameters:
  • number – Number of the tab (starting at 1)

  • name – Macro name

class datalab.gui.panel.macro.MacroPanel(parent: QMainWindow)[source]#

Macro Panel widget

Parameters:

parent (QWidget) – Parent widget

update_color_mode() None[source]#

Update color mode according to the current theme

get_serializable_name(obj: Macro) str[source]#

Return serializable name of object

serialize_to_hdf5(writer: NativeH5Writer) None[source]#

Serialize whole panel to a HDF5 file

Parameters:

writer – HDF5 writer

deserialize_from_hdf5(reader: NativeH5Reader, reset_all: bool = False) None[source]#

Deserialize whole panel from a HDF5 file

Parameters:
  • reader – HDF5 reader

  • reset_all – If True, preserve original UUIDs (workspace reload). If False, regenerate UUIDs (importing objects).

create_object() Macro[source]#

Create object.

Returns:

Macro object

add_object(obj: Macro) None[source]#

Add object.

Parameters:

obj – Macro object

remove_all_objects() None[source]#

Remove all objects

setup_actions() None[source]#

Setup macro menu actions

get_macro(number_or_title: int | str | None = None) Macro | None[source]#

Return macro at number (if number is None, return current macro)

Parameters:

number – Number of the macro (starting at 1) or title of the macro. Defaults to None (current macro).

Returns:

Macro object or None (if not found)

get_number_from_title(title: str) int | None[source]#

Return macro number from title

Parameters:

title – Title of the macro

Returns:

Number of the macro (starting at 1) or None (if not found)

get_number_from_macro(macro: Macro) int | None[source]#

Return macro number from macro object

Parameters:

macro – Macro object

Returns:

Number of the macro (starting at 1) or None (if not found)

get_macro_titles() list[str][source]#

Return list of macro titles

macro_contents_changed() None[source]#

One of the macro contents has changed

run_macro(number_or_title: int | str | None = None) None[source]#

Run current macro

Parameters:

number – Number of the macro (starting at 1). Defaults to None (run current macro, or does nothing if there is no macro).

stop_macro(number_or_title: int | str | None = None) None[source]#

Stop current macro

Parameters:

number – Number of the macro (starting at 1). Defaults to None (run current macro, or does nothing if there is no macro).

macro_state_changed(orig_macro: Macro, state: bool) None[source]#

Macro state has changed (True: started, False: stopped)

Parameters:
  • orig_macro – Macro object

  • state – State of the macro

add_macro() Macro[source]#

Add macro, optionally with name

Returns:

Macro object

macro_name_changed(name: str) None[source]#

Macro name has been changed

Parameters:

name – New name of the macro

rename_macro(number: int | None = None, title: str | None = None) None[source]#

Rename macro

Parameters:
  • number – Number of the macro (starting at 1). Defaults to None.

  • title – Title of the macro. Defaults to None.

export_macro_to_file(number_or_title: int | str | None = None, filename: str | None = None) None[source]#

Export macro to file

Parameters:
  • number_or_title – Number of the macro (starting at 1) or title of the macro. Defaults to None.

  • filename – Filename. Defaults to None.

Raises:

ValueError – If title is not found

import_macro_from_file(filename: str | None = None) int[source]#

Import macro from file

Parameters:

filename – Filename. Defaults to None.

Returns:

Number of the macro (starting at 1)

remove_macro(number_or_title: int | str | None = None) None[source]#

Remove macro

Parameters:

number_or_title – Number of the macro (starting at 1) or title of the macro. Defaults to None.