pymodaq 4.2.3__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 +33 -16
  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 +166 -118
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +7 -7
  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 -664
  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.3.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +1 -1
  78. pymodaq/post_treatment/process_to_scalar.py +0 -263
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  311. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  312. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  313. pymodaq/resources/VERSION +0 -1
  314. pymodaq/resources/config_template.toml +0 -90
  315. pymodaq/resources/triangulation_data.npy +0 -0
  316. pymodaq/utils/abstract/__init__.py +0 -48
  317. pymodaq/utils/db/__init__.py +0 -0
  318. pymodaq/utils/db/db_logger/__init__.py +0 -0
  319. pymodaq/utils/enums.py +0 -76
  320. pymodaq/utils/factory.py +0 -82
  321. pymodaq/utils/gui_utils/custom_app.py +0 -133
  322. pymodaq/utils/gui_utils/dock.py +0 -107
  323. pymodaq/utils/gui_utils/file_io.py +0 -93
  324. pymodaq/utils/gui_utils/layout.py +0 -34
  325. pymodaq/utils/gui_utils/list_picker.py +0 -38
  326. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  327. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  328. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  329. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  330. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  331. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  332. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  333. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  334. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  335. pymodaq/utils/h5modules/backends.py +0 -1022
  336. pymodaq/utils/h5modules/browsing.py +0 -625
  337. pymodaq/utils/h5modules/data_saving.py +0 -1101
  338. pymodaq/utils/h5modules/exporter.py +0 -119
  339. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  340. pymodaq/utils/h5modules/exporters/base.py +0 -111
  341. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  342. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  343. pymodaq/utils/h5modules/saving.py +0 -866
  344. pymodaq/utils/h5modules/utils.py +0 -115
  345. pymodaq/utils/managers/action_manager.py +0 -489
  346. pymodaq/utils/managers/parameter_manager.py +0 -282
  347. pymodaq/utils/managers/roi_manager.py +0 -726
  348. pymodaq/utils/messenger.py +0 -66
  349. pymodaq/utils/parameter/ioxml.py +0 -542
  350. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  351. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  352. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  353. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  354. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  355. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  356. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  357. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  358. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  359. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  360. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  361. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  362. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  363. pymodaq/utils/plotting/__init__.py +0 -0
  364. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  365. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  366. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  367. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  368. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -820
  369. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  370. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  371. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  372. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  373. pymodaq/utils/plotting/gant_chart.py +0 -123
  374. pymodaq/utils/plotting/image_viewer.py +0 -97
  375. pymodaq/utils/plotting/items/__init__.py +0 -0
  376. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  377. pymodaq/utils/plotting/items/crosshair.py +0 -94
  378. pymodaq/utils/plotting/items/image.py +0 -388
  379. pymodaq/utils/plotting/navigator.py +0 -353
  380. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  381. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  382. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  383. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  384. pymodaq/utils/plotting/utils/__init__.py +0 -0
  385. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  386. pymodaq/utils/plotting/utils/filter.py +0 -585
  387. pymodaq/utils/plotting/utils/lineout.py +0 -226
  388. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  389. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  390. pymodaq/utils/plotting/widgets.py +0 -76
  391. pymodaq/utils/qvariant.py +0 -12
  392. pymodaq/utils/slicing.py +0 -63
  393. pymodaq/utils/units.py +0 -216
  394. pymodaq-4.2.3.dist-info/RECORD +0 -438
  395. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  396. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  397. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  398. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,625 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created the 15/11/2022
4
-
5
- @author: Sebastien Weber
6
- """
7
- from typing import Tuple
8
- import os
9
- from collections import OrderedDict
10
- from typing import List
11
- import warnings
12
- import logging
13
- import webbrowser
14
- import numpy as np
15
- from pathlib import Path
16
- from packaging import version as version_mod
17
-
18
- from pymodaq.utils.logger import set_logger, get_module_name
19
- from pymodaq.utils.config import Config
20
- from qtpy import QtGui, QtCore
21
- from qtpy.QtCore import Qt, QObject, Signal, QByteArray
22
-
23
- from pymodaq.utils.parameter import ioxml
24
-
25
- from pymodaq.utils.gui_utils.widgets.tree_layout import TreeLayout
26
- from pymodaq.utils.daq_utils import capitalize
27
- from pymodaq.utils.data import Axis
28
- from pymodaq.utils.gui_utils.utils import h5tree_to_QTree, pngbinary2Qlabel
29
- from pymodaq.utils.gui_utils.file_io import select_file, select_file_filter
30
- from pymodaq.utils.plotting.data_viewers.viewerND import ViewerND
31
- from qtpy import QtWidgets
32
- from pymodaq.utils import daq_utils as utils
33
- from pymodaq.utils.managers.action_manager import ActionManager
34
- from pymodaq.utils.managers.parameter_manager import ParameterManager
35
- from pymodaq.utils.messenger import messagebox
36
- from .backends import H5Backend
37
- from .saving import H5Saver
38
- from . import data_saving
39
- from .exporter import ExporterFactory
40
-
41
- config = Config()
42
- logger = set_logger(get_module_name(__file__))
43
-
44
-
45
- class H5BrowserUtil(H5Backend):
46
- """Utility object to interact and get info and data from a hdf5 file
47
-
48
- Inherits H5Backend and all its functionalities
49
-
50
- Parameters
51
- ----------
52
- backend: str
53
- The used hdf5 backend: either tables, h5py or h5pyd
54
- """
55
- def __init__(self, backend='tables'):
56
- super().__init__(backend=backend)
57
-
58
- def export_data(self, node_path='/', filesavename: str = 'datafile.h5', filter=None):
59
- """Initialize the correct exporter and export the node"""
60
-
61
- # Format the node and file type
62
- filepath = Path(filesavename)
63
- node = self.get_node(node_path)
64
- # Separate dot from extension
65
- extension = filepath.suffix[1:]
66
- # Obtain the suitable exporter object
67
- exporter = ExporterFactory.create_exporter(extension,
68
- ExporterFactory.get_format_from_filter(filter))
69
- # Export the data
70
- exporter.export_data(node, filepath)
71
-
72
- def get_h5file_scans(self, where='/'):
73
- """Get the list of the scan nodes in the file
74
-
75
- Parameters
76
- ----------
77
- where: str
78
- the path in the file
79
-
80
- Returns
81
- -------
82
- list of dict
83
- dict with keys: scan_name, path (within the file) and data (the live scan png image)
84
- """
85
- # TODO add a test for this method
86
- scan_list = []
87
- where = self.get_node(where)
88
- for node in self.walk_nodes(where):
89
- if 'pixmap2D' in node.attrs:
90
- scan_list.append(
91
- dict(scan_name='{:s}_{:s}'.format(node.parent_node.name, node.name), path=node.path,
92
- data=node.attrs['pixmap2D']))
93
-
94
- return scan_list
95
-
96
- def get_h5_attributes(self, node_path):
97
- """
98
- """
99
- node = self.get_node(node_path)
100
- attrs_names = node.attrs.attrs_name
101
- attr_dict = OrderedDict(node.attrs.to_dict())
102
-
103
- settings = None
104
- scan_settings = None
105
- if 'settings' in attrs_names:
106
- if node.attrs['settings'] != '':
107
- settings = node.attrs['settings']
108
-
109
- if 'scan_settings' in attrs_names:
110
- if node.attrs['scan_settings'] != '':
111
- scan_settings = node.attrs['scan_settings']
112
- pixmaps = []
113
- for attr in attrs_names:
114
- if 'pixmap' in attr:
115
- pixmaps.append(node.attrs[attr])
116
-
117
- return attr_dict, settings, scan_settings, pixmaps
118
-
119
-
120
- class View(QObject):
121
- item_clicked_sig = Signal(object)
122
- item_double_clicked_sig = Signal(object)
123
-
124
- def __init__(self, widget: QtWidgets.QWidget, settings_tree, settings_attributes_tree):
125
- super().__init__()
126
- self.parent_widget = widget
127
- self.h5file_tree: TreeLayout = None
128
-
129
- self._viewer_widget: QtWidgets.QWidget = None
130
- self._text_list: QtWidgets.QListWidget = None
131
- self._pixmap_widget: QtWidgets.QWidget = None
132
-
133
- self.setup_ui(settings_tree, settings_attributes_tree)
134
-
135
- def setup_ui(self, settings_tree, settings_attributes_tree):
136
- layout = QtWidgets.QGridLayout()
137
-
138
- v_splitter = QtWidgets.QSplitter(Qt.Vertical)
139
- v_splitter2 = QtWidgets.QSplitter(Qt.Vertical)
140
- h_splitter = QtWidgets.QSplitter(Qt.Horizontal)
141
-
142
- widget = QtWidgets.QWidget()
143
- # self.ui.h5file_tree = TreeLayout(Form,col_counts=2,labels=["Node",'Pixmap'])
144
- self.h5file_tree = TreeLayout(widget, col_counts=1, labels=["Node"])
145
- self.h5file_tree.tree.setMinimumWidth(300)
146
-
147
- self.h5file_tree.item_clicked_sig.connect(self.item_clicked_sig.emit)
148
- self.h5file_tree.item_double_clicked_sig.connect(self.item_double_clicked_sig.emit)
149
-
150
- v_splitter.addWidget(widget)
151
- v_splitter.addWidget(settings_attributes_tree)
152
-
153
- h_splitter.addWidget(v_splitter)
154
- self._pixmap_widget = QtWidgets.QWidget()
155
- self._pixmap_widget.setMaximumHeight(100)
156
- v_splitter2.addWidget(self._pixmap_widget)
157
-
158
- v_splitter2.addWidget(settings_tree)
159
- self._text_list = QtWidgets.QListWidget()
160
-
161
- v_splitter2.addWidget(self._text_list)
162
- h_splitter.addWidget(v_splitter2)
163
- self._viewer_widget = QtWidgets.QWidget()
164
- h_splitter.addWidget(self._viewer_widget)
165
- layout.addWidget(h_splitter)
166
- self.parent_widget.setLayout(layout)
167
-
168
- def current_node_path(self):
169
- return self.h5file_tree.current_node_path()
170
-
171
- def add_actions(self, actions: List[QtWidgets.QAction]):
172
- for action in actions:
173
- self.h5file_tree.tree.addAction(action)
174
-
175
- @property
176
- def viewer_widget(self):
177
- return self._viewer_widget
178
-
179
- @property
180
- def text_list(self):
181
- return self._text_list
182
-
183
- @property
184
- def pixmap_widget(self):
185
- return self._pixmap_widget
186
-
187
- def clear(self):
188
- self.h5file_tree.tree.clear()
189
-
190
- def add_base_item(self, base_tree_item):
191
- self.h5file_tree.tree.addTopLevelItem(base_tree_item)
192
-
193
- def add_widget_to_tree(self, pixmap_items):
194
- for item in pixmap_items:
195
- widget = QtWidgets.QWidget()
196
-
197
- vLayout = QtWidgets.QVBoxLayout()
198
- label1D = QtWidgets.QLabel()
199
- bytes = QByteArray(item['node'].attrs['pixmap1D'])
200
- im1 = QtGui.QImage.fromData(bytes)
201
- a = QtGui.QPixmap.fromImage(im1)
202
- label1D.setPixmap(a)
203
-
204
- label2D = QtWidgets.QLabel()
205
- bytes = QByteArray(item['node'].attrs['pixmap2D'])
206
- im2 = QtGui.QImage.fromData(bytes)
207
- b = QtGui.QPixmap.fromImage(im2)
208
- label2D.setPixmap(b)
209
-
210
- vLayout.addWidget(label1D)
211
- vLayout.addwidget(label2D)
212
- widget.setLayout(vLayout)
213
- self.h5file_tree.tree.setItemWidget(item['item'], 1, widget)
214
-
215
-
216
- class H5Browser(QObject, ActionManager):
217
- """UI used to explore h5 files, plot and export subdatas
218
-
219
- Parameters
220
- ----------
221
- parent: QtWidgets container
222
- either a QWidget or a QMainWindow
223
- h5file: h5file instance
224
- exact type depends on the backend
225
- h5file_path: str or Path
226
- if specified load the corresponding file, otherwise open a select file dialog
227
- backend: str
228
- either 'tables, 'h5py' or 'h5pyd'
229
-
230
- See Also
231
- --------
232
- H5Backend, H5Backend
233
- """
234
- data_node_signal = Signal(str) # the path of a node where data should be monitored, displayed...
235
- # whatever use from the caller
236
- status_signal = Signal(str)
237
-
238
- def __init__(self, parent: QtWidgets.QMainWindow, h5file=None, h5file_path=None, backend='tables'):
239
- QObject.__init__(self)
240
- # toolbar = QtWidgets.QToolBar()
241
- ActionManager.__init__(self) # , toolbar=toolbar)
242
-
243
- if not isinstance(parent, QtWidgets.QMainWindow):
244
- raise Exception('no valid parent container, expected a QMainWindow')
245
-
246
- self.main_window = parent
247
- self.parent_widget = QtWidgets.QWidget()
248
- self.main_window.setCentralWidget(self.parent_widget)
249
- #self.main_window.addToolBar(self.toolbar)
250
-
251
- self.current_node_path = None
252
-
253
- self.settings_attributes = ParameterManager()
254
- self.settings = ParameterManager()
255
-
256
- # construct the UI interface
257
- self.view = View(self.parent_widget, settings_tree=self.settings.settings_tree,
258
- settings_attributes_tree=self.settings_attributes.settings_tree)
259
- self.view.item_clicked_sig.connect(self.show_h5_attributes)
260
- self.view.item_double_clicked_sig.connect(self.show_h5_data)
261
- self.hyper_viewer = ViewerND(self.view.viewer_widget)
262
-
263
- self.setup_actions()
264
- self.setup_menu()
265
- self.connect_things()
266
-
267
- # construct the h5 interface and load the file (or open a select file message)
268
- self.h5utils = H5BrowserUtil(backend=backend)
269
- if h5file is None:
270
- if h5file_path is None:
271
- h5file_path = select_file(save=False, ext=['h5', 'hdf5'])
272
- if h5file_path != '':
273
- self.h5utils.open_file(h5file_path, 'r+')
274
- else:
275
- return
276
- else:
277
- self.h5utils.h5file = h5file
278
-
279
- self.data_loader = data_saving.DataLoader(self.h5utils)
280
-
281
- self.check_version()
282
- self.populate_tree()
283
- self.view.h5file_tree.expand_all()
284
-
285
- def connect_things(self):
286
- self.connect_action('export', self.export_data)
287
- self.connect_action('comment', self.add_comments)
288
- self.connect_action('load', self.load_file)
289
- self.connect_action('save', self.save_file)
290
- self.connect_action('quit', self.quit_fun)
291
- self.connect_action('about', self.show_about)
292
- self.connect_action('help', self.show_help)
293
- self.connect_action('log', self.show_log)
294
-
295
- self.connect_action('plot_node', lambda: self.get_node_and_plot(False))
296
- self.connect_action('plot_nodes', lambda: self.get_node_and_plot(False, True))
297
- self.connect_action('plot_node_with_bkg', lambda: self.get_node_and_plot(True))
298
- self.connect_action('plot_nodes_with_bkg', lambda: self.get_node_and_plot(True, True))
299
-
300
- self.status_signal.connect(self.add_log)
301
-
302
- def get_node_and_plot(self, with_bkg, plot_all=False):
303
- self.show_h5_data(item=None, with_bkg=with_bkg, plot_all=plot_all)
304
-
305
- def load_file(self):
306
- #todo
307
- pass
308
-
309
- def setup_menu(self):
310
- menubar = self.main_window.menuBar()
311
- file_menu = menubar.addMenu('File')
312
- self.affect_to('load', file_menu)
313
- self.affect_to('save', file_menu)
314
- file_menu.addSeparator()
315
- self.affect_to('quit', file_menu)
316
-
317
- help_menu = menubar.addMenu('?')
318
- self.affect_to('about', help_menu)
319
- self.affect_to('help', help_menu)
320
- self.affect_to('log', help_menu)
321
-
322
- def setup_actions(self):
323
- self.add_action('export', 'Export as', 'SaveAs', tip='Export node content (and children) as ',
324
- toolbar=self.toolbar)
325
- self.add_action('comment', 'Add Comment', 'properties', tip='Add comments to the node',
326
- toolbar=self.toolbar)
327
- self.add_action('plot_node', 'Plot Node', 'color', tip='Plot the current node',
328
- toolbar=self.toolbar)
329
- self.add_action('plot_nodes', 'Plot Nodes', 'color', tip='Plot all nodes hanging from the same parent',
330
- toolbar=self.toolbar)
331
- self.add_action('plot_node_with_bkg', 'Plot Node With Bkg', 'color', tip='Plot the current node with background'
332
- ' substraction if possible',
333
- toolbar=self.toolbar)
334
- self.add_action('plot_nodes_with_bkg', 'Plot Nodes With Bkg', 'color', tip='Plot all nodes hanging from'
335
- ' the same parent with background'
336
- ' substraction if possible',
337
- toolbar=self.toolbar)
338
- self.view.add_actions([self.get_action('export'), self.get_action('comment'),
339
- self.get_action('plot_node'), self.get_action('plot_nodes'),
340
- self.get_action('plot_node_with_bkg'),
341
- self.get_action('plot_nodes_with_bkg')])
342
-
343
- self.add_action('load', 'Load File', 'Open', tip='Open a new file')
344
- self.add_action('save', 'Save File as', 'SaveAs', tip='Save as another file')
345
- self.add_action('quit', 'Quit the application', 'Exit', tip='Quit the application')
346
- self.add_action('about', 'About', tip='About')
347
- self.add_action('help', 'Help', 'Help', tip='Show documentation', shortcut=QtCore.Qt.Key_F1)
348
- self.add_action('log', 'Show Log', 'information2', tip='Open Log')
349
-
350
- def check_version(self):
351
- """Check version of PyMoDAQ to assert if file is compatible or not with the current version of the Browser"""
352
- if 'pymodaq_version' in self.h5utils.root().attrs.attrs_name:
353
- if version_mod.parse(self.h5utils.root().attrs['pymodaq_version']) < version_mod.parse('4.0.0a0'):
354
- msg_box = messagebox(severity='warning', title='Invalid version',
355
- text=f"Your file has been saved using PyMoDAQ "
356
- f"version {self.h5utils.root().attrs['pymodaq_version']} "
357
- f"while you're using version: {utils.get_version()}\n"
358
- f"Please create and use an adapted environment to use this"
359
- f" version (up to 3.x.y):\n"
360
- f"pip install pymodaq==3.x.y")
361
- self.quit_fun()
362
-
363
- def add_comments(self, status: bool, comment=''):
364
- """Add comments to a node
365
-
366
- Parameters
367
- ----------
368
- status: bool
369
- comment: str
370
- The comment to be added in a comment attribute to the current node path
371
-
372
- See Also
373
- --------
374
- current_node_path
375
- """
376
- try:
377
- self.current_node_path = self.get_tree_node_path()
378
- node = self.h5utils.get_node(self.current_node_path)
379
- if 'comments' in node.attrs.attrs_name:
380
- tmp = node.attrs['comments']
381
- else:
382
- tmp = ''
383
- if comment == '':
384
- text, res = QtWidgets.QInputDialog.getMultiLineText(None, 'Enter comments', 'Enter comments here:', tmp)
385
- if res and text != '':
386
- comment = text
387
- node.attrs['comments'] = comment
388
- else:
389
- node.attrs['comments'] = tmp + comment
390
-
391
- self.h5utils.flush()
392
-
393
- except Exception as e:
394
- logger.exception(str(e))
395
-
396
- def get_tree_node_path(self):
397
- """Get the node path of the currently selected node in the UI"""
398
- return self.view.current_node_path()
399
-
400
- def export_data(self):
401
- """Opens a dialog to export data
402
-
403
- See Also
404
- --------
405
- H5BrowserUtil.export_data
406
- """
407
- try:
408
- file_filter = ExporterFactory.get_file_filters()
409
- file, selected_filter = select_file_filter(save=True, filter=file_filter)
410
- self.current_node_path = self.get_tree_node_path()
411
- if file != '':
412
- self.h5utils.export_data(self.current_node_path, str(file), selected_filter)
413
-
414
- except Exception as e:
415
- logger.exception(str(e))
416
-
417
- def save_file(self, filename=None):
418
-
419
- if filename is None:
420
- filename = select_file(save=True, ext='txt')
421
- if filename != '':
422
- self.h5utils.save_file(filename)
423
-
424
- def quit_fun(self):
425
- """
426
- """
427
- try:
428
- self.h5utils.close_file()
429
- if self.main_window is None:
430
- self.parent_widget.close()
431
- else:
432
- self.main_window.close()
433
- except Exception as e:
434
- logger.exception(str(e))
435
-
436
- def show_about(self):
437
- splash_path = os.path.join(os.path.split(os.path.split(__file__)[0])[0], 'splash.png')
438
- splash = QtGui.QPixmap(splash_path)
439
- self.splash_sc = QtWidgets.QSplashScreen(splash, QtCore.Qt.WindowStaysOnTopHint)
440
- self.splash_sc.setVisible(True)
441
- self.splash_sc.showMessage(f"PyMoDAQ version {utils.get_version()}\n"
442
- f"Modular Acquisition with Python\nWritten by Sébastien Weber",
443
- QtCore.Qt.AlignRight, QtCore.Qt.white)
444
-
445
- @staticmethod
446
- def show_log():
447
- webbrowser.open(logging.getLogger('pymodaq').handlers[0].baseFilename)
448
-
449
- @staticmethod
450
- def show_help():
451
- QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://pymodaq.cnrs.fr"))
452
-
453
- @staticmethod
454
- def add_log(txt):
455
- logger.info(txt)
456
-
457
- def show_h5_attributes(self, item=None):
458
- try:
459
- self.current_node_path = self.get_tree_node_path()
460
-
461
- attr_dict, settings, scan_settings, pixmaps = self.h5utils.get_h5_attributes(self.current_node_path)
462
-
463
- for child in self.settings_attributes.settings.children():
464
- child.remove()
465
- params = []
466
- for attr in attr_dict:
467
- params.append({'title': attr, 'name': attr, 'type': 'str', 'value': attr_dict[attr],
468
- 'readonly': True})
469
- self.settings_attributes.settings.addChildren(params)
470
-
471
- if settings is not None:
472
- for child in self.settings.settings.children():
473
- child.remove()
474
- QtWidgets.QApplication.processEvents() # so that the tree associated with settings updates
475
- params = ioxml.XML_string_to_parameter(settings)
476
- self.settings.settings.addChildren(params)
477
-
478
- if scan_settings is not None:
479
- params = ioxml.XML_string_to_parameter(scan_settings)
480
- self.settings.settings.addChildren(params)
481
-
482
- if pixmaps == []:
483
- self.view.pixmap_widget.setVisible(False)
484
- else:
485
- self.view.pixmap_widget.setVisible(True)
486
- self.show_pixmaps(pixmaps)
487
-
488
- except Exception as e:
489
- logger.exception(str(e))
490
-
491
- def show_pixmaps(self, pixmaps=[]):
492
- if self.view.pixmap_widget.layout() is None:
493
- self.view.pixmap_widget.setLayout(QtWidgets.QHBoxLayout())
494
- while 1:
495
- child = self.view.pixmap_widget.layout().takeAt(0)
496
- if not child:
497
- break
498
- child.widget().deleteLater()
499
- QtWidgets.QApplication.processEvents()
500
- labs = []
501
- for pix in pixmaps:
502
- labs.append(pngbinary2Qlabel(pix))
503
- self.view.pixmap_widget.layout().addWidget(labs[-1])
504
-
505
- def show_h5_data(self, item, with_bkg=False, plot_all=False):
506
- """
507
-
508
- Parameters
509
- ----------
510
- item
511
- with_bkg
512
- plot_all
513
-
514
- Returns
515
- -------
516
-
517
- """
518
- try:
519
- if item is None:
520
- self.current_node_path = self.get_tree_node_path()
521
- self.show_h5_attributes()
522
- node = self.h5utils.get_node(self.current_node_path)
523
- self.data_node_signal.emit(self.current_node_path)
524
-
525
- if 'data_type' in node.attrs and node.attrs['data_type'] == 'strings':
526
- self.view.text_list.clear()
527
- for txt in node.read():
528
- self.view.text_list.addItem(txt)
529
- elif 'data_type' in node.attrs:
530
- data_with_axes = self.data_loader.load_data(node, with_bkg=with_bkg, load_all=plot_all)
531
- self.hyper_viewer.show_data(data_with_axes, force_update=True)
532
-
533
- except Exception as e:
534
- logger.exception(str(e))
535
-
536
- def populate_tree(self):
537
- """
538
- | Init the ui-tree and store data into calling the h5_tree_to_Qtree convertor method
539
-
540
- See Also
541
- --------
542
- h5tree_to_QTree, update_status
543
- """
544
- try:
545
- if self.h5utils.h5file is not None:
546
- self.view.clear()
547
- base_node = self.h5utils.root()
548
- base_tree_item, pixmap_items = h5tree_to_QTree(base_node)
549
- self.view.add_base_item(base_tree_item)
550
- self.view.add_widget_to_tree(pixmap_items)
551
-
552
- except Exception as e:
553
- logger.exception(str(e))
554
-
555
-
556
- def browse_data(fname=None, ret_all=False, message=None) -> Tuple[data_saving.DataWithAxes, str, str]:
557
- """Browse data present in any h5 file using the H5Browser within a dialog window
558
- when the user has selected a given node, return its content
559
-
560
- Parameters
561
- ----------
562
- fname: str
563
- ret_all: bool
564
- message: str
565
-
566
- Returns
567
- -------
568
- data: DataWithAxes
569
- if argument ret_all is True, returns also:
570
- fname: the file name
571
- node_path: hte path of the selected node within the H5 file tree
572
-
573
- """
574
- if fname is None:
575
- fname = str(select_file(start_path=config('data_saving', 'h5file', 'save_path'), save=False, ext='h5'))
576
-
577
- if type(fname) != str:
578
- try:
579
- fname = str(fname)
580
- except Exception:
581
- raise Exception('filename in browse data is not valid')
582
- if fname != '':
583
- (root, ext) = os.path.splitext(fname)
584
- if not ('h5' in ext or 'hdf5' in ext):
585
- warnings.warn('This is not a PyMODAQ h5 file, there could be issues', Warning)
586
-
587
- form = QtWidgets.QMainWindow()
588
- browser = H5Browser(form, h5file_path=fname)
589
- dataloader = data_saving.DataLoader(browser.h5utils)
590
- dialog = QtWidgets.QDialog()
591
- vlayout = QtWidgets.QVBoxLayout()
592
-
593
- vlayout.addWidget(form)
594
- dialog.setLayout(vlayout)
595
- buttonBox = QtWidgets.QDialogButtonBox(parent=dialog)
596
-
597
- buttonBox.addButton('OK', buttonBox.AcceptRole)
598
- buttonBox.accepted.connect(dialog.accept)
599
- buttonBox.addButton('Cancel', buttonBox.RejectRole)
600
- buttonBox.rejected.connect(dialog.reject)
601
- vlayout.addWidget(buttonBox)
602
-
603
- dialog.setWindowTitle('Select a data node in the tree')
604
- if message is None or not isinstance(message, str):
605
- dialog.setWindowTitle('Select a data node in the tree')
606
- else:
607
- dialog.setWindowTitle(message)
608
- res = dialog.exec()
609
-
610
- if res == dialog.Accepted:
611
- node_path = browser.current_node_path
612
- data = dataloader.load_data(node_path, with_bkg=True)
613
- else:
614
- data = None
615
- node_path = None
616
-
617
- browser.h5utils.close_file()
618
-
619
- if ret_all:
620
- return data, fname, node_path
621
- else:
622
- return data
623
- return None, '', ''
624
-
625
-