18.104.22.168. 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.
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 Data Viewers). 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.
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).
The toolbar, Fig. 3.15 allows data acquisition and other actions as described below:
22.214.171.124.2.2. Hardware initialization
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 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:
The last section of the settings (purple rectangle) is a ParameterTree allowing advanced control of the UI and of the hardware.
126.96.36.199.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 displayed
Live averaging: show averaging must be set to
False. If set to
True, a live
grabwill 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)
188.8.131.52.3. Data Viewers
Data Viewers presented in section Data Viewers 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.
184.108.40.206.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
220.127.116.11.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
DetectorSaverobject to do so. The private method triggering the saving is
The second one is the continuous saving mode. It uses a
DetectorEnlargeableSaverobject to continuously save data within enlargeable arrays. Methods related to this are:
The third one is not used directly from the
DAQ_Viewerbut 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_dataand 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
18.104.22.168.5.2. 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,
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:
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)