Summary of the classes dealing with the DAQ_Viewer control module:
|
Main PyMoDAQ class to drive detectors |
|
Worker class to control the instrument plugin |
|
DAQ_Viewer user interface. |
8.1.2. DAQ_Viewer class
This documentation highlights the useful entry and output points that you may use in your applications.
- class pymodaq.control_modules.daq_viewer.DAQ_Viewer(parent=None, title='Testing', daq_type='DAQ0D', dock_settings=None, dock_viewer=None, **kwargs)[source]
Bases:
ParameterControlModuleMain PyMoDAQ class to drive detectors
Qt object and generic UI to drive actuators. The class is giving you full functionality to select (daq_detector), initialize detectors (init_hardware), grab or snap data (grab_data) and save them (save_new, save_current). If a DockArea is given as parent widget, the full User Interface (DAQ_Viewer_UI) is loaded allowing easy control of the instrument.
- grab_done_signal
Signal emitted when the data from the plugin (and eventually from the data viewers) has been received. To be used by connected objects.
- Type:
- custom_sig
use this to propagate info/data coming from the hardware plugin to another object
- Type:
- overshoot_signal
This signal is emitted when some 0D data from the plugin is higher than the overshoot threshold set in the settings
- Type:
See also
ControlModule,DAQ_Viewer_UI,ParameterManagerNotes
A particular signal from the 2D DataViewer is directly connected to the plugin: ROI_select_signal. The position and size of the corresponding ROI is then directly transferred to a plugin function named ROISelect that you have to create if one want to receive infos from the ROI
- Attributes:
- Naverage
bkgGet the background data object
current_dataGet the current data stored internally
daq_typeGet/Set the daq_type as a DAQTypesEnum
daq_typesList of available DAQ_TYPES as keys of the DAQTypesEnum
detectorstr: Get/Set the currently selected detector among available detectorsdetectorslistofstr: List of available detectors of the current daq_type (DAQTypesEnum)do_bkgbool: Get/Set if background subtraction should be donegrab_statebool: Get the current grabbing statusmasterGet/Set programmatically the Master/Slave status of a detector
viewer_dockslist of Viewer Docks from the UI
viewerslist: Get/Set the Viewers (instances of real implementation of ViewerBase class) from the UIviewers_dockslist of Viewer Docks from the UI, for back compatibility
Methods
append_data([dte, where])Appends current DataToExport to a DetectorTimeSaver
child_added(param, data)Adds a child in the settings attribute
connect_tcp_ip()daq_type_changed_from_ui(daq_type)Apply changes from the selection of a different DAQTypesEnum in the UI
Create axes scaling options depending on the ('main_settings', 'axes') settings
grab([send_to_tcpip])Launch a continuous grab
grab_data([grab_state, send_to_tcpip, ...])Generic method to grab or snap data from the selected (and initialized) detector
init_hardware([do_init])Init the selected detector
insert_data(indexes[, where, distribution])Insert DataToExport to a DetectorExtendedSaver at specified indexes
Opens a H5 file in the H5Browser module
param_deleted(param)Remove a child from the settings attribute
process_tcpip_cmds(status)Receive commands from the TCP Server (if connected) and process them
process_ui_cmds(cmd)Process commands sent by actions done in the ui
quit_fun()Quit the application, closing the hardware and other modules
Save current data into a h5file
save_new()Snap data and save them into a h5file
set_data_to_viewers(dte[, temp])Process data dimensionality and send appropriate data to their data viewers
setup_continuous_saving([init])Configure the objects dealing with the continuous saving mode
show_data(dte)Receive data from plugins and send them to their dedicated viewers
show_temp_data(data)Send data to their dedicated viewers but those will not emit processed data signal
snap([send_to_tcpip])Launch a single grab
snapshot([pathname, dosave, send_to_tcpip])Do one single grab (snap) and eventually save the data.
stop()Stop the current continuous grabbing
Stop the current continuous grabbing and unchecked the stop button of the UI
take_bkg()Do a snap and store data to be used as background into an attribute: self._bkg
thread_status(status)Get back info (using the ThreadCommand object) from the hardware
value_changed(param)ParameterManager subclassed method.
custom_sig
data_saved
detector_changed_from_ui
detectors_changed_from_ui
grab_done_signal
grab_status
overshoot_signal
update_plugin_config
- listener_class
alias of
ActorListener
- append_data(dte=None, where=None, **kwargs)[source]
Appends current DataToExport to a DetectorTimeSaver
Method to be used when performing continuous saving into a h5file (continuous mode or DAQ_Logger)
- Parameters:
dte (
DataToExport) – not really usedkwargs (
dict)
See also
DetectorTimeSaver
- child_added(param, data)[source]
Adds a child in the settings attribute
- Parameters:
param (
Parameter) – the parameter where child will be addeddata (
Parameter) – the child parameter
- daq_type_changed_from_ui(daq_type)[source]
Apply changes from the selection of a different DAQTypesEnum in the UI
- Parameters:
daq_type (
DAQTypesEnum)
- get_scaling_options()[source]
Create axes scaling options depending on the (‘main_settings’, ‘axes’) settings
- Return type:
Tuple[Axis]
- grab_data(grab_state=False, send_to_tcpip=False, snap_state=False)[source]
Generic method to grab or snap data from the selected (and initialized) detector
- init_hardware(do_init=True)[source]
Init the selected detector
- Parameters:
do_init (
bool) – If True, create a DAQ_Detector instance and move it into a separated thread, connected its signals/slots to the DAQ_Viewer object (self) If False, force the instrument to close and kill the Thread (still not done properly in some cases)
- insert_data(indexes, where=None, distribution=DataDistribution.uniform)[source]
Insert DataToExport to a DetectorExtendedSaver at specified indexes
Method to be used when saving into an already initialized array within a h5file (DAQ_Scan for instance)
- Parameters:
See also
DAQ_Scan,DetectorExtendedSaver
- param_deleted(param)[source]
Remove a child from the settings attribute
- Parameters:
param (
Parameter) – a given parameter whose value has been changed by user
- process_tcpip_cmds(status)[source]
Receive commands from the TCP Server (if connected) and process them
- Parameters:
status (
ThreadCommand) – Possible commands are: * ‘Send Data: to trigger a snapshot * ‘connected’: show that connection is ok * ‘disconnected’: show that connection is not OK * ‘Update_Status’: update a status command * ‘set_info’: receive settings from the server side and update them on this side
See also
connect_tcp_ip,TCPServer- Return type:
- process_ui_cmds(cmd)[source]
Process commands sent by actions done in the ui
See pymodaq.control_modules.thread_commands.UiToMainViewer
- Parameters:
cmd (
ThreadCommand) –- Possible values are:
init
quit
grab
snap
stop
show_log
detector_changed
daq_type_changed
save_current
save_new
do_bkg
take_bkg
viewers_changed
show_config
- set_data_to_viewers(dte, temp=False)[source]
Process data dimensionality and send appropriate data to their data viewers
- Parameters:
dte (
DataToExport)temp (
bool) – if True notify the data viewers to display data as temporary (meaning not exporting processed data from roi)
See also
ViewerBase,Viewer0D,Viewer1D,Viewer2D
- setup_continuous_saving(init=True)[source]
Configure the objects dealing with the continuous saving mode
- show_data(dte)[source]
Receive data from plugins and send them to their dedicated viewers
Slot receiving data from plugins emitted with the data_grabed_signal Process the data as specified in the settings, display them into the dedicated data viewers depending on the settings:
create a container (DataToExport _data_to_save_export) with info from this DAQ_Viewer (title), a timestamp…
call _process_data
do background subtraction if any
check refresh time (if set in the settings) to send or not data to data viewers
either send to the data viewers (if refresh time is ok and/or show data option in settings is set)
- either
send grab_done_signal (to the slot _save_export_data ) to save the data
- Parameters:
dte (
DataToExport)
See also
_init_show_data,_process_data
- show_temp_data(data)[source]
Send data to their dedicated viewers but those will not emit processed data signal
Slot receiving data from plugins emitted with the data_grabed_signal_temp
- Parameters:
data (
DataToExport)
- snapshot(pathname=None, dosave=False, send_to_tcpip=False)[source]
Do one single grab (snap) and eventually save the data.
- stop_grab()[source]
Stop the current continuous grabbing and unchecked the stop button of the UI
See also
- take_bkg()[source]
Do a snap and store data to be used as background into an attribute: self._bkg
The content of the bkg will be saved if data is further saved with do_bkg property set to True
- thread_status(status)[source]
Get back info (using the ThreadCommand object) from the hardware
And re-emit this ThreadCommand using the custom_sig signal if it should be used in a higher level module
Commands valid for all control modules are defined in the parent class, here are described only the specific ones
- Parameters:
status (
ThreadCommand) –- The info returned from the hardware, the command (str) can be either:
ini_detector: update the status with “detector initialized” value and init state if attribute not null.
grab : emit grab_status(True)
grab_stopped: emit grab_status(False)
init_lcd: display a LCD panel
lcd: display on the LCD panel, the content of the attribute
stop: stop the grab
- value_changed(param)[source]
ParameterManager subclassed method. Process events from value changed by user in the UI Settings
- Parameters:
param (
Parameter) – a given parameter whose value has been changed by user
- property bkg: DataToExport
Get the background data object
- property current_data: DataToExport
Get the current data stored internally
- property daq_type: DAQTypesEnum
Get/Set the daq_type as a DAQTypesEnum
Update the detector property with the list of available detectors of a given daq_type
- property viewers: List[ViewerBase]
Get/Set the Viewers (instances of real implementation of ViewerBase class) from the UI
- Type:
8.1.3. DAQ_Detector class
The Detector class is an object leaving in the plugin thread and responsible for the communication between DAQ_Viewer and the plugin itself
- class pymodaq.control_modules.daq_viewer.DAQ_Detector(title, settings_parameter, detector_name)[source]
Worker class to control the instrument plugin
- detector
- Type:
real instanceofthe instrument plugin class
- controller
wrapper object used to control a given instrument in the instrument plugin
- Type:
DAQ_Viewer_base
- controller_adress
unique integer used to identify a controller shared among multiple instrument plugins
- Type:
- Attributes:
- title
Methods
close()Call the close method of the instrument plugin class
data_ready(data)Process the data received from the instrument plugin class
emit_temp_data(data)Convenience method to export temporary data using the data_detector_temp_sig Signal
grab_data([Naverage, live])General method to grab data from the instrument plugin class
ini_detector([params_state, controller])Initialize an instrument plugin class and tries to apply preset settings
queue_command(command)Transfer command from the main module to the hardware module
single([Naverage])Convenience function to grab a single set of data
update_settings(settings_parameter_dict)Apply a Parameter serialized as a dict to the instrument plugin class or to self
data_detector_sig
data_detector_temp_sig
status_sig
- data_ready(data)[source]
Process the data received from the instrument plugin class
Processing here is eventual software averaging if it was not possible in the instrument plugin class
- Parameters:
data (
DataToExport)
- emit_temp_data(data)[source]
Convenience method to export temporary data using the data_detector_temp_sig Signal
- Parameters:
data (
DataToExport)
- grab_data(Naverage=1, live=True, **kwargs)[source]
General method to grab data from the instrument plugin class
Will check if the plugin class can do hardware averaging (if NAverage > 1) and and live_mode, otherwise do both software wise here
- ini_detector(params_state=None, controller=None)[source]
Initialize an instrument plugin class and tries to apply preset settings
When the instrument is initialized from the Dashboard using a Preset, tries to apply the preset settings to the instrument instance
- Parameters:
params_state (
dict)controller (
wrapper)
- queue_command(command)[source]
Transfer command from the main module to the hardware module
- Parameters:
command (
ThreadCommand) – The specific (or generic) command (str) to pass to the hardware, either: * ini_detector * close * grab * single * stop_grab * stop_all * update_scanner * move_at_navigator * update_wait_time * get_axis * any string that the hardware is able to understand
- single(Naverage=1, *args, **kwargs)[source]
Convenience function to grab a single set of data
- Parameters:
Naverage (
int) – The number of data to average before displayingkwargs (
optional named arguments)
- update_settings(settings_parameter_dict)[source]
Apply a Parameter serialized as a dict to the instrument plugin class or to self
- Parameters:
settings_parameter_dict (
dict) – dictionary serializing a Parameter object
Examples
If the parameter is of the form (‘detector_settings’, ‘xxx’) then the parameter is sent to the instrument plugin class.
8.1.4. The Viewer UI class
This object is the User Interface of the DAQ_Viewer, allowing easy access to all of the DAQ_Viewer functionnalities in a generic interface.
- class pymodaq.control_modules.daq_viewer_ui.DAQ_Viewer_UI(parent, title='DAQ_Viewer', daq_type='DAQ2D', dock_settings=None, dock_viewer=None)[source]
DAQ_Viewer user interface.
This class manages the UI and emit dedicated signals depending on actions from the user
- command_sig
This signal is emitted whenever some actions done by the user has to be applied on the main module. Possible commands are:
init
quit
grab
snap
stop
show_log
detector_changed
daq_type_changed
save_current
save_new
- Type:
See also
pymodaq.utils.daq_utils.ThreadCommand- Attributes:
- daq_type
- daq_types
- data_ready
- detector
detector_initbool: the status of the init LED.
- detectors
Methods
connect_things()do_grab([do_grab])Programmatically press the Grab button API entry :type do_grab:
bool:param do_grab: will fire the Init button depending on the argument value and the button check state :type do_grab:booldo_init([do_init])Programmatically press the Init button API entry :type do_init:
bool:param do_init: will fire the Init button depending on the argument value and the button check state :type do_init:booldo_snap()Programmatically press the Snap button API entry
do_stop()Programmatically press the Stop button API entry
send_init(checked)setup_actions()setup_docks()update_viewers(viewers_type)add_setting_tree
close
command_sig
show_controls
show_settings
- do_grab(do_grab=True)[source]
Programmatically press the Grab button API entry :type do_grab:
bool:param do_grab: will fire the Init button depending on the argument value and the button check state :type do_grab:bool