GUI
Module containing the Graphical User Interface (GUI) for Bob, including the layout, the interaction code and the plot code.
Bobgui
A graphical user interface for Bob.
- class qosst_bob.gui.bobgui.GUIHandler(window: Window)
A log handler to print the log in the console on the GUI.
Initialize the associated StreamHandler.
- emit(record: LogRecord)
Print the log.
- Parameters:
record (logging.LogRecord) – the log to print.
- qosst_bob.gui.bobgui.autoplot(bob: Bob, values: dict)
Iterate through all figures and actualise plot if autoplot is enabled for this figure.
- Parameters:
bob (Bob) – Bob object.
values (dict) – current values of the GUI.
- qosst_bob.gui.bobgui.change_enable_status(window: Window, content: QOSSTGUIContent | List[QOSSTGUIContent], disabled=False)
Change the enable status of content.
- Parameters:
window (sg.Window) – the window of the GUI.
content (Union[QOSSTGUIContent, List[QOSSTGUIContent]]) – a GUI object or a list of GUI object to set as either enabled or disabled.
disabled (bool, optional) – if True, the content is disabled. If False, the content is enabled. Defaults to False.
- qosst_bob.gui.bobgui.block_focus(window: Window)
Block focus on every button of the window. This is used for popups.
- Parameters:
window (sg.Window) – pysimplegui window.
- qosst_bob.gui.bobgui.popup_save_electronic_noise(location: str) Tuple[bool, str, str]
Open a popup for the saving of the electronic noise.
This popup will have two fields, that can be added to the data container of electronic noise: the name of the detector and a comment.
- Parameters:
location (str) – location where the data is going to be saved.
- Returns:
return True if the operation was not cancelled, and if not cancelled, the name of the detector and a comment.
- Return type:
Tuple[bool, str, str]
- qosst_bob.gui.bobgui.popup_save_electronic_shot_noise(location: str) Tuple[bool, str, float | None, str]
Open a popup for the saving of the electronic and shot noise.
This popup will have three fields, that can be added to the data container of electronic noise: the name of the detector, the power of the local oscillator and a comment.
- Parameters:
location (str) – location where the data is going to be saved.
- Returns:
return True if the operation was not cancelled, and if not cancelled, the name of the detector, the power and a comment.
- Return type:
Tuple[bool, str, Optional[float], str]
- qosst_bob.gui.bobgui._create_parser() ArgumentParser
Create the parser for the command line tool.
- Returns:
the created parser.
- Return type:
argparse.ArgumentParser
- qosst_bob.gui.bobgui.main()
Main entrypoint for the GUI.
Figures
Code to plots figures for the GUI.
The way it actually is done in the GUI:
This module provides code for every plot through a plot function that is a Callable[[Bob, Axes], None].
This modules also provide a class for the figure with the init and plot methods. The list of figure is then initialized, in particular giving its name and the function that should be called to actually do the plot.
This list will be imported in the layout to create as many tabs and autoplot checkboxes required.
This list will also be imported in the gui to detect the different events.
- qosst_bob.gui.figures.plot_temporal(bob: Bob | None, axes: Axes) None
Plot the acquired data as a function of time.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.plot_frequential(bob: Bob | None, axes: Axes) None
Plot the Power Spectral Density of the received data and, if available, of the shot noise and electronic noise.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.plot_fft(bob: Bob | None, axes: Axes) None
Plot the FFT of the acquired data.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.plot_tone(bob: Bob | None, axes: Axes) None
Plot the recovered tone.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.plot_quantum_data(bob: Bob | None, axes: Axes) None
Plot the uncorrected quantum data.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.plot_recovered(bob: Bob | None, axes: Axes) None
Plot the corrected quantum data.
- Parameters:
bob (Bob) – Bob object.
axes (Axes) – the axes where to plot the data.
- qosst_bob.gui.figures.draw_figure(canvas: Canvas, figure: Figure) FigureCanvasTkAgg
Creates and returns canvas to draw the figure on the GUI.
- Parameters:
canvas (sg.Canvas) – the canvas of the GUI.
figure (Figure) – the matplolib figure.
- Returns:
the tk canvas of the figure.
- Return type:
FigureCanvasTkAgg
- class qosst_bob.gui.figures.QOSSTBobGUIFigure(name: str, func: Callable[[Bob | None, Axes], None], default_autoplot: bool = False)
A class representing a GUI figure.
- Parameters:
name (str) – name of the figure.
func (Callable[[Bob, Axes], None]) – function to call to plot the figure.
default_autoplot (bool, optional) – default value of the autoplot checkbox.. Defaults to False.
- name: str
The name of the figure.
- key: str
The key of the figure.
- plot_key: str
The key of the plot button.
- save_key: str
The key of the save button.
- autoplot_key: str
The key of the autoplot checkbox.
- figure: Figure | None
The matoplotlib figures.
- axes: Axes | None
The matplotlib axes.
- canvas: FigureCanvasTkAgg | None
The canvas to display in the GUI.
- default_autoplot: bool
The default value of the autoplot checkbox.
- init_figure(window: Window)
Initialize the figure, the axes and make a dummy plot.
- Parameters:
window (sg.Window) – GUI window.
- save(path: PathLike)
Save figure to path.
- Parameters:
path (PathLike) – path to save the figure.
- qosst_bob.gui.figures.all_figures = [<qosst_bob.gui.figures.QOSSTBobGUIFigure object>, <qosst_bob.gui.figures.QOSSTBobGUIFigure object>, <qosst_bob.gui.figures.QOSSTBobGUIFigure object>, <qosst_bob.gui.figures.QOSSTBobGUIFigure object>, <qosst_bob.gui.figures.QOSSTBobGUIFigure object>, <qosst_bob.gui.figures.QOSSTBobGUIFigure object>]
List of all figures of the GUI.
Layout content
Enumerations of content in the GUI, and definition of some constants.
- qosst_bob.gui.layout_content.THEME = 'DarkGrey14'
The used theme.
- class qosst_bob.gui.layout_content.QOSSTGUIContent(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
A generic object for enumeration of content in the GUI.
- class qosst_bob.gui.layout_content.QOSSTGUIActions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enumeration of actions in the GUI (i.e. buttons).
- class qosst_bob.gui.layout_content.QOSSTGUIText(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enumerator of updatable text content in the GUI.
- class qosst_bob.gui.layout_content.QOSSTGUIInput(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enumeration of inputs (i.e. text input, checkboxes and selects) in the GUI.
Layout
Layout for Bob gui.