pymodaq 4.2.4__py3-none-any.whl → 5.0.0__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.

Potentially problematic release.


This version of pymodaq might be problematic. Click here for more details.

Files changed (399) hide show
  1. pymodaq/__init__.py +30 -23
  2. pymodaq/control_modules/daq_move.py +27 -14
  3. pymodaq/control_modules/daq_move_ui.py +28 -12
  4. pymodaq/control_modules/daq_viewer.py +38 -28
  5. pymodaq/control_modules/daq_viewer_ui.py +6 -6
  6. pymodaq/control_modules/mocks.py +1 -1
  7. pymodaq/control_modules/move_utility_classes.py +19 -10
  8. pymodaq/control_modules/utils.py +18 -12
  9. pymodaq/control_modules/viewer_utility_classes.py +13 -4
  10. pymodaq/dashboard.py +164 -115
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +6 -6
  13. pymodaq/examples/function_plotter.py +13 -12
  14. pymodaq/examples/parameter_ex.py +50 -25
  15. pymodaq/examples/tcp_client.py +1 -1
  16. pymodaq/extensions/__init__.py +1 -1
  17. pymodaq/extensions/bayesian/bayesian_optimisation.py +15 -12
  18. pymodaq/extensions/bayesian/utils.py +10 -10
  19. pymodaq/extensions/console.py +10 -13
  20. pymodaq/extensions/{daq_logger.py → daq_logger/daq_logger.py} +36 -56
  21. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger.py +16 -15
  22. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger_models.py +2 -0
  23. pymodaq/{utils/h5modules → extensions/daq_logger}/h5logging.py +7 -8
  24. pymodaq/extensions/daq_scan.py +153 -247
  25. pymodaq/extensions/daq_scan_ui.py +11 -9
  26. pymodaq/extensions/h5browser.py +8 -8
  27. pymodaq/extensions/pid/__init__.py +6 -3
  28. pymodaq/extensions/pid/daq_move_PID.py +4 -2
  29. pymodaq/extensions/pid/pid_controller.py +15 -12
  30. pymodaq/extensions/pid/utils.py +10 -5
  31. pymodaq/extensions/utils.py +5 -3
  32. pymodaq/post_treatment/load_and_plot.py +10 -7
  33. pymodaq/resources/preset_default.xml +1 -1
  34. pymodaq/utils/array_manipulation.py +4 -384
  35. pymodaq/utils/calibration_camera.py +12 -9
  36. pymodaq/utils/chrono_timer.py +7 -5
  37. pymodaq/utils/config.py +3 -450
  38. pymodaq/utils/daq_utils.py +6 -708
  39. pymodaq/utils/data.py +9 -2774
  40. pymodaq/utils/exceptions.py +0 -4
  41. pymodaq/utils/gui_utils/__init__.py +8 -8
  42. pymodaq/utils/gui_utils/loader_utils.py +38 -0
  43. pymodaq/utils/gui_utils/utils.py +6 -138
  44. pymodaq/utils/h5modules/__init__.py +0 -4
  45. pymodaq/utils/h5modules/module_saving.py +15 -8
  46. pymodaq/utils/leco/__init__.py +2 -2
  47. pymodaq/utils/leco/daq_move_LECODirector.py +2 -2
  48. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +2 -2
  49. pymodaq/utils/leco/director_utils.py +2 -2
  50. pymodaq/utils/leco/leco_director.py +3 -3
  51. pymodaq/utils/leco/pymodaq_listener.py +2 -2
  52. pymodaq/utils/leco/utils.py +1 -1
  53. pymodaq/utils/logger.py +4 -76
  54. pymodaq/utils/managers/batchscan_manager.py +16 -19
  55. pymodaq/utils/managers/modules_manager.py +10 -7
  56. pymodaq/utils/managers/overshoot_manager.py +3 -5
  57. pymodaq/utils/managers/preset_manager.py +37 -15
  58. pymodaq/utils/managers/preset_manager_utils.py +11 -9
  59. pymodaq/utils/managers/remote_manager.py +12 -10
  60. pymodaq/utils/math_utils.py +4 -572
  61. pymodaq/utils/parameter/__init__.py +4 -11
  62. pymodaq/utils/parameter/utils.py +4 -299
  63. pymodaq/utils/scanner/scan_config.py +1 -1
  64. pymodaq/utils/scanner/scan_factory.py +16 -12
  65. pymodaq/utils/{plotting → scanner}/scan_selector.py +19 -20
  66. pymodaq/utils/scanner/scanner.py +10 -8
  67. pymodaq/utils/scanner/scanners/_1d_scanners.py +8 -5
  68. pymodaq/utils/scanner/scanners/_2d_scanners.py +5 -5
  69. pymodaq/utils/scanner/scanners/sequential.py +8 -8
  70. pymodaq/utils/scanner/scanners/tabular.py +9 -9
  71. pymodaq/utils/scanner/utils.py +6 -4
  72. pymodaq/utils/svg/svg_viewer2D.py +3 -4
  73. pymodaq/utils/tcp_ip/serializer.py +64 -16
  74. pymodaq/utils/tcp_ip/tcp_server_client.py +10 -8
  75. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. pymodaq/post_treatment/process_to_scalar.py +0 -263
  78. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  311. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  312. pymodaq/resources/VERSION +0 -1
  313. pymodaq/resources/config_template.toml +0 -94
  314. pymodaq/resources/triangulation_data.npy +0 -0
  315. pymodaq/utils/abstract/__init__.py +0 -48
  316. pymodaq/utils/db/__init__.py +0 -0
  317. pymodaq/utils/db/db_logger/__init__.py +0 -0
  318. pymodaq/utils/enums.py +0 -76
  319. pymodaq/utils/factory.py +0 -82
  320. pymodaq/utils/gui_utils/custom_app.py +0 -133
  321. pymodaq/utils/gui_utils/dock.py +0 -107
  322. pymodaq/utils/gui_utils/file_io.py +0 -93
  323. pymodaq/utils/gui_utils/layout.py +0 -34
  324. pymodaq/utils/gui_utils/list_picker.py +0 -38
  325. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  326. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  327. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  328. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  329. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  330. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  331. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  332. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  333. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  334. pymodaq/utils/h5modules/backends.py +0 -1022
  335. pymodaq/utils/h5modules/browsing.py +0 -625
  336. pymodaq/utils/h5modules/data_saving.py +0 -1105
  337. pymodaq/utils/h5modules/exporter.py +0 -119
  338. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  339. pymodaq/utils/h5modules/exporters/base.py +0 -111
  340. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  341. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  342. pymodaq/utils/h5modules/saving.py +0 -866
  343. pymodaq/utils/h5modules/utils.py +0 -115
  344. pymodaq/utils/managers/action_manager.py +0 -489
  345. pymodaq/utils/managers/parameter_manager.py +0 -282
  346. pymodaq/utils/managers/roi_manager.py +0 -726
  347. pymodaq/utils/messenger.py +0 -66
  348. pymodaq/utils/parameter/ioxml.py +0 -542
  349. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  350. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  351. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  352. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  353. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  354. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  355. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  356. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  357. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  358. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  359. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  360. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  361. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  362. pymodaq/utils/plotting/__init__.py +0 -0
  363. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  364. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  365. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  366. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  367. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -826
  368. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  369. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  370. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  371. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  372. pymodaq/utils/plotting/gant_chart.py +0 -123
  373. pymodaq/utils/plotting/image_viewer.py +0 -97
  374. pymodaq/utils/plotting/items/__init__.py +0 -0
  375. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  376. pymodaq/utils/plotting/items/crosshair.py +0 -94
  377. pymodaq/utils/plotting/items/image.py +0 -388
  378. pymodaq/utils/plotting/navigator.py +0 -353
  379. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  380. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  381. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  382. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  383. pymodaq/utils/plotting/utils/__init__.py +0 -0
  384. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  385. pymodaq/utils/plotting/utils/filter.py +0 -585
  386. pymodaq/utils/plotting/utils/lineout.py +0 -226
  387. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  388. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  389. pymodaq/utils/plotting/widgets.py +0 -76
  390. pymodaq/utils/qvariant.py +0 -12
  391. pymodaq/utils/slicing.py +0 -63
  392. pymodaq/utils/units.py +0 -216
  393. pymodaq-4.2.4.dist-info/RECORD +0 -438
  394. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  395. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  396. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  397. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +0 -0
  398. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -18,40 +18,48 @@ import numpy as np
18
18
  from qtpy import QtWidgets, QtCore, QtGui
19
19
  from qtpy.QtCore import QObject, Slot, QThread, Signal, QDateTime, QDate, QTime
20
20
 
21
- from pymodaq.utils import data as data_mod
22
- from pymodaq.utils.logger import set_logger, get_module_name
23
- from pymodaq.utils.config import Config, get_set_preset_path
24
- from pymodaq.utils.parameter import ioxml
25
- from pymodaq.utils.plotting.data_viewers import ViewersEnum
26
- from pymodaq.utils.managers.parameter_manager import ParameterManager, Parameter, ParameterTree
27
-
28
- from pymodaq.utils import exceptions
29
- from pymodaq.utils.plotting.data_viewers.viewer2D import Viewer2D
30
- from pymodaq.utils.plotting.data_viewers.viewer1D import Viewer1D
31
- from pymodaq.utils.plotting.navigator import Navigator
32
- from pymodaq.utils.plotting.scan_selector import ScanSelector, SelectorItem
21
+ from pymodaq_utils.logger import set_logger, get_module_name
22
+ from pymodaq_utils.config import Config
23
+ from pymodaq_utils import utils
24
+
25
+ from pymodaq_data import data as data_mod
26
+ from pymodaq_data.h5modules import data_saving
27
+
28
+ from pymodaq_gui.parameter import ioxml
29
+ from pymodaq_gui.plotting.data_viewers import ViewersEnum
30
+ from pymodaq_gui.managers.parameter_manager import ParameterManager, Parameter, ParameterTree
31
+ from pymodaq_gui.plotting.navigator import Navigator
32
+
33
+ from pymodaq_gui.messenger import messagebox
34
+ from pymodaq_gui import utils as gutils
35
+ from pymodaq_gui.h5modules.saving import H5Saver
36
+
33
37
  from pymodaq.utils.scanner.scanner import Scanner, scanner_factory #, adaptive, adaptive_losses
34
38
  from pymodaq.utils.managers.batchscan_manager import BatchScanner
35
39
  from pymodaq.utils.managers.modules_manager import ModulesManager
36
40
  from pymodaq.post_treatment.load_and_plot import LoaderPlotter
37
- from pymodaq.utils.messenger import messagebox
38
41
  from pymodaq.extensions.daq_scan_ui import DAQScanUI
42
+ from pymodaq.utils.h5modules import module_saving
43
+
44
+ from pymodaq.utils.scanner.scan_selector import ScanSelector, SelectorItem
45
+ from pymodaq.utils.data import DataActuator
39
46
 
40
- from pymodaq.utils import daq_utils as utils
41
- from pymodaq.utils import gui_utils as gutils
42
- from pymodaq.utils.h5modules.saving import H5Saver
43
- from pymodaq.utils.h5modules import module_saving, data_saving
44
- from pymodaq.utils.data import DataToExport, DataActuator
45
47
 
46
48
  if TYPE_CHECKING:
47
49
  from pymodaq.dashboard import DashBoard
48
50
 
49
51
  config = Config()
52
+
50
53
  logger = set_logger(get_module_name(__file__))
51
54
 
52
55
  SHOW_POPUPS = config('scan', 'show_popups')
53
56
 
54
57
 
58
+ class DAQ_ScanException(Exception):
59
+ """Raised when an error occur within the DAQScan"""
60
+ pass
61
+
62
+
55
63
  class ScanDataTemp:
56
64
  """Convenience class to hold temporary data to be plotted in the live plots"""
57
65
  def __init__(self, scan_index: int, indexes: Tuple[int], data: data_mod.DataToExport):
@@ -136,15 +144,15 @@ class DAQScan(QObject, ParameterManager):
136
144
  self.plot_colors = utils.plot_colors
137
145
 
138
146
  self.scan_thread: QThread = None
147
+ self._h5saver: H5Saver = None
148
+ self._module_and_data_saver: module_saving.ScanSaver = None
139
149
 
140
150
  self.modules_manager = ModulesManager(self.dashboard.detector_modules, self.dashboard.actuators_modules)
141
151
  self.modules_manager.settings.child('data_dimensions').setOpts(expanded=False)
142
152
  self.modules_manager.settings.child('actuators_positions').setOpts(expanded=False)
143
153
  self.modules_manager.detectors_changed.connect(self.clear_plot_from)
144
154
 
145
- self.h5saver = H5Saver()
146
155
  self.module_and_data_saver = module_saving.ScanSaver(self)
147
- self.module_and_data_saver.h5saver = self.h5saver
148
156
 
149
157
  self.extended_saver: data_saving.DataToExportExtendedSaver = None
150
158
  self.h5temp: H5Saver = None
@@ -276,7 +284,7 @@ class DAQScan(QObject, ParameterManager):
276
284
  except Exception as e:
277
285
  logger.exception(str(e))
278
286
 
279
- self.h5saver.close_file()
287
+ self.close_file()
280
288
  self.mainwindow.close()
281
289
 
282
290
  except Exception as e:
@@ -384,8 +392,6 @@ class DAQScan(QObject, ParameterManager):
384
392
 
385
393
  def show_file_content(self):
386
394
  try:
387
- self.h5saver.init_file(addhoc_file_path=
388
- self.h5saver.settings.child('current_h5_file').value())
389
395
  self.h5saver.show_file_content()
390
396
  except Exception as e:
391
397
  logger.exception(str(e))
@@ -501,14 +507,42 @@ class DAQScan(QObject, ParameterManager):
501
507
  def create_new_file(self, new_file):
502
508
  if new_file:
503
509
  self._metada_dataset_set = False
504
- self.h5saver.close_file()
505
- self.h5saver.init_file(update_h5=new_file)
506
- self.module_and_data_saver.h5saver = self.h5saver
510
+ self.close_file()
511
+
512
+ self.module_and_data_saver.h5saver = self.h5saver # force it for detectors to update their h5saver
507
513
  res = self.update_file_settings()
508
514
  if new_file:
509
515
  self.ui.enable_start_stop()
510
516
  return res
511
517
 
518
+ @property
519
+ def h5saver(self):
520
+ if self._h5saver is None:
521
+ self._h5saver = H5Saver(backend=config('general', 'hdf5_backend'))
522
+ if self._h5saver.h5_file is None:
523
+ self._h5saver.init_file(update_h5=True)
524
+ if not self._h5saver.isopen():
525
+ self._h5saver.init_file(addhoc_file_path=self._h5saver.settings['current_h5_file'])
526
+ return self._h5saver
527
+
528
+ @h5saver.setter
529
+ def h5saver(self, h5saver_temp: H5Saver):
530
+ self._h5saver = h5saver_temp
531
+
532
+ def close_file(self):
533
+ self.h5saver.close_file()
534
+
535
+ @property
536
+ def module_and_data_saver(self):
537
+ if not self._module_and_data_saver.h5saver.isopen():
538
+ self._module_and_data_saver.h5saver = self.h5saver
539
+ return self._module_and_data_saver
540
+
541
+ @module_and_data_saver.setter
542
+ def module_and_data_saver(self, mod: module_saving.ScanSaver):
543
+ self._module_and_data_saver = mod
544
+ self._module_and_data_saver.h5saver = self.h5saver
545
+
512
546
  def update_file_settings(self):
513
547
  try:
514
548
  res = True
@@ -520,18 +554,6 @@ class DAQScan(QObject, ParameterManager):
520
554
  self.navigator.update_h5file(self.h5saver.h5_file)
521
555
  self.navigator.settings.child('settings', 'filepath').setValue(self.h5saver.h5_file.filename)
522
556
 
523
- # # set attributes to the current group, such as scan_type....
524
- # self.scan_attributes.child('scan_info', 'scan_type').setValue(
525
- # self.scanner.settings.child('scan_type').value())
526
- # self.scan_attributes.child('scan_info', 'scan_sub_type').setValue(
527
- # self.scanner.settings.child('scan_sub_type').value())
528
- #
529
- # scan_node = self.module_and_data_saver.get_set_node()
530
- # self.scan_attributes.child('scan_info', 'scan_name').setValue(scan_node.name)
531
- # self.scan_attributes.child('scan_info', 'description').setValue('')
532
- #
533
- # res = self.set_metadata_about_current_scan()
534
-
535
557
  return res
536
558
 
537
559
  except Exception as e:
@@ -550,6 +572,7 @@ class DAQScan(QObject, ParameterManager):
550
572
  scan_name = scan_node.name
551
573
  self.scan_attributes.child('scan_info', 'scan_name').setValue(scan_name)
552
574
  self.scan_attributes.child('scan_info', 'description').setValue('')
575
+ self.h5saver.settings.child('current_scan_name').setValue(scan_name)
553
576
 
554
577
  res = self.set_metadata_about_current_scan()
555
578
  return res
@@ -572,7 +595,7 @@ class DAQScan(QObject, ParameterManager):
572
595
  positions = [posx, posy]
573
596
  positions = positions[:self.scanner.n_axes]
574
597
  actuators = self.modules_manager.actuators
575
- dte = DataToExport(name="move_at")
598
+ dte = data_mod.DataToExport(name="move_at")
576
599
  for ind, pos in enumerate(positions):
577
600
  dte.append(DataActuator(actuators[ind].title, data=float(pos)))
578
601
 
@@ -614,54 +637,50 @@ class DAQScan(QObject, ParameterManager):
614
637
  data_names.extend(self.settings['plot_options', 'plot_1d']['selected'][:])
615
638
  self.live_plotter.prepare_viewers(viewers_enum, viewers_name=data_names)
616
639
 
617
- def update_status(self, txt, wait_time=0, log_type=None):
618
- """
619
- Show the txt message in the status bar with a delay of wait_time ms.
640
+ def update_status(self, txt: str, wait_time=0):
641
+ """ Show the txt message in the status bar with a delay of wait_time ms.
620
642
 
621
- =============== =========== =======================
622
- **Parameters** **Type** **Description**
623
- *txt* string The message to show
624
- *wait_time* int the delay of showing
625
- *log_type* string the type of the log
626
- =============== =========== =======================
643
+ add an info log in the logger
644
+
645
+ Parameters
646
+ ----------
647
+ txt: str
648
+ the message to log
649
+ wait_time: int
650
+ leave the message apparent in the status bar for this duration in ms
627
651
  """
628
652
  self.ui.display_status(txt, wait_time)
629
653
  self.status_signal.emit(txt)
630
654
  logger.info(txt)
631
655
 
632
- @Slot(list)
633
- def thread_status(self, status): # general function to get datas/infos from all threads back to the main
634
- """
635
- | General function to get datas/infos from all threads back to the main.
636
- |
656
+ def thread_status(self, status: utils.ThreadCommand):
657
+ """ General function to get datas/infos from child thread back to the main.
637
658
 
638
- Switch the status with :
639
- * *"Update status"* : Update the status bar with the status attribute txt message
640
- * *"Update_scan_index"* : Set the value of the User Interface - indice_scan_sb attribute.
641
- * *"Scan_done"* : Save the scan and init the positions
642
- * *"Timeout"* : Set the "Timeout occured" in the User Interface-log message
659
+ Possible commands are:
643
660
 
644
- See Also
645
- --------
646
- update_status, save_scan, set_ini_positions
661
+ * "Update_Status"
662
+ * "Update_scan_index"
663
+ * "Scan_done"
664
+ * "Timeout"
647
665
  """
648
- if status[0] == "Update_Status":
649
- self.update_status(status[1], wait_time=self.wait_time)
666
+ if status.command == "Update_Status":
667
+ self.update_status(status.attribute, wait_time=self.wait_time)
650
668
 
651
- elif status[0] == "Update_scan_index":
669
+ elif status.command == "Update_scan_index":
652
670
  # status[1] = [ind_scan,ind_average]
653
- self.ind_scan = status[1][0]
654
- self.ui.set_scan_step(status[1][0] + 1)
655
- self.ind_average = status[1][1]
656
- self.ui.set_scan_step_average(status[1][1] + 1)
671
+ self.ind_scan = status.attribute[0]
672
+ self.ui.set_scan_step(status.attribute[0] + 1)
673
+ self.ind_average = status.attribute[1]
674
+ self.ui.set_scan_step_average(status.attribute[1] + 1)
657
675
 
658
- elif status[0] == "Scan_done":
676
+ elif status.command == "Scan_done":
659
677
  self.modules_manager.reset_signals()
660
678
  self.live_timer.stop()
661
679
  self.ui.set_scan_done()
662
680
  scan_node = self.module_and_data_saver.get_last_node()
663
681
  scan_node.attrs['scan_done'] = True
664
682
  self.module_and_data_saver.flush()
683
+ self.close_file()
665
684
 
666
685
  if not self.batch_started:
667
686
  if not self.dashboard.overshoot:
@@ -669,7 +688,7 @@ class DAQScan(QObject, ParameterManager):
669
688
  self.ui.set_action_enabled('ini_positions', True)
670
689
  self.ui.set_action_enabled('start', True)
671
690
 
672
- # reactivate module controls usiong remote_control
691
+ # reactivate module controls using remote_control
673
692
  if hasattr(self.dashboard, 'remote_manager'):
674
693
  remote_manager = getattr(self.dashboard, 'remote_manager')
675
694
  remote_manager.activate_all(True)
@@ -679,9 +698,15 @@ class DAQScan(QObject, ParameterManager):
679
698
  self.ind_batch += 1
680
699
  self.loop_scan_batch()
681
700
 
682
- elif status[0] == "Timeout":
701
+ elif status.command == "Timeout":
683
702
  self.ui.set_permanent_status('Timeout occurred')
684
703
 
704
+ elif status.command == 'add_data':
705
+ self.module_and_data_saver.add_data(**status.attribute)
706
+
707
+ elif status.command == 'add_nav_axes':
708
+ self.module_and_data_saver.add_nav_axes(status.attribute)
709
+
685
710
  ############
686
711
  # PLOTTING
687
712
 
@@ -726,35 +751,36 @@ class DAQScan(QObject, ParameterManager):
726
751
 
727
752
  def set_scan(self, scan=None) -> bool:
728
753
  """
729
- Sets the current scan given the selected settings. Makes some checks, increments the h5 file scans.
754
+ Sets the current scan given the selected settings. Makes some checks,
755
+ increments the h5 file scans.
730
756
  In case the dialog is cancelled, return False and aborts the scan
731
757
  """
732
758
  try:
733
- # set the filename and path
734
- if self.h5saver.h5_file is None: # only the first time start scan is called
735
- self.create_new_file(True)
736
759
  res = self.update_scan_info()
737
760
  if not res:
738
761
  return False
739
762
 
740
763
  is_oversteps = self.scanner.set_scan()
741
764
  if is_oversteps:
742
- messagebox(text=f"An error occurred when establishing the scan steps. Actual settings "
743
- f"gives approximately {int(self.scanner.n_steps)} steps."
744
- f" Please check the steps number "
745
- f"limit in the config file ({config['scan']['steps_limit']}) or modify"
746
- f" your scan settings.")
765
+ messagebox(
766
+ text=f"An error occurred when establishing the scan steps. Actual settings "
767
+ f"gives approximately {int(self.scanner.n_steps)} steps."
768
+ f" Please check the steps number "
769
+ f"limit in the config file ({config['scan']['steps_limit']}) or modify"
770
+ f" your scan settings.")
747
771
 
748
772
  if self.modules_manager.Nactuators != self.scanner.n_axes:
749
- messagebox(text="There are not enough or too much selected move modules for this scan")
773
+ messagebox(
774
+ text="There are not enough or too much selected move modules for this scan")
750
775
  return False
751
776
 
752
777
  if self.scanner.scan_sub_type == 'Adaptive':
753
778
  #todo include this in scanners objects for the adaptive scanners
754
779
  if len(self.modules_manager.get_selected_probed_data('0D')) == 0:
755
- messagebox(text="In adaptive mode, you have to pick a 0D signal from which the algorithm will"
756
- " determine the next positions to scan, see 'probe_data' in the modules selector"
757
- " panel")
780
+ messagebox(
781
+ text="In adaptive mode, you have to pick a 0D signal from which the "
782
+ "algorithm will determine the next positions to scan, see 'probe_data'"
783
+ " in the modules selector panel")
758
784
  return False
759
785
 
760
786
  self.ui.n_scan_steps = self.scanner.n_steps
@@ -762,11 +788,11 @@ class DAQScan(QObject, ParameterManager):
762
788
  # check if the modules are initialized
763
789
  for module in self.modules_manager.actuators:
764
790
  if not module.initialized_state:
765
- raise exceptions.DAQ_ScanException('module ' + module.title + " is not initialized")
791
+ raise DAQ_ScanException('module ' + module.title + " is not initialized")
766
792
 
767
793
  for module in self.modules_manager.detectors:
768
794
  if not module.initialized_state:
769
- raise exceptions.DAQ_ScanException('module ' + module.title + " is not initialized")
795
+ raise DAQ_ScanException('module ' + module.title + " is not initialized")
770
796
 
771
797
  self.ui.enable_start_stop(True)
772
798
  return True
@@ -831,12 +857,15 @@ class DAQScan(QObject, ParameterManager):
831
857
  remote_manager = getattr(self.dashboard, 'remote_manager')
832
858
  remote_manager.activate_all(False)
833
859
 
834
- self.module_and_data_saver.h5saver = self.h5saver
835
860
  new_scan = self.module_and_data_saver.get_last_node().attrs['scan_done'] # get_last_node
836
861
  scan_node = self.module_and_data_saver.get_set_node(new=new_scan)
837
862
  self.save_metadata(scan_node, 'scan_info')
838
863
 
839
864
  self._init_live()
865
+ for det in self.modules_manager.detectors:
866
+ det.module_and_data_saver = (
867
+ module_saving.DetectorExtendedSaver(det, self.scanner.get_scan_shape()))
868
+ self.module_and_data_saver.h5saver = self.h5saver # force the update as the h5saver ill also be set on each detectors
840
869
 
841
870
  # mandatory to deal with multithreads
842
871
  if self.scan_thread is not None:
@@ -849,14 +878,14 @@ class DAQScan(QObject, ParameterManager):
849
878
 
850
879
  self.scan_thread = QThread()
851
880
 
852
- scan_acquisition = DAQScanAcquisition(self.settings, self.scanner, self.h5saver.settings,
853
- self.modules_manager,
854
- module_saver=self.module_and_data_saver)
881
+ scan_acquisition = DAQScanAcquisition(self.settings, self.scanner, self.modules_manager,
882
+ )
883
+
855
884
  if config['scan']['scan_in_thread']:
856
885
  scan_acquisition.moveToThread(self.scan_thread)
857
886
  self.command_daq_signal[utils.ThreadCommand].connect(scan_acquisition.queue_command)
858
887
  scan_acquisition.scan_data_tmp[ScanDataTemp].connect(self.save_temp_live_data)
859
- scan_acquisition.status_sig[list].connect(self.thread_status)
888
+ scan_acquisition.status_sig[utils.ThreadCommand].connect(self.thread_status)
860
889
 
861
890
  self.scan_thread.scan_acquisition = scan_acquisition
862
891
  self.scan_thread.start()
@@ -920,7 +949,7 @@ class DAQScan(QObject, ParameterManager):
920
949
  else:
921
950
  status = 'Data Acquisition has been stopped due to overshoot'
922
951
 
923
- self.update_status(status, log_type='log')
952
+ self.update_status(status)
924
953
  self.ui.set_permanent_status('')
925
954
 
926
955
  self.ui.set_action_enabled('ini_positions', True)
@@ -945,18 +974,17 @@ class DAQScanAcquisition(QObject):
945
974
 
946
975
  """
947
976
  scan_data_tmp = Signal(ScanDataTemp)
948
- status_sig = Signal(list)
977
+ status_sig = Signal(utils.ThreadCommand)
949
978
 
950
979
  def __init__(self, scan_settings: Parameter = None, scanner: Scanner = None,
951
- h5saver_settings: Parameter = None, modules_manager: ModulesManager = None,
952
- module_saver: module_saving.ScanSaver = None):
980
+ modules_manager: ModulesManager = None,):
953
981
 
954
982
  """
955
983
  DAQScanAcquisition deal with the acquisition part of daq_scan, that is transferring commands to modules,
956
984
  getting back data, saviong and letting know th UI about the scan status
957
985
 
958
986
  """
959
-
987
+
960
988
  super().__init__()
961
989
 
962
990
  self.scan_settings = scan_settings
@@ -979,14 +1007,6 @@ class DAQScanAcquisition(QObject):
979
1007
 
980
1008
  self.det_done_datas = data_mod.DataToExport('ScanData')
981
1009
 
982
- self.h5saver = H5Saver()
983
- self.h5saver.settings.restoreState(h5saver_settings.saveState())
984
- self.h5saver.init_file(addhoc_file_path=self.h5saver.settings['current_h5_file'])
985
-
986
- self.module_and_data_saver: module_saving.ScanSaver = module_saver
987
-
988
- # update the DAQ_Viewer's detector saver to DetectorExtendedSaver to take into account extended
989
- # arrays due to scan shape and eventual averaging
990
1010
  scan_shape = self.scanner.get_scan_shape()
991
1011
  if self.Naverage > 1:
992
1012
  self.scan_shape = [self.Naverage]
@@ -994,12 +1014,7 @@ class DAQScanAcquisition(QObject):
994
1014
  else:
995
1015
  self.scan_shape = scan_shape
996
1016
 
997
- for det in self.modules_manager.detectors:
998
- det.module_and_data_saver = module_saving.DetectorExtendedSaver(det, self.scan_shape)
999
- self.module_and_data_saver.h5saver = self.h5saver # will update its h5saver and all submodules's h5saver
1000
-
1001
- @Slot(utils.ThreadCommand)
1002
- def queue_command(self, command):
1017
+ def queue_command(self, command: utils.ThreadCommand):
1003
1018
  """Process the commands sent by the main ui
1004
1019
 
1005
1020
  Parameters
@@ -1039,7 +1054,8 @@ class DAQScanAcquisition(QObject):
1039
1054
  Naxes = self.scanner.n_axes
1040
1055
  scan_type = self.scanner.scan_type
1041
1056
  self.navigation_axes = self.scanner.get_nav_axes()
1042
- self.status_sig.emit(["Update_Status", "Acquisition has started", 'log'])
1057
+ self.status_sig.emit(utils.ThreadCommand("Update_Status",
1058
+ attribute="Acquisition has started"))
1043
1059
 
1044
1060
  self.timeout_scan_flag = False
1045
1061
  for ind_average in range(self.Naverage):
@@ -1068,7 +1084,9 @@ class DAQScanAcquisition(QObject):
1068
1084
  # position = (vec.vectorize() * frac_curvilinear).translate_to(vec.p1()).p2()
1069
1085
  # positions = [position.x(), position.y()]
1070
1086
 
1071
- self.status_sig.emit(["Update_scan_index", [self.ind_scan, ind_average]])
1087
+ self.status_sig.emit(
1088
+ utils.ThreadCommand("Update_scan_index",
1089
+ attribute=[self.ind_scan, ind_average]))
1072
1090
 
1073
1091
  if self.stop_scan_flag or self.timeout_scan_flag:
1074
1092
  break
@@ -1098,16 +1116,15 @@ class DAQScanAcquisition(QObject):
1098
1116
  # daq_scan wait time
1099
1117
  QThread.msleep(self.scan_settings.child('time_flow', 'wait_time').value())
1100
1118
 
1101
- self.h5saver.flush()
1102
1119
  self.modules_manager.connect_actuators(False)
1103
1120
  self.modules_manager.connect_detectors(False)
1104
1121
 
1105
- self.status_sig.emit(["Update_Status", "Acquisition has finished", 'log'])
1106
- self.status_sig.emit(["Scan_done"])
1122
+ self.status_sig.emit(utils.ThreadCommand("Update_Status",
1123
+ attribute="Acquisition has finished"))
1124
+ self.status_sig.emit(utils.ThreadCommand("Scan_done"))
1107
1125
 
1108
1126
  except Exception as e:
1109
1127
  logger.exception(str(e))
1110
- # self.status_sig.emit(["Update_Status", getLineInfo() + str(e), 'log'])
1111
1128
 
1112
1129
  def det_done(self, det_done_datas: data_mod.DataToExport, positions):
1113
1130
  """
@@ -1125,9 +1142,11 @@ class DAQScanAcquisition(QObject):
1125
1142
  nav_axis.index += 1
1126
1143
  nav_axes.append(data_mod.Axis('Average', data=np.linspace(0, self.Naverage - 1, self.Naverage),
1127
1144
  index=0))
1128
- self.module_and_data_saver.add_nav_axes(nav_axes)
1145
+ self.status_sig.emit(utils.ThreadCommand("add_nav_axes", nav_axes))
1129
1146
 
1130
- self.module_and_data_saver.add_data(indexes=indexes, distribution=self.scanner.distribution)
1147
+ self.status_sig.emit(
1148
+ utils.ThreadCommand("add_data",
1149
+ dict(indexes=indexes, distribution=self.scanner.distribution)))
1131
1150
 
1132
1151
  #todo related to adaptive (solution lies along the Enlargeable data saver)
1133
1152
  if self.isadaptive:
@@ -1145,144 +1164,31 @@ class DAQScanAcquisition(QObject):
1145
1164
 
1146
1165
  except Exception as e:
1147
1166
  logger.exception(str(e))
1148
- # self.status_sig.emit(["Update_Status", getLineInfo() + str(e), 'log'])
1149
1167
 
1150
1168
  def timeout(self):
1151
1169
  """
1152
1170
  Send the status signal *'Time out during acquisition'*.
1153
1171
  """
1154
1172
  self.timeout_scan_flag = True
1155
- self.status_sig.emit(["Update_Status", "Timeout during acquisition", 'log'])
1156
- self.status_sig.emit(["Timeout"])
1157
-
1158
-
1159
-
1160
- def main_test(init_qt=True):
1161
- from pymodaq.utils.data import DataToExport
1162
-
1163
- LABEL = 'A Label'
1164
- UNITS = 'units'
1165
- OFFSET = -20.4
1166
- SCALING = 0.22
1167
- SIZE = 20
1168
- DATA = OFFSET + SCALING * np.linspace(0, SIZE - 1, SIZE)
1169
-
1170
- DATA0D = np.array([2.7])
1171
- DATA1D = np.arange(0, 10)
1172
- DATA2D = np.arange(0, 5 * 6).reshape((5, 6))
1173
- DATAND = np.arange(0, 5 * 6 * 3).reshape((5, 6, 3))
1174
-
1175
- def init_axis(data=None, index=0):
1176
- if data is None:
1177
- data = DATA
1178
- return data_mod.Axis(label=LABEL, units=UNITS, data=data, index=index)
1179
-
1180
- def init_data(data=None, Ndata=1, axes=[], name='myData') -> data_mod.DataWithAxes:
1181
- if data is None:
1182
- data = DATA2D
1183
- return data_mod.DataWithAxes(name, data_mod.DataSource(0), data=[data for ind in range(Ndata)],
1184
- axes=axes)
1185
-
1186
- class ActuatorMock(QtCore.QObject):
1187
- mod_name = 'act'
1188
- move_done_signal = Signal(str, float)
1189
- command_hardware = Signal(utils.ThreadCommand)
1190
-
1191
- def __init__(self, ind):
1192
- super().__init__()
1193
- self.title = f'{self.mod_name}_{ind:02d}'
1194
- self.units = f'unit_{ind:02d}'
1195
- self.initialized_state = True
1196
- self.module_and_data_saver = module_saving.ActuatorSaver(self)
1197
- self.settings = Parameter.create(name='settings', type='str', value='mysettings')
1198
- self.ui = None
1199
- self.command_hardware.connect(self.move_done)
1200
-
1201
-
1202
- def move_done(self, command: utils.ThreadCommand):
1203
- self.move_done_signal.emit(self.title, command.attribute[0])
1204
-
1205
- class DetectorMock(QtCore.QObject):
1206
- mod_name = 'det'
1207
- grab_done_signal = Signal(DataToExport)
1208
- command_hardware = Signal(utils.ThreadCommand)
1209
-
1210
- def __init__(self, ind):
1211
- super().__init__()
1212
- self.title = f'{self.mod_name}_{ind:02d}'
1213
- self.initialized_state = True
1214
- self.module_and_data_saver = module_saving.DetectorSaver(self)
1215
- self.settings = Parameter.create(name='settings', type='str', value='mysettings')
1216
- self.ui = None
1217
- self.command_hardware.connect(self.grab_done)
1218
-
1219
- def grab_done(self):
1220
- dat1 = init_data(data=DATA2D, Ndata=2, name=f'{self.title}/data2D')
1221
- dat2 = init_data(data=DATA1D, Ndata=3, name=f'{self.title}/data1D')
1222
- data = data_mod.DataToExport(name=f'{self.title}', data=[dat1, dat2])
1223
- self.grab_done_signal.emit(data)
1224
-
1225
- class DashBoardTest:
1226
- def __init__(self):
1227
- self.title = 'DashBoardTest'
1228
- self.detector_modules = [DetectorMock(ind) for ind in range(2)]
1229
- self.actuators_modules = [ActuatorMock(ind) for ind in range(3)]
1230
-
1231
- if init_qt: # used for the test suite
1232
- app = QtWidgets.QApplication(sys.argv)
1233
- if config['style']['darkstyle']:
1234
- import qdarkstyle
1235
- app.setStyleSheet(qdarkstyle.load_stylesheet())
1236
-
1237
- win = QtWidgets.QMainWindow()
1238
- area = gutils.dock.DockArea()
1239
- win.setCentralWidget(area)
1240
- #win.resize(1000, 500)
1241
- win.setWindowTitle('PyMoDAQ Dashboard')
1242
-
1243
- dashboard = DashBoardTest()
1244
- daq_scan = DAQScan(dockarea=area, dashboard=dashboard)
1245
- win.show()
1246
-
1247
- if init_qt:
1248
- sys.exit(app.exec_())
1249
- return dashboard, daq_scan, win
1250
-
1251
-
1252
- def main(init_qt=True):
1253
- if init_qt: # used for the test suite
1254
- app = QtWidgets.QApplication(sys.argv)
1255
- if config['style']['darkstyle']:
1256
- import qdarkstyle
1257
- app.setStyleSheet(qdarkstyle.load_stylesheet())
1173
+ self.status_sig.emit(utils.ThreadCommand("Update_Status",
1174
+ attribute="Timeout during acquisition"))
1175
+ self.status_sig.emit(utils.ThreadCommand("Timeout"))
1258
1176
 
1259
- from pymodaq.dashboard import DashBoard
1260
1177
 
1261
- win = QtWidgets.QMainWindow()
1262
- area = gutils.dock.DockArea()
1263
- win.setCentralWidget(area)
1264
- win.resize(1000, 500)
1265
- win.setWindowTitle('PyMoDAQ Dashboard')
1266
-
1267
- dashboard = DashBoard(area)
1268
- daq_scan = None
1269
- file = Path(get_set_preset_path()).joinpath(f"{config('presets', 'default_preset_for_scan')}.xml")
1270
- if file.exists():
1271
- dashboard.set_preset_mode(file)
1272
- daq_scan = dashboard.load_scan_module()
1273
- else:
1274
- msgBox = QtWidgets.QMessageBox()
1275
- msgBox.setText(f"The default file specified in the configuration file does not exists!\n"
1276
- f"{file}\n"
1277
- f"Impossible to load the DAQScan Module")
1278
- msgBox.setStandardButtons(msgBox.Ok)
1279
- ret = msgBox.exec()
1280
-
1281
- if init_qt:
1282
- sys.exit(app.exec_())
1283
- return dashboard, daq_scan, win
1178
+ def main():
1179
+ from pymodaq_gui.utils.utils import mkQApp
1180
+ from pymodaq.utils.gui_utils.loader_utils import load_dashboard_with_preset
1181
+
1182
+ app = mkQApp('DAQScan')
1183
+ preset_file_name = config('presets', f'default_preset_for_scan')
1184
+
1185
+ dashboard, extension, win = load_dashboard_with_preset(preset_file_name, 'DAQScan')
1186
+
1187
+ app.exec()
1188
+
1189
+ return dashboard, extension, win
1284
1190
 
1285
1191
 
1286
1192
  if __name__ == '__main__':
1287
1193
  main()
1288
- #main_test()
1194
+