# Windows classes

class pymeasure.display.windows.managed_image_window.ManagedImageWindow(procedure_class, x_axis, y_axis, z_axis=None, **kwargs)

  Bases: `ManagedWindow`

  Display experiment output with an `ImageWidget` class.

  Parameters:

    - procedure_class – procedure class describing the experiment (see `Procedure`)

    - x_axis – the data-column for the x-axis of the plot, cannot be changed afterwards for the image-plot

    - y_axis – the data-column for the y-axis of the plot, cannot be changed afterwards for the image-plot

    - z_axis – the initial data-column for the z-axis of the plot, can be changed afterwards

    - **kwargs – optional keyword arguments that will be passed to `ManagedWindow`

class pymeasure.display.windows.managed_window.ManagedWindow(procedure_class, x_axis=None, y_axis=None, linewidth=1, log_fmt=None, log_datefmt=None, **kwargs)

  Bases: `ManagedWindowBase`

  Display experiment output with an `PlotWidget` class.

  See also

  Tutorial Using the ManagedWindow

    A tutorial and example on the basic configuration and usage of ManagedWindow.

  Parameters:

    - procedure_class – procedure class describing the experiment (see `Procedure`)

    - x_axis – the initial data-column for the x-axis of the plot

    - y_axis – the initial data-column for the y-axis of the plot

    - linewidth – linewidth for the displayed curves, default is 1

    - log_fmt – formatting string for the log-widget

    - log_datefmt – formatting string for the date in the log-widget

    - **kwargs – optional keyword arguments that will be passed to `ManagedWindowBase`

class pymeasure.display.windows.managed_window.ManagedWindowBase(procedure_class, widget_list=(), inputs=(), displays=(), log_channel='', log_level=20, parent=None, sequencer=False, sequencer_inputs=None, sequence_file=None, inputs_in_scrollarea=False, enable_file_input=True, hide_groups=True)

  Bases: `QMainWindow`

  Base class for GUI experiment management .

  The ManagedWindowBase provides an interface for inputting experiment parameters, running several experiments (`Procedure`), plotting result curves, and listing the experiments conducted during a session.

  The ManagedWindowBase uses a Manager to control Workers in a Queue, and provides a simple interface. The `queue()` method must be overridden by the child class.

  The ManagedWindowBase allow user to define a set of widget that display information about the experiment. The information displayed may include: plots, tabular view, logging information,…

  This class is not intended to be used directly, but it should be subclassed to provide some appropriate widget list. Example of classes usable as element of widget list are:

  - `LogWidget`

  - `PlotWidget`

  - `ImageWidget`

  Of course, users can define its own widget making sure that inherits from `TabWidget`.

  Examples of ready to use classes inherited from ManagedWindowBase are:

  - `ManagedWindow`

  - `ManagedImageWindow`

  See also

  Tutorial Using the ManagedWindow

    A tutorial and example on the basic configuration and usage of ManagedWindow.

  Parameters for `__init__` constructor.

  Parameters:

    - procedure_class – procedure class describing the experiment (see `Procedure`)

    - widget_list – list of widget to be displayed in the GUI

    - inputs – list of `Parameter` instance variable names, which the display will generate graphical fields for

    - displays – list of `Parameter` instance variable names displayed in the browser window

    - log_channel – `logging.Logger` instance to use for logging output

    - log_level – logging level

    - parent – Parent widget or `None`

    - sequencer – a boolean stating whether or not the sequencer has to be included into the window

    - sequencer_inputs – either `None` or a list of the parameter names to be scanned over. If no list of parameters is given, the parameters displayed in the manager queue are used.

    - sequence_file – simple text file to quickly load a pre-defined sequence with the `Load sequence` button

    - inputs_in_scrollarea – boolean that display or hide a scrollbar to the input area

    - enable_file_input – a boolean controlling whether a `FileInputWidget` to specify where the experiment’s result will be saved is displayed (True, default) or not (False). This widget contains a field to enter the (base of the) filename (with or without extension; if absent, the extension will be appended). This field also allows for placeholders to use parameter-values and metadata-value in the filename. The widget also has a field to select the directory where the file is to be stored, and a toggle to control whether the data should be saved to the selected file, or not (i.e., to a temporary file instead).

    - hide_groups – a boolean controlling whether parameter groups are hidden (True, default) or disabled/grayed-out (False) when the group conditions are not met.

  open_file_externally(filename)

    Method to open the datafile using an external editor or viewer. Uses the default application to open a datafile of this filetype, but can be overridden by the child class in order to open the file in another application of choice.

  queue(procedure=None)

    Queue a measurement based on the parameters in the input-widget.

    Semi-abstract method, which must be overridden by the child class if the filename- and directory-inputs are disabled. When filename- and directory inputs are enabled, overwriting is not required, but can be done for custom naming, input processing, or other features.

    Implementations must call `self.manager.queue(experiment)` and pass an `experiment` (`Experiment`) object which contains the `Results` and `Procedure` to be run.

    The optional procedure argument is not required for a basic implementation, but is required when the `SequencerWidget` is used.

    For example:

        def queue(self):
            filename = unique_filename('results', prefix="data") # from pymeasure.experiment

            procedure = self.make_procedure() # Procedure class was passed at construction
            results = Results(procedure, filename)
            experiment = self.new_experiment(results)

            self.manager.queue(experiment)

  save_experiment_copy(source_filename)

    Save a copy of the datafile to a selected folder and file. Primarily useful for experiments that are stored in a temporary file.

  set_parameters(parameters)

    This method should be overwritten by the child class. The parameters argument is a dictionary of Parameter objects. The Parameters should overwrite the GUI values so that a user can click “Queue” to capture the same parameters.

class pymeasure.display.windows.plotter_window.PlotterWindow(plotter, refresh_time=0.1, linewidth=1, parent=None)

  Bases: `QMainWindow`

  A window for plotting experiment results. Should not be instantiated directly, but only via the `Plotter` class.

  See also

  Tutorial Using the Plotter A tutorial and example code for using the Plotter and PlotterWindow.

  check_stop()

    Checks if the Plotter should stop and exits the Qt main loop if so

class pymeasure.display.windows.managed_dock_window.ManagedDockWindow(procedure_class, x_axis=None, y_axis=None, linewidth=1, log_fmt=None, log_datefmt=None, **kwargs)

  Bases: `ManagedWindowBase`

  Display experiment output with multiple docking windows with `DockWidget` class.

  Parameters:

    - procedure_class – procedure class describing the experiment (see `Procedure`)

    - x_axis – the data column(s) for the x-axis of the plot. This may be a string or a list of strings from the data columns of the procedure. The list length determines the number of plots

    - y_axis – the data column(s) for the y-axis of the plot. This may be a string or a list of strings from the data columns of the procedure. The list length determines the number of plots

    - linewidth – linewidth for the displayed curves, default is 1

    - log_fmt – formatting string for the log-widget

    - log_datefmt – formatting string for the date in the log-widget

    - **kwargs – optional keyword arguments that will be passed to `ManagedWindowBase`