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
@@ -1,353 +0,0 @@
1
- from pymodaq.utils.logger import set_logger, get_module_name, get_module_name
2
- from pymodaq.utils.gui_utils.file_io import select_file
3
- from qtpy import QtGui, QtWidgets, QtCore
4
- from qtpy.QtCore import Qt, QObject, Slot, Signal
5
-
6
- import sys
7
- import os
8
- import numpy as np
9
- from pymodaq.utils.data import DataToExport, DataFromPlugins, DataDim, enum_checker, DataWithAxes
10
- from pymodaq.utils.h5modules.data_saving import DataLoader
11
- from pymodaq.utils.managers.parameter_manager import ParameterManager
12
- from pymodaq.utils.managers.action_manager import ActionManager
13
- from pymodaq.utils.plotting.data_viewers.viewer2D_basic import Viewer2DBasic
14
- from pymodaq.utils.plotting.items.image import UniformImageItem, SpreadImageItem
15
- from pymodaq.utils import daq_utils as utils
16
- from pymodaq.utils.h5modules.browsing import browse_data, H5BrowserUtil
17
- from pymodaq.utils.h5modules.saving import H5Saver
18
- from pymodaq.utils import gui_utils as gutils
19
- from pymodaq.utils.parameter.pymodaq_ptypes.pixmap import PixmapCheckData
20
-
21
- from pymodaq.utils.config import get_set_local_dir, Config
22
-
23
- local_path = get_set_local_dir()
24
- navigator_path = os.path.join(local_path, 'navigator_temp_files')
25
- if not os.path.isdir(navigator_path):
26
- os.makedirs(navigator_path)
27
-
28
- logger = set_logger(get_module_name(__file__))
29
-
30
- Ntick = 128
31
- colors_red = np.array([(int(r), 0, 0) for r in np.linspace(0, 255, Ntick)])
32
- colors_green = np.array([(0, int(g), 0) for g in np.linspace(0, 255, Ntick)])
33
- colors_blue = np.array([(0, 0, int(b)) for b in np.linspace(0, 255, Ntick)])
34
- config = Config()
35
-
36
-
37
- class Navigator(ParameterManager, ActionManager, QObject):
38
-
39
- settings_name = 'navigator_settings'
40
- log_signal = Signal(str)
41
- sig_double_clicked = Signal(float, float)
42
- params = [
43
- {'title': 'Settings', 'name': 'settings', 'type': 'group', 'children': [
44
- {'title': 'Load h5:', 'name': 'Load h5', 'type': 'action'},
45
- {'title': 'h5 path:', 'name': 'filepath', 'type': 'str', 'value': '', 'readonly': True},
46
- {'title': 'Load Image:', 'name': 'Load Image', 'type': 'action'},
47
- {'title': 'Image path:', 'name': 'imagepath', 'type': 'str', 'value': '', 'readonly': True},
48
- ]},
49
- {'title': 'Image', 'name': 'image', 'type': 'pixmap_check'},
50
- {'title': 'Overlays', 'name': 'overlays', 'type': 'group', 'children': []},
51
- ]
52
-
53
- def __init__(self, parent=None, h5file_path=None):
54
- QObject.__init__(self)
55
- ParameterManager.__init__(self)
56
- ActionManager.__init__(self, toolbar=QtWidgets.QToolBar())
57
- if parent is None:
58
- parent = QtWidgets.QWidget()
59
- self.parent = parent
60
- self.title = 'Navigator'
61
-
62
- self.status_time = 1000
63
-
64
- self._h5saver = H5Saver()
65
- self.dataloader = DataLoader(self._h5saver)
66
-
67
- self.h5file_path = h5file_path
68
- self.h5saver_image = H5Saver()
69
-
70
- self.viewer: Viewer2DBasic = None
71
-
72
- self.x_range = []
73
- self.y_range = []
74
-
75
- self.next_scan_index = 0
76
-
77
- self.overlays = [] # %list of imageItem items displaying 2D scans info
78
-
79
- # self.h5module = H5BrowserUtil()
80
-
81
- self.setup_actions()
82
- self.setup_ui()
83
- self.connect_things()
84
- self.set_aspect_ratio()
85
-
86
- if h5file_path is not None:
87
- self.h5saver.open_file(h5file_path, 'a')
88
- self.settings.child('settings', 'filepath').setValue(h5file_path)
89
- self.settings.child('settings', 'Load h5').hide()
90
- self.list_2D_scans()
91
- # self.show_overlay()
92
-
93
- @property
94
- def h5saver(self):
95
- return self._h5saver
96
-
97
- @h5saver.setter
98
- def h5saver(self, h5saver: H5Saver):
99
- self._h5saver = h5saver
100
- self.dataloader = DataLoader(h5saver)
101
-
102
- def setup_actions(self):
103
-
104
- self.add_action('load_scan', 'Load Scan file', 'NewLayer', 'Load scan file (.h5)')
105
- self.add_action('load_image', 'Load Image File', 'Open_File_32', 'Load image file (.h5)')
106
- self.add_action('ratio', 'Viewbox Aspect Ratio', 'Zoom_1_1', 'Set viewbox aspect ratio to 1', checkable=True)
107
- self.add_action('move_at', 'Move at DoubleClicked', 'move_contour',
108
- 'When selected, double clicking on viewbox will move DAQ_Move modules',
109
- checkable=True)
110
- self.add_action('select_all', 'Select All', 'select_all2', 'Select (show) all 2D scans on the viewer')
111
- self.add_action('select_none', 'Select None', 'select_none', 'Unselect (hide) all 2D scans on the viewer')
112
- self.add_action('histogram', 'Show Histograms', 'Histogram', 'Show (hide) histograms', checkable=True)
113
-
114
- def connect_things(self):
115
- self.connect_action('load_scan', self.load_data)
116
- self.connect_action('load_image', self.load_image)
117
- self.connect_action('ratio', self.set_aspect_ratio)
118
- self.connect_action('select_all', self.show_all)
119
- self.connect_action('select_none', self.show_none)
120
- self.connect_action('histogram', self.show_histo)
121
-
122
- self.viewer.sig_double_clicked.connect(self.move_at)
123
- self.settings.child('settings', 'Load h5').sigActivated.connect(self.load_data)
124
- self.settings.child('settings', 'Load Image').sigActivated.connect(self.load_image)
125
-
126
- @Slot(float, float)
127
- def move_at(self, posx, posy):
128
- if self.is_action_checked('move_at'):
129
- self.sig_double_clicked.emit(posx, posy)
130
-
131
- def show_histo(self):
132
- self.viewer.histo_widget.setVisible(self.is_action_checked('histogram'))
133
-
134
- def show_all(self):
135
- self.show_scans()
136
-
137
- def show_none(self):
138
- self.show_scans(False)
139
-
140
- def show_scans(self, show=True):
141
- for child in self.settings.child('overlays'):
142
- val = child.value()
143
- val.checked = show
144
- child.setValue(val)
145
- child.sigValueChanged.emit(child, val)
146
-
147
- def get_data_from_scan_name(self, scan_name: str) -> DataToExport:
148
- _data = DataToExport('All')
149
- self.dataloader.load_all(f'/RawData/{scan_name}', _data)
150
- data_2D = _data.get_data_from_Naxes(2)
151
- for dat in data_2D: # convert DataWithAxes DataND to Data2D
152
- dat.nav_indexes = ()
153
- return data_2D
154
-
155
- def set_axes(self, dwa: DataWithAxes):
156
- x_axis = dwa.get_axis_from_index(0)[0]
157
- y_axis = dwa.get_axis_from_index(1)[0]
158
-
159
- self.viewer.scaled_xaxis.axis_label = x_axis.label
160
- self.viewer.scaled_xaxis.axis_units = x_axis.units
161
-
162
- self.viewer.scaled_yaxis.axis_label = y_axis.label
163
- self.viewer.scaled_yaxis.axis_units = y_axis.units
164
-
165
- def list_2D_scans(self):
166
- try:
167
- scans = self.h5saver.get_scan_groups()
168
-
169
- params = []
170
- for child in self.settings.child('overlays').children():
171
- self.settings.child('overlays').removeChild(child)
172
- ind_overlay = 0
173
- axes_init = False
174
- for scan in scans:
175
- data_2D = self.get_data_from_scan_name(scan.name)
176
- for _dat in data_2D:
177
- if not axes_init:
178
- self.set_axes(_dat)
179
- axes_init = True
180
- params.append({'name': f'Overlay{ind_overlay:03.0f}', 'type': 'pixmap_check',
181
- 'value': PixmapCheckData(data=_dat[0], checked=False, path=_dat.path,
182
- info=f'{scan.name}/{_dat.get_full_name()}')})
183
- ind_overlay += 1
184
- self.settings.child('overlays').addChildren(params)
185
-
186
- for child in self.settings.child('overlays').children():
187
- val = child.value()
188
- val.checked = True
189
- child.setValue(val)
190
- child.sigValueChanged.emit(child, child.value())
191
-
192
- except Exception as e:
193
- logger.exception(str(e))
194
-
195
- def load_image(self):
196
- data, fname, node_path = browse_data(ret_all=True)
197
-
198
- self.h5saver_image = H5Saver()
199
- self.h5saver_image.open_file(fname, 'r')
200
-
201
- self.settings.child('settings', 'imagepath').setValue(fname)
202
- self.settings.child('image').setValue(PixmapCheckData(data=data[0], checked=True, path=data.path))
203
-
204
- self.settings.child('image').sigValueChanged.emit(
205
- self.settings.child('image'),
206
- self.settings.child('image').value())
207
-
208
- def load_data(self):
209
- self.h5file_path = str(select_file(start_path=config('data_saving', 'h5file', 'save_path'),
210
- save=False, ext='h5'))
211
- if self.h5file_path != '':
212
- self.settings.child('settings', 'filepath').setValue(self.h5file_path)
213
- if self.h5saver is not None:
214
- if self.h5saver.isopen():
215
- self.h5saver.close_file()
216
- self.h5saver.open_file(self.h5file_path, 'a')
217
- self.list_2D_scans()
218
-
219
- def set_aspect_ratio(self):
220
- self.viewer.set_aspect_ratio(self.is_action_checked('ratio'))
221
-
222
- def add_image_data(self, dwa: DataWithAxes):
223
- ims = []
224
- histograms = self.viewer.histograms
225
- for ind, data in enumerate(dwa):
226
- if ind > 2:
227
- break
228
- if dwa.distribution.name == 'spread':
229
- im = SpreadImageItem()
230
- else:
231
- im = UniformImageItem()
232
- ims.append(im)
233
-
234
- im.setOpacity(1)
235
- self.viewer.add_image_item(im, histogram=histograms[ind])
236
- im.setCompositionMode(QtGui.QPainter.CompositionMode_Plus)
237
-
238
- if dwa.distribution.name == 'uniform':
239
- x_axis = dwa.get_axis_from_index(1)[0].get_data()
240
- y_axis = dwa.get_axis_from_index(0)[0].get_data()
241
-
242
- rect = QtCore.QRectF(np.min(y_axis), np.min(x_axis),
243
- (np.max(y_axis) - np.min(y_axis)),
244
- (np.max(x_axis) - np.min(x_axis)))
245
-
246
- im.setImage(data)
247
- im.setOpts(rect=rect)
248
- else:
249
- y_axis, x_axis = dwa.get_axis_from_index(0)
250
- im.setImage(np.vstack((x_axis, y_axis, dwa.data[0])).T)
251
- histograms[ind].setImageItem(im)
252
- return ims
253
-
254
- def remove_image_data(self, param):
255
- for overlay in self.overlays[:]:
256
- if param.name() in overlay['name']:
257
- ind = self.overlays.index(overlay)
258
- for image in overlay['images']:
259
- self.viewer.plotitem.removeItem(image)
260
- self.overlays.pop(ind)
261
-
262
- def value_changed(self, param):
263
-
264
- if param.parent().name() == 'overlays':
265
- data: PixmapCheckData = param.value()
266
- if data.checked:
267
- dwa = self.dataloader.load_data(data.path, load_all=True)
268
- ims = self.add_image_data(dwa)
269
- self.overlays.append(dict(name=f'{param.name()}_{0}', images=ims))
270
-
271
- else:
272
- self.remove_image_data(param)
273
- elif param.name() == 'image':
274
- data: PixmapCheckData = param.value()
275
- if data.checked:
276
- dataloader = DataLoader(self.h5saver_image)
277
- dwa = dataloader.load_data(data.path)
278
- ims = self.add_image_data(dwa)
279
- self.overlays.append(dict(name='{:s}_{:03d}'.format(param.name(), 0), images=ims))
280
- else:
281
- self.remove_image_data(param)
282
-
283
- def param_deleted(self, param):
284
- self.remove_image_data(param)
285
-
286
- def setup_ui(self):
287
- layout = QtWidgets.QVBoxLayout()
288
-
289
- self.parent.setLayout(layout)
290
- self.parent.layout().addWidget(self.toolbar)
291
- sett_widget = QtWidgets.QWidget()
292
- self.sett_layout = QtWidgets.QHBoxLayout()
293
- sett_widget.setLayout(self.sett_layout)
294
-
295
- layout.addWidget(self.toolbar)
296
-
297
- splitter = QtWidgets.QSplitter(Qt.Horizontal)
298
- layout.addWidget(splitter)
299
-
300
- # set viewer area
301
- widg = QtWidgets.QWidget()
302
- self.viewer = Viewer2DBasic(widg)
303
- self.viewer.histogram_red.setVisible(True)
304
- self.viewer.histogram_green.setVisible(True)
305
- self.viewer.histogram_blue.setVisible(True)
306
- self.viewer.histogram_adaptive.setVisible(False)
307
-
308
- self.statusbar = QtWidgets.QStatusBar()
309
- self.statusbar.setMaximumHeight(25)
310
- layout.addWidget(self.statusbar)
311
- self.log_message = QtWidgets.QLabel('Initializing')
312
- self.statusbar.addPermanentWidget(self.log_message)
313
-
314
- self.sett_layout.addWidget(self.settings_tree)
315
- splitter.addWidget(sett_widget)
316
- splitter.addWidget(self.viewer.parent)
317
-
318
- def update_h5file(self, h5file):
319
- if self.h5saver is not None:
320
- self.h5saver.h5file = h5file
321
- self.dataloader = DataLoader(self.h5saver)
322
- self.list_2D_scans()
323
-
324
- def update_status(self, txt, status_time=0, log_type=None):
325
- """
326
- Show the txt message in the status bar with a delay of status_time ms.
327
-
328
- =============== =========== =======================
329
- **Parameters** **Type** **Description**
330
- *txt* string The message to show
331
- *status_time* int the delay of showing
332
- *log_type* string the type of the log
333
- =============== =========== =======================
334
- """
335
- try:
336
- self.ui.statusbar.showMessage(txt, status_time)
337
- logger.info(txt)
338
- except Exception as e:
339
- logger.exception(str(e))
340
-
341
-
342
- def main():
343
- app = QtWidgets.QApplication(sys.argv)
344
- widg = QtWidgets.QWidget()
345
- prog = Navigator(widg)#, h5file_path=r'C:\Data\2023\20230320\Dataset_20230320_001.h5')
346
-
347
- widg.show()
348
- prog.list_2D_scans()
349
- sys.exit(app.exec_())
350
-
351
-
352
- if __name__ == '__main__':
353
- main()
@@ -1,94 +0,0 @@
1
- # Standard imports
2
- import typing
3
- from abc import ABCMeta, abstractmethod
4
- from importlib import import_module
5
- from pathlib import Path
6
- from typing import Callable, List, Union
7
-
8
- # 3rd party imports
9
- import numpy as np
10
-
11
- # project imports
12
- from pymodaq.utils.abstract import abstract_attribute
13
- from pymodaq.utils.logger import set_logger, get_module_name
14
-
15
- from pymodaq.utils.factory import ObjectFactory
16
-
17
- if typing.TYPE_CHECKING:
18
- from pymodaq.utils.data import DataWithAxes, DataDim
19
- from pymodaq.utils.plotting.data_viewers import Viewer0D, Viewer1D, Viewer2D, ViewerND
20
-
21
- logger = set_logger(get_module_name(__file__))
22
-
23
-
24
- def register_plotter(parent_module_name: str = 'pymodaq.utils.plotting.plotter'):
25
- plotters = []
26
- try:
27
- plotter_module = import_module(f'{parent_module_name}.plotters')
28
-
29
- plotter_path = Path(plotter_module.__path__[0])
30
-
31
- for file in plotter_path.iterdir():
32
- if file.is_file() and 'py' in file.suffix and file.stem != '__init__':
33
- try:
34
- plotters.append(import_module(f'.{file.stem}', plotter_module.__name__))
35
- except ModuleNotFoundError:
36
- pass
37
- except ModuleNotFoundError:
38
- pass
39
- finally:
40
- return plotters
41
-
42
-
43
- class PlotterBase(metaclass=ABCMeta):
44
- """Base class for a plotter. """
45
-
46
- backend: str = abstract_attribute()
47
- def __init__(self):
48
- """Abstract Exporter Constructor"""
49
- pass
50
-
51
- @abstractmethod
52
- def plot(self, data, *args, **kwargs) -> None:
53
- """Abstract method to plot data object with a given backend"""
54
- pass
55
-
56
-
57
- class PlotterFactory(ObjectFactory):
58
- """Factory class registering and storing interactive plotter"""
59
-
60
- @classmethod
61
- def register(cls) -> Callable:
62
- """ To be used as a decorator
63
-
64
- Register in the class registry a new plotter class using its 2 identifiers: backend and
65
- data_dim
66
- """
67
- def inner_wrapper(wrapped_class: PlotterBase) -> Callable:
68
- if cls.__name__ not in cls._builders:
69
- cls._builders[cls.__name__] = {}
70
- key = wrapped_class.backend
71
-
72
- if key not in cls._builders[cls.__name__]:
73
- cls._builders[cls.__name__][key] = wrapped_class
74
- else:
75
- logger.warning(f'The {cls.__name__}/{key} builder is already registered.'
76
- f' Replacing it')
77
- return wrapped_class
78
-
79
- return inner_wrapper
80
-
81
- @classmethod
82
- def create(cls, key, **kwargs) -> PlotterBase:
83
- builder = cls._builders[cls.__name__].get(key)
84
- if not builder:
85
- raise ValueError(key)
86
- return builder(**kwargs)
87
-
88
- def get(self, backend: str, **kwargs):
89
- return self.create(backend, **kwargs)
90
-
91
- def backends(self) -> List[str]:
92
- """Returns the list of plotter backends, main identifier of a given plotter"""
93
- return sorted(list(self.builders[self.__class__.__name__].keys()))
94
-
File without changes
@@ -1,134 +0,0 @@
1
- from typing import List, Tuple, Any, TYPE_CHECKING, Union
2
- import sys
3
- import datetime
4
-
5
- import numpy as np
6
- from qtpy import QtWidgets
7
-
8
- from pymodaq.utils.logger import set_logger, get_module_name
9
- from pymodaq.utils import config as configmod
10
- from pymodaq.utils.data import DataDim, DataWithAxes, DataToExport
11
- from pymodaq.utils import daq_utils as utils
12
- from pymodaq.utils.plotting.plotter.plotter import PlotterBase, PlotterFactory
13
-
14
- from matplotlib import pyplot as plt
15
-
16
- if TYPE_CHECKING:
17
- pass
18
-
19
- logger = set_logger(get_module_name(__file__))
20
- config = configmod.Config()
21
-
22
- PLOT_COLORS = utils.plot_colors.copy()
23
- PLOT_COLORS.remove((255, 255, 255)) # remove white color as plotted on white background
24
- PLOT_COLORS = [(np.array(color) / 255).tolist() for color in PLOT_COLORS] # translation to matplotlib
25
-
26
-
27
- @PlotterFactory.register()
28
- class Plotter(PlotterBase):
29
- backend = 'matplotlib'
30
-
31
- def __init__(self, **_ignored):
32
- super().__init__()
33
- self.n_lines = 1
34
- self.n_columns = 1
35
- self.ind_line = 0
36
- self.ind_column = 0
37
-
38
- def plot(self, data: Union[DataWithAxes, DataToExport], *args, viewer=None,
39
- **kwargs) -> plt.Figure:
40
- fig = plt.figure()
41
-
42
- if isinstance(data, DataWithAxes):
43
- self.n_columns = len(data) if data.dim.name == 'Data2D' else 1
44
- self.plot_dwa(data, *args, **kwargs)
45
- elif isinstance(data, DataToExport):
46
- self.n_columns = max([len(dwa) if dwa.dim.name == 'Data2D' else 1 for dwa in data])
47
- self.n_lines = len(data)
48
- self.plot_dte(data, *args, **kwargs)
49
- plt.tight_layout()
50
- fig.suptitle(f'{data.name} taken the {datetime.datetime.fromtimestamp(data.timestamp)}')
51
- return fig
52
-
53
- def plot_dwa(self, dwa: DataWithAxes, *args, **kwargs):
54
- if dwa.dim.name == 'Data1D':
55
- if len(dwa.axes) == 0:
56
- dwa.create_missing_axes()
57
- self.ind_column = 0
58
- self.plot1D(dwa, *args, **kwargs)
59
- elif dwa.dim.name == 'Data2D':
60
- if len(dwa.axes) < 2:
61
- dwa.create_missing_axes()
62
- self.plot2D(dwa, *args, **kwargs)
63
-
64
- def plot_dte(self, dte: DataToExport, *args, **kwargs):
65
- for ind in range(len(dte)):
66
- self.ind_line = ind
67
- self.plot_dwa(dte[ind], *args, **kwargs)
68
-
69
- def plot1D(self, dwa: DataWithAxes, *args, **kwargs):
70
- plt.subplot(self.n_lines, self.n_columns,
71
- (self.n_columns * self.ind_line) + 1)
72
- for ind_data, data_array in enumerate(dwa):
73
- plt.plot(dwa.axes[0].get_data(), data_array, *args, color=PLOT_COLORS[ind_data],
74
- **kwargs)
75
- if dwa.errors is not None:
76
- plt.fill_between(dwa.axes[0].get_data(), data_array - dwa.get_error(ind_data),
77
- data_array + dwa.get_error(ind_data), *args,
78
- color=PLOT_COLORS[ind_data] + [0.3], **kwargs)
79
- plt.legend(dwa.labels)
80
- #plt.title(f'{dwa.name}')
81
- plt.xlabel(f'{dwa.axes[0].label} ({dwa.axes[0].units})')
82
- plt.ylabel(dwa.name)
83
-
84
- def plot2D(self, dwa: DataWithAxes, *args, **kwargs):
85
- xaxis = dwa.get_axis_from_index(1)[0]
86
- yaxis = dwa.get_axis_from_index(0)[0]
87
-
88
- x = xaxis.get_data()
89
- y = yaxis.get_data()
90
- for ind_plot, dwa_array in enumerate(dwa):
91
- self.ind_column = ind_plot
92
- plt.subplot(self.n_lines, self.n_columns,
93
- (self.n_columns * self.ind_line) + ind_plot + 1)
94
- X, Y = np.meshgrid(x, y)
95
- plt.pcolormesh(X, Y, dwa_array, *args, **kwargs)
96
- plt.title(f'{dwa.name}/{dwa.labels[ind_plot]}')
97
- plt.xlabel(f'{xaxis.label} ({xaxis.units})')
98
- plt.ylabel(f'{yaxis.label} ({yaxis.units})')
99
-
100
-
101
- # if __name__ == '__main__':
102
- # from pymodaq.utils import data as data_mod
103
- # import numpy as np
104
- # from pymodaq.utils.math_utils import gauss1D, gauss2D
105
- # from pymodaq.utils.plotting.plotter.plotter import PlotterFactory
106
- # plotter_factory = PlotterFactory()
107
- #
108
- # x = np.linspace(0, 100, 101)
109
- # y = np.linspace(0, 100, 101)
110
- # y1 = gauss2D(x, 50, 20, y, 40, 7)
111
- #
112
- #
113
- # QtWidgets.QApplication.processEvents()
114
- # dwa = data_mod.DataRaw('mydata', data=[y1, y1, y1],
115
- # axes=[data_mod.Axis('xaxis', 'x units', data=x, index=0,
116
- # spread_order=0),
117
- # data_mod.Axis('yaxis', 'y units', data=y, index=1,
118
- # spread_order=0)
119
- # ],
120
- # labels=['MAG', 'PHASE'],
121
- # nav_indexes=())
122
- # dte = dwa.as_dte('mydte')
123
- # dwa_mean = dwa.mean()
124
- # dwa_mean.name = 'mean'
125
- # dwa_mean_2 = dwa.mean(1)
126
- # dwa_mean_2.name = 'mean2'
127
- # dte.append(dwa_mean)
128
- # dte.append(dwa_mean_2)
129
- #
130
- # fig = dwa.plot('matplotlib')
131
- # fig.savefig('myplot.png')
132
- #
133
- # fig2 = dte.plot('matplotlib')
134
- # fig2.savefig('mydte.png')
@@ -1,78 +0,0 @@
1
- from typing import List, Tuple, Any, TYPE_CHECKING, Union
2
- import sys
3
-
4
- from qtpy import QtWidgets
5
-
6
- from pymodaq.utils.logger import set_logger, get_module_name
7
- from pymodaq.utils import config as configmod
8
- from pymodaq.utils.gui_utils.utils import start_qapplication
9
- from pymodaq.utils.plotting.plotter.plotter import PlotterBase, PlotterFactory
10
- from pymodaq.utils.data import DataWithAxes, DataToExport
11
- from pymodaq.utils.plotting.data_viewers import (Viewer1D, Viewer2D, ViewerND, ViewerDispatcher,
12
- Viewer0D, ViewersEnum)
13
- from pymodaq.utils.plotting.data_viewers.viewer import ViewerBase, viewer_factory
14
- from pymodaq.utils.gui_utils.dock import DockArea
15
-
16
- logger = set_logger(get_module_name(__file__))
17
- config = configmod.Config()
18
-
19
-
20
- @PlotterFactory.register()
21
- class Plotter(PlotterBase):
22
- backend = 'qt'
23
-
24
- def __init__(self, **_ignored):
25
- super().__init__()
26
-
27
- def plot(self, data: Union[DataWithAxes, DataToExport], viewer=None, **kwargs) -> ViewerBase:
28
- do_exit = False
29
- qapp = QtWidgets.QApplication.instance()
30
- if qapp is None:
31
- do_exit = True
32
- qapp = start_qapplication()
33
-
34
- if viewer is None:
35
- if isinstance(data, DataToExport):
36
- widget = DockArea()
37
- viewer = ViewerDispatcher(widget, title=data.name)
38
- else:
39
- widget = QtWidgets.QWidget()
40
- viewer_enum = ViewersEnum.get_viewers_enum_from_data(data)
41
- viewer = viewer_factory.get(viewer_enum.name, parent=widget)
42
- widget.show()
43
-
44
- if viewer is not None:
45
- viewer.show_data(data, **kwargs)
46
- if isinstance(viewer, Viewer1D):
47
- if not viewer.is_action_checked('errors'):
48
- viewer.get_action('errors').trigger()
49
- QtWidgets.QApplication.processEvents()
50
-
51
- if do_exit:
52
- sys.exit(qapp.exec())
53
- return viewer
54
-
55
-
56
- if __name__ == '__main__':
57
- from pymodaq.utils import data as data_mod
58
- import numpy as np
59
- from pymodaq.utils.math_utils import gauss1D
60
- from pymodaq.utils.plotting.plotter.plotter import PlotterFactory
61
-
62
- qapp = start_qapplication()
63
-
64
- plotter_factory = PlotterFactory()
65
-
66
- x = np.random.randint(201, size=201)
67
- y1 = gauss1D(x, 75, 25)
68
- y2 = gauss1D(x, 120, 50, 2)
69
-
70
- QtWidgets.QApplication.processEvents()
71
- dwa = data_mod.DataRaw('mydata', data=[y1, y2],
72
- axes=[data_mod.Axis('myaxis', 'units', data=x, index=0,
73
- spread_order=0)],
74
- nav_indexes=())
75
-
76
- dwa.plot('qt')
77
- dwa.as_dte('mydte').plot('qt')
78
- sys.exit(qapp.exec())
File without changes