2.2.2.2. 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.
2.2.2.2.1. 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. 2.11 displays a typical DAQ_Viewer GUI with a settings dockable panel (left) and a 2D viewer on the right panel.
2.2.2.2.2. 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).
2.2.2.2.2.1. Toolbar
The toolbar, Fig. 2.12 allows data acquisition and other actions as described below:
2.2.2.2.2.2. Hardware initialization
The second section, Fig. 2.13 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 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:
: do a specific snap where the data will be internally saved as a background (and saved in a hdf5 file if you save data)
: 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.
2.2.2.2.2.3. Main settings
Main settings refers to settings common to all instrument plugin. They are mostly related to the UI control.
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 displayedLive averaging: show averaging must be set to
False
. If set toTrue
, a livegrab
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 valueWait 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)
2.2.2.2.3. 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
self.data_grabed_signal.emit([
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.
2.2.2.2.4. 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
2.2.2.2.5. 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 theDAQ_Scan
. Data are indexed within an already defined array using aDetectorExtendedSaver
. Methods related to this are:insert_data
and some code in theDAQ_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
2.2.2.2.5.1. Snapshots
Datas saved directly from a DAQ_Viewer (for instance the one on Fig. 2.20) will be recorded in a h5file whose structure will be represented like Fig. 4.4 using PyMoDAQ’s h5 browser.
2.2.2.2.5.2. Continuous Saving
When the continuous saving parameter is set, new parameters are appearing on the DAQ_Viewer panel
(see Fig. 2.15). 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.
The saved file will follow this general structure:
D:\Data\2018\20181220\Data_20181220_16_58_48.h5
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. 2.16 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)