Main window#
The cdl.core.gui.main
module provides the main window of the
DataLab (CDL) project.
- class cdl.core.gui.main.CDLMainWindow(console=None, hide_on_close=False)[source]#
DataLab main window
- Parameters:
console β enable internal console
hide_on_close β True to hide window on close
- static xmlrpc_server_started(port)[source]#
XML-RPC server has started, writing comm port in configuration file
- get_group_titles_with_object_infos() tuple[list[str], list[list[str]], list[list[str]]] [source]#
Return groups titles and lists of inner objects uuids and titles.
- Returns:
groups titles, lists of inner objects uuids and titles
- Return type:
Tuple
- get_object_titles(panel: str | None = None) list[str] [source]#
Get object (signal/image) list for current panel. Objects are sorted by group number and object index in group.
- Parameters:
panel β panel name (valid values: βsignalβ, βimageβ, βmacroβ). If None, current data panel is used (i.e. signal or image panel).
- Returns:
List of object titles
- Raises:
ValueError β if panel is unknown
- get_object(nb_id_title: int | str | None = None, panel: str | None = None) SignalObj | ImageObj [source]#
Get object (signal/image) from index.
- get_object_uuids(panel: str | None = None) list[str] [source]#
Get object (signal/image) uuid list for current panel. Objects are sorted by group number and object index in group.
- Parameters:
panel (str | None) β panel name (valid values: βsignalβ, βimageβ). If None, current panel is used.
- Returns:
list of object uuids
- Return type:
- Raises:
ValueError β if panel is unknown
- get_sel_object_uuids(include_groups: bool = False) list[str] [source]#
Return selected objects uuids.
- Parameters:
include_groups β If True, also return objects from selected groups.
- Returns:
List of selected objects uuids.
- select_objects(selection: list[int | str], panel: str | None = None) None [source]#
Select objects in current panel.
- Parameters:
selection β List of object numbers (1 to N) or uuids to select
panel β panel name (valid values: βsignalβ, βimageβ). If None, current panel is used. Defaults to None.
- select_groups(selection: list[int | str] | None = None, panel: str | None = None) None [source]#
Select groups in current panel.
- Parameters:
selection β List of group numbers (1 to N), or list of group uuids, or None to select all groups. Defaults to None.
panel (str | None) β panel name (valid values: βsignalβ, βimageβ). If None, current panel is used. Defaults to None.
- delete_metadata(refresh_plot: bool = True, keep_roi: bool = False) None [source]#
Delete metadata of selected objects
- Parameters:
refresh_plot β Refresh plot. Defaults to True.
keep_roi β Keep ROI. Defaults to False.
- get_object_shapes(nb_id_title: int | str | None = None, panel: str | None = None) list [source]#
Get plot item shapes associated to object (signal/image).
- Parameters:
nb_id_title β Object number, or object id, or object title. Defaults to None (current object).
panel β Panel name. Defaults to None (current panel).
- Returns:
List of plot item shapes
- add_annotations_from_items(items: list, refresh_plot: bool = True, panel: str | None = None) None [source]#
Add object annotations (annotation plot items).
- add_label_with_title(title: str | None = None, panel: str | None = None) None [source]#
Add a label with object title on the associated plot
- run_macro(number_or_title: int | str | None = None) None [source]#
Run 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 macro.
- Parameters:
number β Number of the macro (starting at 1). Defaults to None (stop current macro, or does nothing if there is no macro).
- import_macro_from_file(filename: str) None [source]#
Import macro from file
- Parameters:
filename β Filename.
- property panels: tuple[AbstractPanel, ...]#
Return the tuple of implemented panels (signal, image)
- Returns:
tuple of panels
- Return type:
- confirm_memory_state() bool [source]#
Check memory warning state and eventually show a warning dialog
- Returns:
True if memory state is ok
- Return type:
Take menu screenshots
- setup(console: bool = False) None [source]#
Setup main window
- Parameters:
console β True to setup console
- set_process_isolation_enabled(state: bool) None [source]#
Enable/disable process isolation
- Parameters:
state (bool) β True to enable process isolation
- get_current_panel() str [source]#
Return current panel name
- Returns:
panel name (valid values: βsignalβ, βimageβ, βmacroβ)
- Return type:
- set_current_panel(panel: str) None [source]#
Switch to panel.
- Parameters:
panel (str) β panel name (valid values: βsignalβ, βimageβ, βmacroβ)
- Raises:
ValueError β unknown panel
- calc(name: str, param: DataSet | None = None) None [source]#
Call compute function
name
in current panelβs processor.- Parameters:
name β Compute function name
param β Compute function parameter. Defaults to None.
- Raises:
ValueError β unknown function
- toggle_show_titles(state: bool) None [source]#
Toggle show annotations option
- Parameters:
state β state
- toggle_auto_refresh(state: bool) None [source]#
Toggle auto refresh option
- Parameters:
state β state
- toggle_show_first_only(state: bool) None [source]#
Toggle show first only option
- Parameters:
state β state
- open_h5_files(h5files: list[str] | None = None, import_all: bool | None = None, reset_all: bool | None = None) None [source]#
Open a DataLab HDF5 file or import from any other HDF5 file.
- import_h5_file(filename: str, reset_all: bool | None = None) None [source]#
Import HDF5 file into DataLab
- load_from_files(filenames: list[str]) None [source]#
Open objects from files in current panel (signals/images)
- Parameters:
filenames β list of filenames
- add_signal(title: str, xdata: ndarray, ydata: ndarray, xunit: str | None = None, yunit: str | None = None, xlabel: str | None = None, ylabel: str | None = None) bool [source]#
Add signal data to DataLab.
- Parameters:
title (str) β Signal title
xdata (numpy.ndarray) β X data
ydata (numpy.ndarray) β Y data
xunit (str | None) β X unit. Defaults to None.
yunit (str | None) β Y unit. Defaults to None.
xlabel (str | None) β X label. Defaults to None.
ylabel (str | None) β Y label. Defaults to None.
- Returns:
True if signal was added successfully, False otherwise
- Return type:
- Raises:
ValueError β Invalid xdata dtype
ValueError β Invalid ydata dtype
- add_image(title: str, data: ndarray, xunit: str | None = None, yunit: str | None = None, zunit: str | None = None, xlabel: str | None = None, ylabel: str | None = None, zlabel: str | None = None) bool [source]#
Add image data to DataLab.
- Parameters:
title (str) β Image title
data (numpy.ndarray) β Image data
xunit (str | None) β X unit. Defaults to None.
yunit (str | None) β Y unit. Defaults to None.
zunit (str | None) β Z unit. Defaults to None.
xlabel (str | None) β X label. Defaults to None.
ylabel (str | None) β Y label. Defaults to None.
zlabel (str | None) β Z label. Defaults to None.
- Returns:
True if image was added successfully, False otherwise
- Return type:
- Raises:
ValueError β Invalid data dtype