pymodaq 5.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. pymodaq/__init__.py +98 -0
  2. pymodaq/control_modules/__init__.py +1 -0
  3. pymodaq/control_modules/daq_move.py +1238 -0
  4. pymodaq/control_modules/daq_move_ui/__init__.py +0 -0
  5. pymodaq/control_modules/daq_move_ui/factory.py +48 -0
  6. pymodaq/control_modules/daq_move_ui/ui_base.py +359 -0
  7. pymodaq/control_modules/daq_move_ui/uis/__init__.py +0 -0
  8. pymodaq/control_modules/daq_move_ui/uis/binary.py +139 -0
  9. pymodaq/control_modules/daq_move_ui/uis/original.py +120 -0
  10. pymodaq/control_modules/daq_move_ui/uis/relative.py +124 -0
  11. pymodaq/control_modules/daq_move_ui/uis/simple.py +126 -0
  12. pymodaq/control_modules/daq_viewer.py +1517 -0
  13. pymodaq/control_modules/daq_viewer_ui.py +407 -0
  14. pymodaq/control_modules/mocks.py +57 -0
  15. pymodaq/control_modules/move_utility_classes.py +1141 -0
  16. pymodaq/control_modules/thread_commands.py +137 -0
  17. pymodaq/control_modules/ui_utils.py +72 -0
  18. pymodaq/control_modules/utils.py +591 -0
  19. pymodaq/control_modules/viewer_utility_classes.py +670 -0
  20. pymodaq/daq_utils/__init__.py +0 -0
  21. pymodaq/daq_utils/daq_utils.py +6 -0
  22. pymodaq/dashboard.py +2396 -0
  23. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.aliases +3 -0
  24. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.lvlps +3 -0
  25. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.lvproj +32 -0
  26. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.vi +0 -0
  27. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Server_1Dgaussian.vi +0 -0
  28. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Server_2Dgaussian.vi +0 -0
  29. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_cmd.vi +0 -0
  30. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_float.vi +0 -0
  31. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_int.vi +0 -0
  32. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_data.vi +0 -0
  33. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_int.vi +0 -0
  34. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_scalar.vi +0 -0
  35. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_string.vi +0 -0
  36. pymodaq/examples/Labview_TCP_Client/client_state.ctl +0 -0
  37. pymodaq/examples/Labview_TCP_Client/cmd_types.ctl +0 -0
  38. pymodaq/examples/__init__.py +0 -0
  39. pymodaq/examples/function_plotter.py +160 -0
  40. pymodaq/examples/nonlinearscanner.py +126 -0
  41. pymodaq/examples/qt_less_standalone_module.py +165 -0
  42. pymodaq/examples/tcp_client.py +97 -0
  43. pymodaq/extensions/__init__.py +25 -0
  44. pymodaq/extensions/adaptive/__init__.py +2 -0
  45. pymodaq/extensions/adaptive/adaptive_optimization.py +179 -0
  46. pymodaq/extensions/adaptive/loss_function/_1d_loss_functions.py +73 -0
  47. pymodaq/extensions/adaptive/loss_function/_2d_loss_functions.py +73 -0
  48. pymodaq/extensions/adaptive/loss_function/__init__.py +3 -0
  49. pymodaq/extensions/adaptive/loss_function/loss_factory.py +110 -0
  50. pymodaq/extensions/adaptive/utils.py +123 -0
  51. pymodaq/extensions/bayesian/__init__.py +2 -0
  52. pymodaq/extensions/bayesian/acquisition/__init__.py +2 -0
  53. pymodaq/extensions/bayesian/acquisition/acquisition_function_factory.py +80 -0
  54. pymodaq/extensions/bayesian/acquisition/base_acquisition_function.py +105 -0
  55. pymodaq/extensions/bayesian/bayesian_optimization.py +143 -0
  56. pymodaq/extensions/bayesian/utils.py +180 -0
  57. pymodaq/extensions/console.py +73 -0
  58. pymodaq/extensions/daq_logger/__init__.py +1 -0
  59. pymodaq/extensions/daq_logger/abstract.py +52 -0
  60. pymodaq/extensions/daq_logger/daq_logger.py +519 -0
  61. pymodaq/extensions/daq_logger/db/__init__.py +0 -0
  62. pymodaq/extensions/daq_logger/db/db_logger.py +300 -0
  63. pymodaq/extensions/daq_logger/db/db_logger_models.py +100 -0
  64. pymodaq/extensions/daq_logger/h5logging.py +84 -0
  65. pymodaq/extensions/daq_scan.py +1218 -0
  66. pymodaq/extensions/daq_scan_ui.py +241 -0
  67. pymodaq/extensions/data_mixer/__init__.py +0 -0
  68. pymodaq/extensions/data_mixer/daq_0Dviewer_DataMixer.py +97 -0
  69. pymodaq/extensions/data_mixer/data_mixer.py +262 -0
  70. pymodaq/extensions/data_mixer/model.py +108 -0
  71. pymodaq/extensions/data_mixer/models/__init__.py +0 -0
  72. pymodaq/extensions/data_mixer/models/equation_model.py +91 -0
  73. pymodaq/extensions/data_mixer/models/gaussian_fit_model.py +65 -0
  74. pymodaq/extensions/data_mixer/parser.py +53 -0
  75. pymodaq/extensions/data_mixer/utils.py +23 -0
  76. pymodaq/extensions/h5browser.py +9 -0
  77. pymodaq/extensions/optimizers_base/__init__.py +0 -0
  78. pymodaq/extensions/optimizers_base/optimizer.py +1016 -0
  79. pymodaq/extensions/optimizers_base/thread_commands.py +22 -0
  80. pymodaq/extensions/optimizers_base/utils.py +427 -0
  81. pymodaq/extensions/pid/__init__.py +16 -0
  82. pymodaq/extensions/pid/actuator_controller.py +14 -0
  83. pymodaq/extensions/pid/daq_move_PID.py +154 -0
  84. pymodaq/extensions/pid/pid_controller.py +1016 -0
  85. pymodaq/extensions/pid/utils.py +189 -0
  86. pymodaq/extensions/utils.py +111 -0
  87. pymodaq/icon.ico +0 -0
  88. pymodaq/post_treatment/__init__.py +6 -0
  89. pymodaq/post_treatment/load_and_plot.py +352 -0
  90. pymodaq/resources/__init__.py +0 -0
  91. pymodaq/resources/config_template.toml +57 -0
  92. pymodaq/resources/preset_default.xml +1 -0
  93. pymodaq/resources/setup_plugin.py +73 -0
  94. pymodaq/splash.png +0 -0
  95. pymodaq/utils/__init__.py +0 -0
  96. pymodaq/utils/array_manipulation.py +6 -0
  97. pymodaq/utils/calibration_camera.py +180 -0
  98. pymodaq/utils/chrono_timer.py +203 -0
  99. pymodaq/utils/config.py +53 -0
  100. pymodaq/utils/conftests.py +5 -0
  101. pymodaq/utils/daq_utils.py +158 -0
  102. pymodaq/utils/data.py +128 -0
  103. pymodaq/utils/enums.py +6 -0
  104. pymodaq/utils/exceptions.py +38 -0
  105. pymodaq/utils/gui_utils/__init__.py +10 -0
  106. pymodaq/utils/gui_utils/loader_utils.py +75 -0
  107. pymodaq/utils/gui_utils/utils.py +18 -0
  108. pymodaq/utils/gui_utils/widgets/lcd.py +8 -0
  109. pymodaq/utils/h5modules/__init__.py +2 -0
  110. pymodaq/utils/h5modules/module_saving.py +526 -0
  111. pymodaq/utils/leco/__init__.py +25 -0
  112. pymodaq/utils/leco/daq_move_LECODirector.py +217 -0
  113. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +163 -0
  114. pymodaq/utils/leco/director_utils.py +74 -0
  115. pymodaq/utils/leco/leco_director.py +166 -0
  116. pymodaq/utils/leco/pymodaq_listener.py +364 -0
  117. pymodaq/utils/leco/rpc_method_definitions.py +43 -0
  118. pymodaq/utils/leco/utils.py +74 -0
  119. pymodaq/utils/logger.py +6 -0
  120. pymodaq/utils/managers/__init__.py +0 -0
  121. pymodaq/utils/managers/batchscan_manager.py +346 -0
  122. pymodaq/utils/managers/modules_manager.py +589 -0
  123. pymodaq/utils/managers/overshoot_manager.py +242 -0
  124. pymodaq/utils/managers/preset_manager.py +229 -0
  125. pymodaq/utils/managers/preset_manager_utils.py +262 -0
  126. pymodaq/utils/managers/remote_manager.py +484 -0
  127. pymodaq/utils/math_utils.py +6 -0
  128. pymodaq/utils/messenger.py +6 -0
  129. pymodaq/utils/parameter/__init__.py +10 -0
  130. pymodaq/utils/parameter/utils.py +6 -0
  131. pymodaq/utils/scanner/__init__.py +5 -0
  132. pymodaq/utils/scanner/scan_config.py +16 -0
  133. pymodaq/utils/scanner/scan_factory.py +259 -0
  134. pymodaq/utils/scanner/scan_selector.py +477 -0
  135. pymodaq/utils/scanner/scanner.py +324 -0
  136. pymodaq/utils/scanner/scanners/_1d_scanners.py +174 -0
  137. pymodaq/utils/scanner/scanners/_2d_scanners.py +299 -0
  138. pymodaq/utils/scanner/scanners/__init__.py +1 -0
  139. pymodaq/utils/scanner/scanners/sequential.py +224 -0
  140. pymodaq/utils/scanner/scanners/tabular.py +319 -0
  141. pymodaq/utils/scanner/utils.py +110 -0
  142. pymodaq/utils/svg/__init__.py +6 -0
  143. pymodaq/utils/svg/svg_renderer.py +20 -0
  144. pymodaq/utils/svg/svg_view.py +35 -0
  145. pymodaq/utils/svg/svg_viewer2D.py +50 -0
  146. pymodaq/utils/tcp_ip/__init__.py +6 -0
  147. pymodaq/utils/tcp_ip/mysocket.py +12 -0
  148. pymodaq/utils/tcp_ip/serializer.py +13 -0
  149. pymodaq/utils/tcp_ip/tcp_server_client.py +772 -0
  150. pymodaq-5.1.6.dist-info/METADATA +238 -0
  151. pymodaq-5.1.6.dist-info/RECORD +154 -0
  152. pymodaq-5.1.6.dist-info/WHEEL +4 -0
  153. pymodaq-5.1.6.dist-info/entry_points.txt +7 -0
  154. pymodaq-5.1.6.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,57 @@
1
+
2
+ [presets]
3
+ default_preset_for_scan = "preset_default"
4
+ default_preset_for_logger = "preset_default"
5
+ default_preset_for_pid = "beam_steering_mock"
6
+ default_preset_for_datamixer = "preset_default"
7
+
8
+ [actuator]
9
+ ui = 'Simple' # one of ['Simple', 'Original', 'Binary', ...]
10
+ epsilon_default = 1
11
+ polling_interval_ms = 100 # ms Careful when using TCP/IP connection as you can saturate the connection with too much polling
12
+ polling_timeout_s = 20 # s
13
+ refresh_timeout_ms = 500 # ms
14
+ timeout = 10000 # default duration in ms to wait for data to be acquirred
15
+ siprefix = true # tell if printing of current value use a SI prefix or not (µ, m, k, M...)
16
+ siprefix_even_without_units = false
17
+ display_units = true # display units in the SpinBoxes
18
+
19
+ [actuator.allowed_units]
20
+ V = 'V'
21
+ volt = 'volt'
22
+ W = 'W'
23
+ Hz = 'Hz'
24
+ rpm = 'rpm'
25
+ revolutions_per_minute = 'revolutions_per_minute'
26
+
27
+ [actuator.binary]
28
+ value_1 = 0
29
+ value_2 = 1
30
+
31
+ [viewer]
32
+ daq_type = 'DAQ0D' #either "DAQ0D", "DAQ1D", "DAQ2D", "DAQND"
33
+ viewer_in_thread = true
34
+ timeout = 10000 # default duration in ms to wait for data to be acquirred
35
+ allow_settings_edition = false
36
+ settings_as_popup = true
37
+
38
+ [scan]
39
+ scan_in_thread = true
40
+ show_popups = true
41
+ default = "Scan2D"
42
+ Naverage = 1 # minimum is 1
43
+ average_on_top = false
44
+ steps_limit = 1000 # the limit of the number of steps you can set in a given scan
45
+ sort1D = true
46
+
47
+ [scan.timeflow]
48
+ wait_time = 0
49
+ wait_time_between = 0
50
+ timeout = 10000 # in millisecond
51
+
52
+ [optimizer]
53
+ n_iter = 100
54
+
55
+ [optimizer.bounds]
56
+ actuator_min = -10
57
+ actuator_max = 10
@@ -0,0 +1 @@
1
+ <Preset type="group" title="Preset" visible="1" removable="0" readonly="0"><filename type="str" title="Filename:" visible="1" removable="0" readonly="0">preset_default</filename><model_settings type="group" title="Model Settings:" visible="0" removable="0" readonly="0" /><Moves type="groupmove" title="Moves:" visible="1" removable="0" readonly="0" addText="Add"><move00 type="group" title="Actuator 00" visible="1" removable="1" readonly="0"><name type="str" title="Name:" visible="1" removable="0" readonly="0">xaxis</name><init type="bool" title="Init?:" visible="1" removable="0" readonly="0">1</init><params type="group" title="Settings:" visible="1" removable="0" readonly="0"><main_settings type="group" title="Main Settings:" visible="1" removable="0" readonly="0"><move_type type="str" title="Actuator type:" visible="1" removable="0" readonly="1">Mock</move_type><module_name type="str" title="Actuator name:" visible="1" removable="0" readonly="1">xaxis</module_name><ui_type type="list" title="UI type:" visible="1" removable="0" readonly="0" limits="['Simple', 'Binary', 'Original', 'Relative']" show_pb="1">str('Original')</ui_type><plugin_config type="bool_push" title="Plugin Config:" visible="1" removable="0" readonly="0" label="Show Config">0</plugin_config><refresh_timeout type="int" title="Refresh value (ms):" visible="1" removable="0" readonly="0">500</refresh_timeout><tcpip type="group" title="TCP/IP options:" visible="1" removable="0" readonly="0"><connect_server type="bool_push" title="Connect to server:" visible="1" removable="0" readonly="0" label="Connect">0</connect_server><tcp_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</tcp_connected><ip_address type="str" title="IP address:" visible="1" removable="0" readonly="0">10.47.0.39</ip_address><port type="int" title="Port:" visible="1" removable="0" readonly="0">6341</port></tcpip><leco type="group" title="LECO options:" visible="1" removable="0" readonly="0"><connect_leco_server type="bool_push" title="Connect:" visible="1" removable="0" readonly="0" label="Connect">0</connect_leco_server><leco_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</leco_connected><leco_name type="str" title="Name" visible="1" removable="0" readonly="0" /><host type="str" title="Host:" visible="1" removable="0" readonly="0">localhost</host><port type="int" title="Port:" visible="1" removable="0" readonly="0">12300</port></leco></main_settings><move_settings type="group" title="Actuator Settings:" visible="1" removable="0" readonly="0"><tau type="int" title="Tau (ms):" visible="1" removable="0" readonly="0">500.0</tau><multiaxes type="group" title="MultiAxes:" visible="1" removable="0" readonly="0"><controller_ID type="int" title="Controller ID:" visible="1" removable="0" readonly="0">9025</controller_ID><multi_status type="list" title="Status:" visible="1" removable="0" readonly="0" limits="['Master', 'Slave']" show_pb="1">str('Master')</multi_status><axis type="list" title="Axis:" visible="1" removable="0" readonly="0" limits="['X', 'Y', 'Theta', 'Power', 'Temp', 'Frequency', 'Speed']" show_pb="1">str('X')</axis></multiaxes><units type="str" title="Units:" visible="1" removable="0" readonly="1" /><epsilon type="float" title="Epsilon:" visible="1" removable="0" readonly="0">1</epsilon><timeout type="int" title="Timeout (s):" visible="1" removable="0" readonly="0">20</timeout><bounds type="group" title="Bounds:" visible="1" removable="0" readonly="0"><is_bounds type="bool" title="Set Bounds:" visible="1" removable="0" readonly="0">0</is_bounds><min_bound type="float" title="Min:" visible="1" removable="0" readonly="0">0</min_bound><max_bound type="float" title="Max:" visible="1" removable="0" readonly="0">1</max_bound></bounds><scaling type="group" title="Scaling:" visible="1" removable="0" readonly="0"><use_scaling type="bool" title="Use scaling:" visible="1" removable="0" readonly="0">0</use_scaling><scaling type="float" title="Scaling factor:" visible="1" removable="0" readonly="0">1.0</scaling><offset type="float" title="Offset factor:" visible="1" removable="0" readonly="0">0.0</offset></scaling></move_settings></params></move00><move01 type="group" title="Actuator 01" visible="1" removable="1" readonly="0"><name type="str" title="Name:" visible="1" removable="0" readonly="0">Yaxis</name><init type="bool" title="Init?:" visible="1" removable="0" readonly="0">1</init><params type="group" title="Settings:" visible="1" removable="0" readonly="0"><main_settings type="group" title="Main Settings:" visible="1" removable="0" readonly="0"><move_type type="str" title="Actuator type:" visible="1" removable="0" readonly="1">Mock</move_type><module_name type="str" title="Actuator name:" visible="1" removable="0" readonly="1">Yaxis</module_name><ui_type type="list" title="UI type:" visible="1" removable="0" readonly="0" limits="['Simple', 'Binary', 'Original', 'Relative']" show_pb="1">str('Original')</ui_type><plugin_config type="bool_push" title="Plugin Config:" visible="1" removable="0" readonly="0" label="Show Config">0</plugin_config><refresh_timeout type="int" title="Refresh value (ms):" visible="1" removable="0" readonly="0">500</refresh_timeout><tcpip type="group" title="TCP/IP options:" visible="1" removable="0" readonly="0"><connect_server type="bool_push" title="Connect to server:" visible="1" removable="0" readonly="0" label="Connect">0</connect_server><tcp_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</tcp_connected><ip_address type="str" title="IP address:" visible="1" removable="0" readonly="0">10.47.0.39</ip_address><port type="int" title="Port:" visible="1" removable="0" readonly="0">6341</port></tcpip><leco type="group" title="LECO options:" visible="1" removable="0" readonly="0"><connect_leco_server type="bool_push" title="Connect:" visible="1" removable="0" readonly="0" label="Connect">0</connect_leco_server><leco_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</leco_connected><leco_name type="str" title="Name" visible="1" removable="0" readonly="0" /><host type="str" title="Host:" visible="1" removable="0" readonly="0">localhost</host><port type="int" title="Port:" visible="1" removable="0" readonly="0">12300</port></leco></main_settings><move_settings type="group" title="Actuator Settings:" visible="1" removable="0" readonly="0"><tau type="int" title="Tau (ms):" visible="1" removable="0" readonly="0">500.0</tau><multiaxes type="group" title="MultiAxes:" visible="1" removable="0" readonly="0"><controller_ID type="int" title="Controller ID:" visible="1" removable="0" readonly="0">1495</controller_ID><multi_status type="list" title="Status:" visible="1" removable="0" readonly="0" limits="['Master', 'Slave']" show_pb="1">str('Master')</multi_status><axis type="list" title="Axis:" visible="1" removable="0" readonly="0" limits="['X', 'Y', 'Theta', 'Power', 'Temp', 'Frequency', 'Speed']" show_pb="1">str('X')</axis></multiaxes><units type="str" title="Units:" visible="1" removable="0" readonly="1" /><epsilon type="float" title="Epsilon:" visible="1" removable="0" readonly="0">1</epsilon><timeout type="int" title="Timeout (s):" visible="1" removable="0" readonly="0">20</timeout><bounds type="group" title="Bounds:" visible="1" removable="0" readonly="0"><is_bounds type="bool" title="Set Bounds:" visible="1" removable="0" readonly="0">0</is_bounds><min_bound type="float" title="Min:" visible="1" removable="0" readonly="0">0</min_bound><max_bound type="float" title="Max:" visible="1" removable="0" readonly="0">1</max_bound></bounds><scaling type="group" title="Scaling:" visible="1" removable="0" readonly="0"><use_scaling type="bool" title="Use scaling:" visible="1" removable="0" readonly="0">0</use_scaling><scaling type="float" title="Scaling factor:" visible="1" removable="0" readonly="0">1.0</scaling><offset type="float" title="Offset factor:" visible="1" removable="0" readonly="0">0.0</offset></scaling></move_settings></params></move01></Moves><Detectors type="groupdet" title="Detectors:" visible="1" removable="0" readonly="0" addText="Add"><det00 type="group" title="Det 00" visible="1" removable="1" readonly="0"><name type="str" title="Name:" visible="1" removable="0" readonly="0">Det 0D</name><init type="bool" title="Init?:" visible="1" removable="0" readonly="0">1</init><params type="group" title="Settings:" visible="1" removable="0" readonly="0"><main_settings type="group" title="Main Settings:" visible="1" removable="0" readonly="0"><DAQ_type type="list" title="DAQ type:" visible="1" removable="0" readonly="1" limits="['DAQ0D', 'DAQ1D', 'DAQ2D', 'DAQND']" show_pb="1">str('DAQ0D')</DAQ_type><detector_type type="str" title="Detector type:" visible="1" removable="0" readonly="1">Mock</detector_type><module_name type="str" title="Detector Name:" visible="1" removable="0" readonly="1">Det 0D</module_name><plugin_config type="bool_push" title="Plugin Config:" visible="1" removable="0" readonly="0" label="Show Config">0</plugin_config><show_data type="bool" title="Show data and process:" visible="1" removable="0" readonly="0">1</show_data><refresh_time type="float" title="Refresh time (ms):" visible="1" removable="0" readonly="0">50.0</refresh_time><Naverage type="int" title="Naverage" visible="1" removable="0" readonly="0">1</Naverage><show_averaging type="bool" title="Show averaging:" visible="1" removable="0" readonly="0">0</show_averaging><live_averaging type="bool" title="Live averaging:" visible="1" removable="0" readonly="0">0</live_averaging><N_live_averaging type="int" title="N Live aver.:" visible="0" removable="0" readonly="0">0</N_live_averaging><wait_time type="int" title="Wait time (ms):" visible="1" removable="0" readonly="0">0</wait_time><continuous_saving_opt type="bool" title="Continuous saving:" visible="1" removable="0" readonly="0">0</continuous_saving_opt><tcpip type="group" title="TCP/IP options:" visible="1" removable="0" readonly="0"><connect_server type="bool_push" title="Connect to server:" visible="1" removable="0" readonly="0" label="Connect">0</connect_server><tcp_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</tcp_connected><ip_address type="str" title="IP address:" visible="1" removable="0" readonly="0">10.47.0.39</ip_address><port type="int" title="Port:" visible="1" removable="0" readonly="0">6341</port></tcpip><leco type="group" title="LECO options:" visible="1" removable="0" readonly="0"><connect_leco_server type="bool_push" title="Connect:" visible="1" removable="0" readonly="0" label="Connect">0</connect_leco_server><leco_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</leco_connected><leco_name type="str" title="Name" visible="1" removable="0" readonly="0" /><host type="str" title="Host:" visible="1" removable="0" readonly="0">localhost</host><port type="int" title="Port:" visible="1" removable="0" readonly="0">12300</port></leco><overshoot type="group" title="Overshoot options:" visible="1" removable="0" readonly="0"><stop_overshoot type="bool" title="Overshoot:" visible="1" removable="0" readonly="0">0</stop_overshoot><overshoot_value type="float" title="Overshoot value:" visible="1" removable="0" readonly="0">0</overshoot_value></overshoot><axes type="group" title="Axis options:" visible="1" removable="0" readonly="0"><use_calib type="list" title="Use calibration?:" visible="1" removable="0" readonly="0" limits="['None']" show_pb="1">str('None')</use_calib><xaxis type="group" title="X axis:" visible="1" removable="0" readonly="0"><xlabel type="str" title="Label:" visible="1" removable="0" readonly="0">x axis</xlabel><xunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</xunits><xoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</xoffset><xscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</xscaling></xaxis><yaxis type="group" title="Y axis:" visible="1" removable="0" readonly="0"><ylabel type="str" title="Label:" visible="1" removable="0" readonly="0">y axis</ylabel><yunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</yunits><yoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</yoffset><yscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</yscaling></yaxis></axes></main_settings><detector_settings type="group" title="Detector Settings" visible="1" removable="0" readonly="0"><controller_status type="list" title="Controller Status:" visible="1" removable="0" readonly="0" limits="['Master', 'Slave']" show_pb="1">str('Master')</controller_status><controller_ID type="int" title="Controller ID:" visible="1" removable="0" readonly="0">5553</controller_ID><wait_time type="int" title="Wait time (ms)" visible="1" removable="0" readonly="0">100</wait_time><sep_viewers type="bool" title="Separated viewers" visible="1" removable="0" readonly="0">0</sep_viewers><lcd type="bool" title="Show in LCD" visible="1" removable="0" readonly="0">0</lcd><Mock1 type="group" title="Mock1" visible="1" removable="0" readonly="0"><Npts type="int" title="Npts" visible="1" removable="0" readonly="0">200</Npts><Amp type="int" title="Amp" visible="1" removable="0" readonly="0">20</Amp><x0 type="float" title="x0" visible="1" removable="0" readonly="0">50</x0><dx type="float" title="dx" visible="1" removable="0" readonly="0">20</dx><n type="int" title="n" visible="1" removable="0" readonly="0">1</n><amp_noise type="float" title="amp_noise" visible="1" removable="0" readonly="0">0.1</amp_noise></Mock1><Mock2 type="group" title="Mock2" visible="1" removable="0" readonly="0"><Npts type="int" title="Npts" visible="1" removable="0" readonly="0">200</Npts><Amp type="int" title="Amp" visible="1" removable="0" readonly="0">10</Amp><x0 type="float" title="x0" visible="1" removable="0" readonly="0">100</x0><dx type="float" title="dx" visible="1" removable="0" readonly="0">30</dx><n type="int" title="n" visible="1" removable="0" readonly="0">2</n><amp_noise type="float" title="amp_noise" visible="1" removable="0" readonly="0">0.1</amp_noise></Mock2></detector_settings></params></det00><det01 type="group" title="Det 01" visible="1" removable="1" readonly="0"><name type="str" title="Name:" visible="1" removable="0" readonly="0">Det 1D</name><init type="bool" title="Init?:" visible="1" removable="0" readonly="0">1</init><params type="group" title="Settings:" visible="1" removable="0" readonly="0"><main_settings type="group" title="Main Settings:" visible="1" removable="0" readonly="0"><DAQ_type type="list" title="DAQ type:" visible="1" removable="0" readonly="1" limits="['DAQ0D', 'DAQ1D', 'DAQ2D', 'DAQND']" show_pb="1">str('DAQ1D')</DAQ_type><detector_type type="str" title="Detector type:" visible="1" removable="0" readonly="1">Mock</detector_type><module_name type="str" title="Detector Name:" visible="1" removable="0" readonly="1">Det 1D</module_name><plugin_config type="bool_push" title="Plugin Config:" visible="1" removable="0" readonly="0" label="Show Config">0</plugin_config><show_data type="bool" title="Show data and process:" visible="1" removable="0" readonly="0">1</show_data><refresh_time type="float" title="Refresh time (ms):" visible="1" removable="0" readonly="0">50.0</refresh_time><Naverage type="int" title="Naverage" visible="1" removable="0" readonly="0">1</Naverage><show_averaging type="bool" title="Show averaging:" visible="1" removable="0" readonly="0">0</show_averaging><live_averaging type="bool" title="Live averaging:" visible="1" removable="0" readonly="0">0</live_averaging><N_live_averaging type="int" title="N Live aver.:" visible="0" removable="0" readonly="0">0</N_live_averaging><wait_time type="int" title="Wait time (ms):" visible="1" removable="0" readonly="0">0</wait_time><continuous_saving_opt type="bool" title="Continuous saving:" visible="1" removable="0" readonly="0">0</continuous_saving_opt><tcpip type="group" title="TCP/IP options:" visible="1" removable="0" readonly="0"><connect_server type="bool_push" title="Connect to server:" visible="1" removable="0" readonly="0" label="Connect">0</connect_server><tcp_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</tcp_connected><ip_address type="str" title="IP address:" visible="1" removable="0" readonly="0">10.47.0.39</ip_address><port type="int" title="Port:" visible="1" removable="0" readonly="0">6341</port></tcpip><leco type="group" title="LECO options:" visible="1" removable="0" readonly="0"><connect_leco_server type="bool_push" title="Connect:" visible="1" removable="0" readonly="0" label="Connect">0</connect_leco_server><leco_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</leco_connected><leco_name type="str" title="Name" visible="1" removable="0" readonly="0" /><host type="str" title="Host:" visible="1" removable="0" readonly="0">localhost</host><port type="int" title="Port:" visible="1" removable="0" readonly="0">12300</port></leco><overshoot type="group" title="Overshoot options:" visible="1" removable="0" readonly="0"><stop_overshoot type="bool" title="Overshoot:" visible="1" removable="0" readonly="0">0</stop_overshoot><overshoot_value type="float" title="Overshoot value:" visible="1" removable="0" readonly="0">0</overshoot_value></overshoot><axes type="group" title="Axis options:" visible="1" removable="0" readonly="0"><use_calib type="list" title="Use calibration?:" visible="1" removable="0" readonly="0" limits="['None']" show_pb="1">str('None')</use_calib><xaxis type="group" title="X axis:" visible="1" removable="0" readonly="0"><xlabel type="str" title="Label:" visible="1" removable="0" readonly="0">x axis</xlabel><xunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</xunits><xoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</xoffset><xscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</xscaling></xaxis><yaxis type="group" title="Y axis:" visible="1" removable="0" readonly="0"><ylabel type="str" title="Label:" visible="1" removable="0" readonly="0">y axis</ylabel><yunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</yunits><yoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</yoffset><yscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</yscaling></yaxis></axes></main_settings><detector_settings type="group" title="Detector Settings" visible="1" removable="0" readonly="0"><controller_status type="list" title="Controller Status:" visible="1" removable="0" readonly="0" limits="['Master', 'Slave']" show_pb="1">str('Master')</controller_status><controller_ID type="int" title="Controller ID:" visible="1" removable="0" readonly="0">2407</controller_ID><rolling type="int" title="Rolling?:" visible="1" removable="0" readonly="0">0</rolling><multi type="bool" title="Multi Channels?:" visible="1" removable="0" readonly="0">0</multi><Mock1 type="group" title="Mock1:" visible="1" removable="0" readonly="0"><Amp type="int" title="Amp:" visible="1" removable="0" readonly="0">20</Amp><x0 type="float" title="x0:" visible="1" removable="0" readonly="0">500</x0><dx type="float" title="dx:" visible="1" removable="0" readonly="0">0.3</dx><n type="int" title="n:" visible="1" removable="0" readonly="0">1</n><amp_noise type="float" title="noise:" visible="1" removable="0" readonly="0">0.1</amp_noise></Mock1><Mock2 type="group" title="Mock2:" visible="1" removable="0" readonly="0"><Amp type="int" title="Amp?:" visible="1" removable="0" readonly="0">10</Amp><x0 type="float" title="x0:" visible="1" removable="0" readonly="0">520</x0><dx type="float" title="dx:" visible="1" removable="0" readonly="0">0.7</dx><n type="int" title="n:" visible="1" removable="0" readonly="0">2</n><amp_noise type="float" title="noise:" visible="1" removable="0" readonly="0">0.1</amp_noise></Mock2><x_axis type="group" title="xaxis:" visible="1" removable="0" readonly="0"><Npts type="int" title="Npts:" visible="1" removable="0" readonly="0">513</Npts><x0 type="float" title="x0:" visible="1" removable="0" readonly="0">515</x0><dx type="float" title="dx:" visible="1" removable="0" readonly="0">0.1</dx></x_axis></detector_settings></params></det01><det02 type="group" title="Det 02" visible="1" removable="1" readonly="0"><name type="str" title="Name:" visible="1" removable="0" readonly="0">Det 2D</name><init type="bool" title="Init?:" visible="1" removable="0" readonly="0">1</init><params type="group" title="Settings:" visible="1" removable="0" readonly="0"><main_settings type="group" title="Main Settings:" visible="1" removable="0" readonly="0"><DAQ_type type="list" title="DAQ type:" visible="1" removable="0" readonly="1" limits="['DAQ0D', 'DAQ1D', 'DAQ2D', 'DAQND']" show_pb="1">str('DAQ2D')</DAQ_type><detector_type type="str" title="Detector type:" visible="1" removable="0" readonly="1">Mock</detector_type><module_name type="str" title="Detector Name:" visible="1" removable="0" readonly="1">Det 2D</module_name><plugin_config type="bool_push" title="Plugin Config:" visible="1" removable="0" readonly="0" label="Show Config">0</plugin_config><show_data type="bool" title="Show data and process:" visible="1" removable="0" readonly="0">1</show_data><refresh_time type="float" title="Refresh time (ms):" visible="1" removable="0" readonly="0">50.0</refresh_time><Naverage type="int" title="Naverage" visible="1" removable="0" readonly="0">1</Naverage><show_averaging type="bool" title="Show averaging:" visible="1" removable="0" readonly="0">0</show_averaging><live_averaging type="bool" title="Live averaging:" visible="1" removable="0" readonly="0">0</live_averaging><N_live_averaging type="int" title="N Live aver.:" visible="0" removable="0" readonly="0">0</N_live_averaging><wait_time type="int" title="Wait time (ms):" visible="1" removable="0" readonly="0">0</wait_time><continuous_saving_opt type="bool" title="Continuous saving:" visible="1" removable="0" readonly="0">0</continuous_saving_opt><tcpip type="group" title="TCP/IP options:" visible="1" removable="0" readonly="0"><connect_server type="bool_push" title="Connect to server:" visible="1" removable="0" readonly="0" label="Connect">0</connect_server><tcp_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</tcp_connected><ip_address type="str" title="IP address:" visible="1" removable="0" readonly="0">10.47.0.39</ip_address><port type="int" title="Port:" visible="1" removable="0" readonly="0">6341</port></tcpip><leco type="group" title="LECO options:" visible="1" removable="0" readonly="0"><connect_leco_server type="bool_push" title="Connect:" visible="1" removable="0" readonly="0" label="Connect">0</connect_leco_server><leco_connected type="led" title="Connected?:" visible="1" removable="0" readonly="0">0</leco_connected><leco_name type="str" title="Name" visible="1" removable="0" readonly="0" /><host type="str" title="Host:" visible="1" removable="0" readonly="0">localhost</host><port type="int" title="Port:" visible="1" removable="0" readonly="0">12300</port></leco><overshoot type="group" title="Overshoot options:" visible="1" removable="0" readonly="0"><stop_overshoot type="bool" title="Overshoot:" visible="1" removable="0" readonly="0">0</stop_overshoot><overshoot_value type="float" title="Overshoot value:" visible="1" removable="0" readonly="0">0</overshoot_value></overshoot><axes type="group" title="Axis options:" visible="1" removable="0" readonly="0"><use_calib type="list" title="Use calibration?:" visible="1" removable="0" readonly="0" limits="['None']" show_pb="1">str('None')</use_calib><xaxis type="group" title="X axis:" visible="1" removable="0" readonly="0"><xlabel type="str" title="Label:" visible="1" removable="0" readonly="0">x axis</xlabel><xunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</xunits><xoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</xoffset><xscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</xscaling></xaxis><yaxis type="group" title="Y axis:" visible="1" removable="0" readonly="0"><ylabel type="str" title="Label:" visible="1" removable="0" readonly="0">y axis</ylabel><yunits type="str" title="Units:" visible="1" removable="0" readonly="0">pxls</yunits><yoffset type="float" title="Offset:" visible="1" removable="0" readonly="0">0.0</yoffset><yscaling type="float" title="Scaling" visible="1" removable="0" readonly="0">1.0</yscaling></yaxis></axes></main_settings><detector_settings type="group" title="Detector Settings" visible="1" removable="0" readonly="0"><controller_status type="list" title="Controller Status:" visible="1" removable="0" readonly="0" limits="['Master', 'Slave']" show_pb="1">str('Master')</controller_status><controller_ID type="int" title="Controller ID:" visible="1" removable="0" readonly="0">7412</controller_ID><Nimagescolor type="int" title="Nimages colors:" visible="1" removable="0" readonly="0">1</Nimagescolor><Nimagespannel type="int" title="Nimages pannels:" visible="1" removable="0" readonly="0">2</Nimagespannel><use_roi_select type="bool" title="Use ROISelect" visible="1" removable="0" readonly="0">0</use_roi_select><threshold type="int" title="Threshold" visible="1" removable="0" readonly="0">1</threshold><rolling type="int" title="rolling" visible="1" removable="0" readonly="0">1</rolling><Nx type="int" title="Nx" visible="1" removable="0" readonly="0">100</Nx><Ny type="int" title="Ny" visible="1" removable="0" readonly="0">200</Ny><Amp type="int" title="Amp" visible="1" removable="0" readonly="0">20</Amp><x0 type="slide" title="x0" visible="1" removable="0" readonly="0">50</x0><y0 type="float" title="y0" visible="1" removable="0" readonly="0">100</y0><dx type="float" title="dx" visible="1" removable="0" readonly="0">20</dx><dy type="float" title="dy" visible="1" removable="0" readonly="0">40</dy><n type="int" title="n" visible="1" removable="0" readonly="0">1</n><amp_noise type="float" title="amp_noise" visible="1" removable="0" readonly="0">4</amp_noise><cam_settings type="group" title="Cam. Prop.:" visible="1" removable="0" readonly="0" /></detector_settings></params></det02></Detectors></Preset>
@@ -0,0 +1,73 @@
1
+ from setuptools import setup as realsetup
2
+ from setuptools import find_packages
3
+ import toml
4
+ from pathlib import Path
5
+
6
+
7
+ def setup(path: Path):
8
+ config = toml.load(path.joinpath('plugin_info.toml'))
9
+ SHORT_PLUGIN_NAME = config['plugin-info']['SHORT_PLUGIN_NAME']
10
+ PLUGIN_NAME = f"pymodaq_plugins_{SHORT_PLUGIN_NAME}"
11
+
12
+ if not SHORT_PLUGIN_NAME.isidentifier():
13
+ raise ValueError("'SHORT_PLUGIN_NAME = %s' is not a valid python identifier." % SHORT_PLUGIN_NAME)
14
+
15
+ with open(str(path.joinpath(f'src/{PLUGIN_NAME}/resources/VERSION')), 'r') as fvers:
16
+ version = fvers.read().strip()
17
+
18
+
19
+ with open(path.joinpath('README.rst')) as fd:
20
+ long_description = fd.read()
21
+
22
+ setupOpts = dict(
23
+ name=PLUGIN_NAME,
24
+ description=config['plugin-info']['description'],
25
+ long_description=long_description,
26
+ long_description_content_type='text/x-rst',
27
+ license=config['plugin-info']['license'],
28
+ url=config['plugin-info']['package-url'],
29
+ author=config['plugin-info']['author'],
30
+ author_email=config['plugin-info']['author-email'],
31
+ classifiers=[
32
+ "Programming Language :: Python :: 3",
33
+ "Development Status :: 5 - Production/Stable",
34
+ "Environment :: Other Environment",
35
+ "Intended Audience :: Science/Research",
36
+ "Topic :: Scientific/Engineering :: Human Machine Interfaces",
37
+ "Topic :: Scientific/Engineering :: Visualization",
38
+ "License :: OSI Approved :: MIT License",
39
+ "Operating System :: OS Independent",
40
+ "Topic :: Software Development :: Libraries :: Python Modules",
41
+ "Topic :: Software Development :: User Interfaces",
42
+ ], )
43
+
44
+
45
+ entrypoints = {}
46
+ if 'features' in config:
47
+ if config['features'].get('instruments', False):
48
+ entrypoints['pymodaq.instruments'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
49
+ if config['features'].get('extensions', False):
50
+ entrypoints['pymodaq.extensions'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
51
+ if config['features'].get('pid_models', False): # deprecated use 'models'
52
+ entrypoints['pymodaq.pid_models'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
53
+ if config['features'].get('models', False):
54
+ entrypoints['pymodaq.models'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
55
+ if config['features'].get('h5exporters', False):
56
+ entrypoints['pymodaq.h5exporters'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
57
+ if config['features'].get('scanners', False):
58
+ entrypoints['pymodaq.scanners'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
59
+ else:
60
+ entrypoints['pymodaq.instrument'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
61
+
62
+ entrypoints['pymodaq.plugins'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}' # generic plugin, usefull for the plugin manager
63
+
64
+ realsetup(
65
+ version=version,
66
+ packages=find_packages(where='./src'),
67
+ package_dir={'': 'src'},
68
+ include_package_data=True,
69
+ entry_points=entrypoints,
70
+ install_requires=['toml', ]+config['plugin-install']['packages-required'],
71
+ **setupOpts
72
+ )
73
+
pymodaq/splash.png ADDED
Binary file
File without changes
@@ -0,0 +1,6 @@
1
+ from pymodaq_utils.array_manipulation import *
2
+
3
+ from pymodaq_utils.warnings import deprecation_msg
4
+
5
+ deprecation_msg('Importing array_manipulation stuff from pymodaq is deprecated in pymodaq>5.0.0,'
6
+ 'please use the pymodaq_utils.array_manipulation module')
@@ -0,0 +1,180 @@
1
+ import os
2
+ import sys
3
+
4
+ from qtpy import QtWidgets
5
+ from qtpy.QtCore import Qt, QObject
6
+
7
+ from pymodaq_utils.config import get_set_local_dir
8
+
9
+ from pymodaq_gui.parameter import ioxml
10
+ from pymodaq_gui.parameter import ParameterTree, Parameter
11
+ from pymodaq_gui.plotting.data_viewers.viewer2D import Viewer2D
12
+ from pymodaq_gui.h5modules.browsing import browse_data
13
+
14
+ from pymodaq.post_treatment.daq_measurement.daq_measurement_main import DAQ_Measurement
15
+
16
+
17
+ local_path = get_set_local_dir()
18
+ calib_path = os.path.join(local_path, 'camera_calibrations')
19
+ if not os.path.isdir(calib_path):
20
+ os.makedirs(calib_path)
21
+
22
+
23
+ class CalibrationCamera(QtWidgets.QWidget, QObject):
24
+ def __init__(self, parent=None, h5filepath=None):
25
+
26
+
27
+ super(CalibrationCamera, self).__init__()
28
+ if parent is None:
29
+ parent = QtWidgets.QWidget()
30
+
31
+ self.parent = parent
32
+ self.setupUI()
33
+ self.fname = None
34
+ self.node_path = None
35
+
36
+ self.viewer2D.get_action('histo').trigger()
37
+ self.viewer2D.get_action('roi').trigger()
38
+
39
+ self.meas_module.ui.measurement_type_combo.setCurrentText('Sinus')
40
+ QtWidgets.QApplication.processEvents()
41
+ self.meas_module.ui.measure_subtype_combo.setCurrentText('dx')
42
+
43
+ def setupUI(self):
44
+
45
+ params = [{'title': 'Load data:', 'name': 'Load data', 'type': 'action', },
46
+ {'title': 'Set Measurement:', 'name': 'Do measurement', 'type': 'action', },
47
+ {'title': 'Calib from:', 'name': 'calib_from', 'type': 'list', 'limits': ['Hlineout', 'Vlineout'], },
48
+ {'title': 'X axis:', 'name': 'xaxis', 'type': 'group', 'children': [
49
+ {'title': 'Units:', 'name': 'xunits', 'type': 'str', 'value': "µm"},
50
+ {'title': 'dx (units):', 'name': 'dx_units', 'type': 'float', 'value': 0, },
51
+ {'title': 'dx from fit:', 'name': 'dx_fit', 'type': 'float', 'value': 0, },
52
+ {'title': 'x Offset:', 'name': 'xoffset', 'type': 'float', 'value': 0., 'readonly': False}, ]},
53
+ {'title': 'Y axis:', 'name': 'yaxis', 'type': 'group', 'children': [
54
+ {'title': 'Units:', 'name': 'yunits', 'type': 'str', 'value': "µm"},
55
+ {'title': 'dy (units):', 'name': 'dy_units', 'type': 'float', 'value': 0., },
56
+ {'title': 'dy from fit:', 'name': 'dy_fit', 'type': 'float', 'value': 0., },
57
+ {'title': 'y Offset:', 'name': 'yoffset', 'type': 'float', 'value': 0., 'readonly': False}, ]},
58
+ {'title': 'Save calib:', 'name': 'Save data', 'type': 'action', },
59
+ {'title': 'Data Saved:', 'name': 'data_saved', 'type': 'led', 'value': False, 'readonly': True},
60
+ {'title': 'File path:', 'name': 'filepath', 'type': 'text', 'value': '', 'readonly': True},
61
+ ]
62
+
63
+ layout = QtWidgets.QHBoxLayout()
64
+ self.parent.setLayout(layout)
65
+
66
+ splitter_H = QtWidgets.QSplitter(Qt.Horizontal)
67
+
68
+ splitter = QtWidgets.QSplitter(Qt.Vertical)
69
+
70
+ widg2D = QtWidgets.QWidget()
71
+ self.viewer2D = Viewer2D(widg2D)
72
+ self.viewer2D.title = 'calib'
73
+ self.viewer2D.get_action('autolevels').trigger()
74
+
75
+ splitter.addWidget(widg2D)
76
+
77
+ widg_meas = QtWidgets.QWidget()
78
+ self.meas_module = DAQ_Measurement(widg_meas)
79
+ splitter.addWidget(widg_meas)
80
+
81
+ self.settings_tree = ParameterTree()
82
+ self.settings = Parameter.create(name='Settings', type='group', children=params)
83
+ self.settings_tree.setParameters(self.settings, showTop=False)
84
+ self.settings.sigTreeStateChanged.connect(self.parameter_tree_changed)
85
+
86
+ self.settings.child(('Load data')).sigActivated.connect(self.load_data)
87
+ self.settings.child(('Save data')).sigActivated.connect(self.save_data)
88
+ self.settings.child(('Do measurement')).sigActivated.connect(self.update_data_meas)
89
+
90
+ splitter_H.addWidget(self.settings_tree)
91
+ splitter_H.addWidget(splitter)
92
+
93
+ layout.addWidget(splitter_H)
94
+
95
+ def update_data_meas(self):
96
+ if self.settings.child(('calib_from')).value() == 'Hlineout':
97
+ xdata = self.viewer2D.data_to_export['data1D']['calib_Hlineout_ROI_00']['x_axis']
98
+ ydata = self.viewer2D.data_to_export['data1D']['calib_Hlineout_ROI_00']['data']
99
+ else:
100
+ xdata = self.viewer2D.data_to_export['data1D']['calib_Vlineout_ROI_00']['x_axis']
101
+ ydata = self.viewer2D.data_to_export['data1D']['calib_Vlineout_ROI_00']['data']
102
+
103
+ self.meas_module.update_data(xdata, ydata)
104
+
105
+ def load_data(self):
106
+ self.data, self.fname, self.node_path = browse_data(ret_all=True)
107
+ if self.data is not None:
108
+ self.settings.child('xaxis', 'xoffset').setValue((-self.data.shape[1] / 2))
109
+ self.settings.child('yaxis', 'yoffset').setValue((-self.data.shape[0] / 2))
110
+ self.viewer2D.setImage(self.data)
111
+ self.viewer2D.get_action('histo').trigger()
112
+ self.viewer2D.get_action('roi').trigger()
113
+ QtWidgets.QApplication.processEvents()
114
+
115
+ def save_data(self):
116
+ params = [{'title': 'Axis options:', 'name': 'axes', 'type': 'group', 'visible': False, 'expanded': False,
117
+ 'children': [
118
+ {'title': 'X axis:', 'name': 'xaxis', 'type': 'group', 'children': [
119
+ {'title': 'Label:', 'name': 'xlabel', 'type': 'str', 'value': "x axis"},
120
+ {'title': 'Units:', 'name': 'xunits', 'type': 'str',
121
+ 'value': self.settings.child('xaxis', 'xunits').value()},
122
+ {'title': 'Offset:', 'name': 'xoffset', 'type': 'float', 'default': 0.,
123
+ 'value': self.settings.child('xaxis', 'xoffset').value()},
124
+
125
+ {'title': 'Scaling', 'name': 'xscaling', 'type': 'float', 'default': 1.,
126
+ 'value': self.settings.child('xaxis', 'dx_units').value() / self.settings.child('xaxis',
127
+ 'dx_fit').value()},
128
+ ]},
129
+ {'title': 'Y axis:', 'name': 'yaxis', 'type': 'group', 'children': [
130
+ {'title': 'Label:', 'name': 'ylabel', 'type': 'str', 'value': "x axis"},
131
+ {'title': 'Units:', 'name': 'yunits', 'type': 'str',
132
+ 'value': self.settings.child('yaxis', 'yunits').value()},
133
+ {'title': 'Offset:', 'name': 'yoffset', 'type': 'float', 'default': 0.,
134
+ 'value': self.settings.child('yaxis', 'yoffset').value()},
135
+ {'title': 'Scaling', 'name': 'yscaling', 'type': 'float', 'default': 1.,
136
+ 'value': self.settings.child('yaxis', 'dy_units').value() / self.settings.child('yaxis',
137
+ 'dy_fit').value()},
138
+ ]},
139
+ ]}, ]
140
+ param_obj = Parameter.create(name='Axes_Settings', type='group', children=params)
141
+ ioxml.parameter_to_xml_file(param_obj,
142
+ os.path.join(calib_path, os.path.split(self.fname)[1]))
143
+ self.settings.child(('data_saved')).setValue(True)
144
+ self.settings.child(('filepath')).setValue(os.path.join(calib_path, os.path.split(self.fname)[1]))
145
+
146
+ def parameter_tree_changed(self, param, changes):
147
+ """
148
+
149
+ """
150
+ for param, change, data in changes:
151
+ path = self.settings.childPath(param)
152
+ if path is not None:
153
+ childName = '.'.join(path)
154
+ else:
155
+ childName = param.name()
156
+ if change == 'childAdded':
157
+ pass
158
+
159
+ elif change == 'value':
160
+ if param.name() == 'calib_from':
161
+ self.update_data_meas()
162
+ elif param.name() == 'dx_fit':
163
+ scaling = self.settings.child('xaxis', 'dx_units').value() / param.value()
164
+ self.settings.child('xaxis', 'xoffset').setValue(-scaling * self.data.shape[1] / 2)
165
+ elif param.name() == 'dy_fit':
166
+ scaling = self.settings.child('yaxis', 'dy_units').value() / param.value()
167
+ self.settings.child('yaxis', 'yoffset').setValue(-scaling * self.data.shape[0] / 2)
168
+
169
+ self.settings.child(('data_saved')).setValue(False)
170
+
171
+ elif change == 'parent':
172
+ pass
173
+
174
+
175
+ if __name__ == '__main__':
176
+ app = QtWidgets.QApplication(sys.argv)
177
+ win = QtWidgets.QWidget()
178
+ prog = CalibrationCamera(win)
179
+ win.show()
180
+ sys.exit(app.exec_())
@@ -0,0 +1,203 @@
1
+ import time
2
+ from datetime import timedelta
3
+ import sys
4
+
5
+ from qtpy import QtGui, QtWidgets
6
+ from qtpy.QtCore import Qt, QObject, QTimer
7
+
8
+
9
+ from pymodaq_gui.utils.dock import DockArea, Dock
10
+
11
+
12
+ class PushButtonShortcut(QtWidgets.QPushButton):
13
+
14
+ def __init__(self, *args, shortcut=None, shortcut_widget=None, **kwargs):
15
+ super().__init__(*args, **kwargs)
16
+ self.shortcut = None
17
+ if shortcut_widget is None:
18
+ shortcut_widget = self
19
+ if shortcut is not None:
20
+ self.shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(shortcut), shortcut_widget)
21
+ self.shortcut.activated.connect(self.click_button)
22
+
23
+ def click_button(self):
24
+ self.click()
25
+
26
+
27
+ class ChronoTimer(QObject):
28
+
29
+ def __init__(self, parent, duration=None):
30
+ """
31
+
32
+ :param parent:
33
+ :param Nteams:
34
+ :param duration: (dict) containing optional keys : days, minutes, seconds, hours, weeks, milliseconds, microseconds
35
+ """
36
+ super().__init__()
37
+ self.area = parent
38
+ if duration is None:
39
+ self.type = 'chrono'
40
+ self.duration = timedelta()
41
+ else:
42
+ self.type = 'timer'
43
+ self.duration = timedelta(**duration) # seconds
44
+ self.displayed_time = 0 # in seconds
45
+ self.started = False
46
+ self.timer = QTimer()
47
+ self.timer.setInterval(100)
48
+ self.timer.timeout.connect(self.display_time)
49
+
50
+ self.setup_ui()
51
+
52
+ def setup_ui(self):
53
+
54
+ self.dock_chrono_timer = Dock(self.type.capitalize())
55
+ self.area.addDock(self.dock_chrono_timer)
56
+ self.dock_chrono_timer.float()
57
+
58
+ widget_chrono_timer = QtWidgets.QWidget()
59
+ self.dock_chrono_timer.addWidget(widget_chrono_timer)
60
+
61
+ self.layout_lcd = QtWidgets.QVBoxLayout()
62
+ widget_chrono_timer.setLayout(self.layout_lcd)
63
+
64
+ self.dock_chrono_timer.setAutoFillBackground(True)
65
+ palette = self.dock_chrono_timer.palette()
66
+ palette.setColor(palette.Window, QtGui.QColor(0, 0, 0))
67
+ self.dock_chrono_timer.setPalette(palette)
68
+
69
+ self.time_lcd = QtWidgets.QLCDNumber(8)
70
+ self.set_lcd_color(self.time_lcd, 'red')
71
+ self.layout_lcd.addWidget(self.time_lcd)
72
+
73
+ hours, minutes, seconds = self.get_times(self.duration)
74
+
75
+ self.time_lcd.display(
76
+ '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds))
77
+
78
+ self.dock_controls = Dock('Chrono/Timer Controls')
79
+ self.area.addDock(self.dock_controls)
80
+ self.dock_controls.setOrientation('vertical', True)
81
+ self.dock_controls.setMaximumHeight(150)
82
+
83
+ self.widget_controls = QtWidgets.QWidget()
84
+ self.controls_layout = QtWidgets.QVBoxLayout()
85
+ self.widget_controls.setLayout(self.controls_layout)
86
+
87
+ hor_layout = QtWidgets.QHBoxLayout()
88
+ hor_widget = QtWidgets.QWidget()
89
+ hor_widget.setLayout(hor_layout)
90
+
91
+ self.controls_layout.addWidget(hor_widget)
92
+
93
+ icon = QtGui.QIcon()
94
+ icon.addPixmap(QtGui.QPixmap("icons:run2.png"), QtGui.QIcon.Normal,
95
+ QtGui.QIcon.Off)
96
+ self.start_pb = PushButtonShortcut(icon, 'Start',
97
+ shortcut='Home', shortcut_widget=self.area)
98
+ self.start_pb.clicked.connect(self.start)
99
+ self.start_pb.setToolTip('home ("début") key shorcut')
100
+
101
+ hor_layout.addWidget(self.start_pb)
102
+
103
+ icon = QtGui.QIcon()
104
+ icon.addPixmap(QtGui.QPixmap("icons:pause.png"), QtGui.QIcon.Normal,
105
+ QtGui.QIcon.Off)
106
+ self.pause_pb = PushButtonShortcut(icon, 'Pause',
107
+ shortcut='Ctrl+p', shortcut_widget=self.area)
108
+ self.pause_pb.setCheckable(True)
109
+ self.pause_pb.setToolTip("Ctrl+p key shortcut")
110
+ self.pause_pb.clicked.connect(self.pause)
111
+ hor_layout.addWidget(self.pause_pb)
112
+
113
+ icon = QtGui.QIcon()
114
+ icon.addPixmap(QtGui.QPixmap("icons:Refresh2.png"), QtGui.QIcon.Normal,
115
+ QtGui.QIcon.Off)
116
+ self.reset_pb = PushButtonShortcut(icon, 'Reset',
117
+ shortcut='F5', shortcut_widget=self.area)
118
+ self.reset_pb.setToolTip('F5 key shortcut')
119
+ self.reset_pb.clicked.connect(self.reset)
120
+ hor_layout.addWidget(self.reset_pb)
121
+
122
+ self.dock_controls.addWidget(self.widget_controls)
123
+
124
+ def get_times(self, duration):
125
+ seconds = int(duration.total_seconds() % 60)
126
+ total_minutes = duration.total_seconds() // 60
127
+ minutes = int(total_minutes % 60)
128
+ hours = int(total_minutes // 60)
129
+
130
+ return hours, minutes, seconds
131
+
132
+ def get_elapsed_time(self):
133
+ return time.perf_counter() - self.ini_time
134
+
135
+ def display_time(self):
136
+ elapsed_time = self.get_elapsed_time()
137
+ if self.type == 'timer':
138
+ display_timedelta = self.duration - timedelta(seconds=elapsed_time)
139
+ else:
140
+ display_timedelta = self.duration + timedelta(seconds=elapsed_time)
141
+
142
+ self.displayed_time = display_timedelta.total_seconds()
143
+ if display_timedelta.total_seconds() <= 0:
144
+ self.reset()
145
+ return
146
+ else:
147
+ hours, minutes, seconds = self.get_times(display_timedelta)
148
+
149
+ self.time_lcd.display(
150
+ '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds))
151
+ QtWidgets.QApplication.processEvents()
152
+
153
+ def start(self):
154
+ self.ini_time = time.perf_counter()
155
+ self.timer.start()
156
+ self.started = True
157
+ self.start_pb.setEnabled(False)
158
+
159
+ def pause(self):
160
+ if self.pause_pb.isChecked():
161
+ self.started = False
162
+ self.timer.stop()
163
+ self.paused_time = time.perf_counter()
164
+ else:
165
+ elapsed_pause_time = time.perf_counter() - self.paused_time
166
+ self.ini_time += elapsed_pause_time
167
+ self.timer.start()
168
+ self.started = True
169
+
170
+ def reset(self):
171
+ if self.pause_pb.isChecked():
172
+ self.pause_pb.setChecked(False)
173
+ QtWidgets.QApplication.processEvents()
174
+ self.timer.stop()
175
+ self.start_pb.setEnabled(True)
176
+ self.started = False
177
+ hours, minutes, seconds = self.get_times(self.duration)
178
+ self.time_lcd.display(
179
+ '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds))
180
+
181
+ def set_lcd_color(self, lcd, color):
182
+ palette = lcd.palette()
183
+ # lcd.setPalette(QtGui.QPalette(Qt.red))
184
+ if hasattr(Qt, color):
185
+ palette.setBrush(palette.WindowText, getattr(Qt, color))
186
+ palette.setColor(palette.Window, QtGui.QColor(0, 0, 0))
187
+ lcd.setPalette(palette)
188
+
189
+
190
+ if __name__ == '__main__':
191
+ app = QtWidgets.QApplication(sys.argv)
192
+
193
+ form = QtWidgets.QWidget()
194
+ win = QtWidgets.QMainWindow()
195
+ win.setVisible(False)
196
+ area = DockArea()
197
+ win.setCentralWidget(area)
198
+ win.setWindowTitle('Chrono Timer')
199
+
200
+ # prog = ChronoTimer(area, dict(hours=1, minutes=0, seconds=0))
201
+ prog = ChronoTimer(area)
202
+ win.show()
203
+ sys.exit(app.exec_())