DAQ Viewer

This module is to be used to interface any detector. It will display hardware settings and display data as exported by the hardware plugins (see Emission of data). The default detector is a Mock one (a kind of software based detector generating data and useful to test the program development). Other detectors may be loaded as plugins, see Instrument Plugins. Introduction

This module has a generic interface comprised of a dockable panel related to the settings and one or more data viewer panels specific of the type of data to be acquired (see Plotting Data). For instance, Fig. 3.14 displays a typical DAQ_Viewer GUI with a settings dockable panel (left) and a 2D viewer on the right panel.

Viewer panel

Fig. 3.14 Typical DAQ_Viewer GUI with a dockable panel for settings (left) and a 2D data viewer on the right panel. Red, green and purple rectangles highlight respectively the toolbar, the initialization and hardware settings. Settings

The settings panel is comprised of 3 sections, the top one (red rectangle) displays a toolbar with buttons to grab/snap data, save them, open other settings sections and quit the application. Two types of settings can be shown/hidden: for hardware choice/initialization (green rectangle) and advanced settings to control the hardware/software (purple rectangle). Toolbar

Viewer panel

Fig. 3.15 DAQ_Viewer toolbar

The toolbar, Fig. 3.15 allows data acquisition and other actions as described below:

  • grab: Start a continuous grab of data. Detector must be initialized.

  • snap: Start a single grab (snap). Strongly advised for the first time data is acquired after initialization.

  • save: Save current data

  • snap&save: Do a new snap and then save the data

  • open: Load data previously saved with the save button

  • showsettings: Display or hide initialization and background settings

  • showsettings: Display or hide hardware/software advanced settings

  • quit: quit the application

  • log: open the log in a text editor

  • green_led: LED reflecting the data grabbed status (green when data has been taken) Hardware initialization

Viewer panel

Fig. 3.16 Hardware choice, initialization and background management

The second section, Fig. 3.16 allows the choice of the instrument plugin of type detector selection. They are subdivided by dimensionality of the data they are generating (DAQ2D for cameras, DAQ1D for waveforms, timeseries… and DAQ0D for detectors generating scalars such as powermeter, voltmeter…). Once selected, the ini_det button will start the initialization using eventual advanced settings. If the initialization is fine, the corresponding LED will turn green and you’ll be able to snap data or take background:

  • take_bkg: do a specific snap where the data will be internally saved as a background (and saved in a hdf5 file if you save data)

  • do_bkg: use the background previously snapped to correct the displayed (only displayed, saved data are still raw data) data.

The last section of the settings (purple rectangle) is a ParameterTree allowing advanced control of the UI and of the hardware. Main settings

Main settings refers to settings common to all instrument plugin. They are mostly related to the UI control.


Fig. 3.17 Typical DAQ_Viewer Main settings.

  • DAQ type: readonly string recalling the DAQ type used

  • Detector type: readonly string recalling the selected plugin

  • Detector Name: readonly string recalling the given name of the detector (from the preset)

  • Controller ID: integer used to deal with a controller controlling multiple hardware, see Multiple hardware from one controller

  • Show data and process: boolean for plotting (or not data in the data viewer)

  • Refresh time: integer used to slow down the refreshing of the display (but not of the eventual saving…)

  • Naverage: integer to set in order to do data averaging, see Hardware averaging.

  • Show averaging: in the case of software averaging (see Hardware averaging), if this is set to True, intermediate averaging data will be displayed

  • Live averaging: show averaging must be set to False. If set to True, a live grab will perform non-stop averaging (current averaging value will be displayed just below). Could be used to check how much one should average, then set Naverage to this value

  • Wait time (ms): Extra waiting time before sending data to viewer, can be used to cadence DAQ_Scan execution, or data logging

  • Continuous saving: useful for data logging. Will display new options below in order to set a h5 file to log live data, see Continuous Saving.

  • Overshoot options: useful to protect the experiment. If this is activated, then as soon as any value of the datas exported by this detector reaches the overshoot value, the module will throw a overshoot_signal (boolean PyQtSignal). The overshoot manager of the Dashboard generalize this feature (see Overshoot manager) by triggering actions on actuators if overshoot signals are detected. Other features related will soon be added (action triggered on a DAQ_Move, for instance a shutter on a laser beam)

  • Axis options: only valid for 2D detector. You can add labels, units, scaling and offset (with respect to pixels) to both x and y axis of the detector. Redundant with the plugin data export feature (see Emission of data) Data Viewers

Data Viewers presented in section Plotting Data are the one used to display data from detectors controlled from the DAQ_Viewer. By default, one viewer will be set with its type (0D, 1D, 2D, ND) depending on the detector main dimensionality (DAQ_type: DAQ0D, DAQ1D, DAQ2D…) but in fact the data viewers are set depending on the data exported from the detector plugin using the data_grabed_signal or data_grabed_signal_temp signals.

These two signals emit a list of DataFromPlugins objects. The length of this list will set the number of dedicated data viewers. In general one, but think about data from a Lockin amplifier generating an amplitude in volt and a phase in degrees. They are unrelated physical values better displayed in separated axes or viewers. The DataFromPlugins’s attribute dim (a string either equal to Data0D, Data1D, Data2D, DataND) will determine the data viewer type to set.

This code in a plugin

    DataFromPlugins(name='Mock1', data=data1, dim='Data0D'),
    DataFromPlugins(name='Mock2', data=data2, dim='Data2D')])

will trigger two separated viewers displaying respectively 0D data and 2D data. Other utilities

There are other functionalities that can be triggered in specific conditions. Among those, you’ll find:

  • The LCD screen to display 0D Data

  • The ROI_select button and ROI on a Viewer2D Saving data

Data saved from the DAQ_Viewer are data objects has described in What is PyMoDAQ’s Data? and their saving mechanism use one of the objects defined in Module Savers. There are three possibilities to save data within the DAQ_Viewer.

  • The first one is a direct one using the snapshots buttons to save current or new data from the detector, it uses a DetectorSaver object to do so. The private method triggering the saving is _save_data.

  • The second one is the continuous saving mode. It uses a DetectorEnlargeableSaver object to continuously save data within enlargeable arrays. Methods related to this are: append_data and _init_continuous_save

  • The third one is not used directly from the DAQ_Viewer but triggered by extensions such as the DAQ_Scan. Data are indexed within an already defined array using a DetectorExtendedSaver. Methods related to this are: insert_data and some code in the DAQ_Scan, see below.

for det in self.modules_manager.detectors:
    det.module_and_data_saver = module_saving.DetectorExtendedSaver(det, self.scan_shape)
self.module_and_data_saver.h5saver = self.h5saver  # will update its h5saver and all submodules's h5saver Snapshots

Datas saved directly from a DAQ_Viewer (for instance the one on Fig. 3.23) will be recorded in a h5file whose structure will be represented like Fig. 3.67 using PyMoDAQ’s h5 browser. Continuous Saving

When the continuous saving parameter is set, new parameters are appearing on the DAQ_Viewer panel (see Fig. 3.18). This is in fact the settings associated with the H5Saver object used under the hood, see H5Saver.

  • Base path: indicates where the data will be saved. If it doesn’t exist the module will try to create it

  • Base name: indicates the base name from which the save file will derive

  • Current Path: readonly, complete path of the saved file

  • Do Save: Initialize the file and logging can start. A new file is created if clicked again.

  • Compression options: data can be compressed before saving, using one of the proposed library and the given value of compression [0-9], see pytables documentation.


Fig. 3.18 Continuous Saving options

The saved file will follow this general structure:


With a base path (D:\Data in this case) followed by a subfolder year, a subfolder day and a filename formed from a base name followed by the date of the day and the time at which you started to log data. Fig. 3.19 displays the tree structure of such a file, with two nodes (prefixed as enlargeable, EnlData) and a navigation axis corresponding to the timestamps at the time of each snapshot taken once the continuous saving has been activated (ticking the Do Save checkbox)


Fig. 3.19 Continuous Saving options