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,274 +0,0 @@
1
- from typing import List, Union
2
- import numpy as np
3
-
4
- from qtpy import QtWidgets
5
-
6
- from pymodaq.utils.logger import set_logger, get_module_name
7
- from pymodaq.utils.data import DataToExport, DataWithAxes, Axis, DataSource
8
-
9
- from pymodaq.utils.enums import enum_checker
10
- from pymodaq.utils.factory import ObjectFactory
11
- from pymodaq.utils.plotting import data_viewers
12
- from pymodaq.utils.plotting.data_viewers.base import ViewerBase, ViewersEnum
13
- from pymodaq.utils.gui_utils import DockArea, Dock
14
-
15
- config_viewers = {}
16
-
17
- logger = set_logger(get_module_name(__file__))
18
-
19
-
20
- def get_viewer_enum_from_axes(Naxes: int):
21
- if Naxes < 0:
22
- raise ValueError('Naxes could not be below 0')
23
- if Naxes == 0:
24
- viewer_enum = ViewersEnum['Viewer0D']
25
- elif Naxes == 1:
26
- viewer_enum = ViewersEnum['Viewer1D']
27
- elif Naxes == 2:
28
- viewer_enum = ViewersEnum['Viewer2D']
29
- else:
30
- viewer_enum = ViewersEnum['ViewerND']
31
- return viewer_enum
32
-
33
-
34
- class ViewerFactory(ObjectFactory):
35
- def get(self, viewer_name, **kwargs):
36
- if viewer_name not in ViewersEnum.names():
37
- raise ValueError(f'{viewer_name} is not a valid PyMoDAQ Viewer: {ViewersEnum.names()}')
38
- return self.create(viewer_name, **kwargs)
39
-
40
- @property
41
- def viewers(self):
42
- return self.keys
43
-
44
-
45
- @ViewerFactory.register('Viewer0D')
46
- def create_viewer0D(parent: QtWidgets.QWidget = None, **_ignored):
47
- return data_viewers.viewer0D.Viewer0D(parent)
48
-
49
-
50
- @ViewerFactory.register('Viewer1D')
51
- def create_viewer1D(parent: QtWidgets.QWidget, **_ignored):
52
- return data_viewers.viewer1D.Viewer1D(parent)
53
-
54
-
55
- @ViewerFactory.register('Viewer2D')
56
- def create_viewer2D(parent: QtWidgets.QWidget, **_ignored):
57
- return data_viewers.viewer2D.Viewer2D(parent)
58
-
59
-
60
- @ViewerFactory.register('ViewerND')
61
- def create_viewerND(parent: QtWidgets.QWidget, **_ignored):
62
- return data_viewers.viewerND.ViewerND(parent)
63
-
64
-
65
- # @ViewerFactory.register('ViewerSequential')
66
- # def create_viewer_sequential(widget: QtWidgets.QWidget, **_ignored):
67
- # return data_viewers.viewer_sequential.ViewerSequential(widget)
68
-
69
-
70
- viewer_factory = ViewerFactory()
71
-
72
-
73
- class ViewerDispatcher:
74
- """MixIn class to add easy control for adding multuiple data viewers in docks depending on
75
- data to be plotted
76
-
77
- Parameters
78
- ----------
79
- dockarea: DockArea
80
- title: str
81
- next_to_dock: Dock
82
- (deprecated) has no effect
83
- direction: str
84
- either 'right', 'left', 'bottom', 'top'.
85
-
86
- """
87
-
88
- def __init__(self, dockarea: DockArea = None, title: str = '', next_to_dock: Dock = None,
89
- direction='right'):
90
- super().__init__()
91
- self._title = title
92
-
93
- self._next_to_dock = next_to_dock
94
-
95
- if dockarea is None:
96
- dockarea = DockArea()
97
- dockarea.show()
98
- self.dockarea = dockarea
99
-
100
- self._direction = direction
101
-
102
- self._viewer_docks = []
103
- self._viewer_widgets = []
104
- self._viewer_types = []
105
- self._viewers = []
106
-
107
- @property
108
- def viewers(self) -> List[ViewerBase]:
109
- return self._viewers
110
-
111
- @property
112
- def viewer_docks(self) -> List[Dock]:
113
- return self._viewer_docks
114
-
115
- @property
116
- def viewer_widgets(self) -> List[QtWidgets.QWidget]:
117
- return self._viewer_widgets
118
-
119
- @property
120
- def viewer_types(self) -> List[ViewersEnum]:
121
- return self._viewer_types
122
-
123
- def remove_viewers(self, Nviewers_to_leave: int = 0):
124
- """Remove viewers from the list after index Nviewers_to_leave
125
-
126
- Parameters
127
- ----------
128
- Nviewers
129
-
130
- Returns
131
- -------
132
-
133
- """
134
- while len(self.viewer_docks) > Nviewers_to_leave:
135
- widget = self.viewer_widgets.pop()
136
- widget.close()
137
- dock = self.viewer_docks.pop()
138
- dock.close()
139
- self.viewers.pop()
140
- self.viewer_types.pop()
141
- QtWidgets.QApplication.processEvents()
142
-
143
- def add_viewer(self, viewer_type: ViewersEnum, dock_viewer=None, dock_name=None):
144
- viewer_type = enum_checker(ViewersEnum, viewer_type)
145
-
146
- if dock_viewer is None:
147
- if dock_name is None:
148
- dock_name = f'{self._title}_Viewer_{len(self.viewer_docks) + 1}'
149
- dock_viewer = Dock(dock_name, size=(350, 350), closable=False)
150
- self.viewer_docks.append(dock_viewer)
151
-
152
- self._viewer_widgets.append(QtWidgets.QWidget())
153
- self.viewers.append(viewer_factory.get(viewer_type.name, parent=self._viewer_widgets[-1]))
154
-
155
- self.viewer_types.append(viewer_type)
156
-
157
- self.viewer_docks[-1].addWidget(self._viewer_widgets[-1])
158
- # if len(self.viewer_docks) == 1:
159
- # if self._next_to_dock is not None:
160
- # self.dockarea.addDock(self.viewer_docks[-1], 'right', self._next_to_dock)
161
- # else:
162
- # self.dockarea.addDock(self.viewer_docks[-1])
163
- # else:
164
- # self.dockarea.addDock(self.viewer_docks[-1], 'right', self.viewer_docks[-2])
165
- self.dockarea.addDock(self.viewer_docks[-1], self._direction)
166
-
167
- def update_viewers(self, viewers_type: List[Union[str, ViewersEnum]],
168
- viewers_name: List[str] = None, force=False):
169
- """
170
-
171
- Parameters
172
- ----------
173
- viewers_type: List[ViewersEnum]
174
- viewers_name: List[str] or None
175
- force: bool
176
- if True remove all viewers before update else check if new viewers type are compatible with old ones
177
-
178
- Returns
179
- -------
180
-
181
- """
182
-
183
- Nviewers_to_leave = 0
184
- if not force:
185
- # check if viewers are compatible with new data dim
186
- for ind, viewer_type in enumerate(viewers_type):
187
- if len(self.viewer_types) > ind:
188
- if viewer_type == self.viewer_types[ind]:
189
- Nviewers_to_leave += 1
190
- else:
191
- break
192
- else:
193
- break
194
- self.remove_viewers(Nviewers_to_leave)
195
- ind_loop = 0
196
- while len(self.viewers) < len(viewers_type):
197
- self.add_viewer(viewers_type[Nviewers_to_leave + ind_loop],
198
- dock_name=viewers_name[Nviewers_to_leave + ind_loop]
199
- if viewers_name is not None else None)
200
- ind_loop += 1
201
- QtWidgets.QApplication.processEvents()
202
-
203
- def close(self):
204
- for dock in self.viewer_docks:
205
- dock.close()
206
-
207
- def show_data(self, data: DataToExport, **kwargs):
208
- """ Convenience method. Display each dwa in a dedicated data viewer"""
209
- viewer_types = [ViewersEnum.get_viewers_enum_from_data(dwa) for dwa in data]
210
- if self.viewer_types != viewer_types:
211
- self.update_viewers(viewer_types)
212
- for viewer, dwa in zip(self.viewers, data):
213
- if len(dwa.axes) != len(dwa.shape):
214
- dwa.create_missing_axes()
215
- viewer.show_data(dwa)
216
-
217
-
218
- if __name__ == '__main__':
219
-
220
- LABEL = 'A Label'
221
- UNITS = 'units'
222
- OFFSET = -20.4
223
- SCALING = 0.22
224
- SIZE = 20
225
- DATA = OFFSET + SCALING * np.linspace(0, SIZE - 1, SIZE)
226
-
227
- DATA0D = np.array([2.7])
228
- DATA1D = np.arange(0, 10)
229
- DATA2D = np.arange(0, 5 * 6).reshape((5, 6))
230
- DATAND = np.arange(0, 5 * 6 * 3).reshape((5, 6, 3))
231
- Nn0 = 10
232
- Nn1 = 5
233
-
234
-
235
- def init_axis(data=None, index=0):
236
- if data is None:
237
- data = DATA
238
- return Axis(label=LABEL, units=UNITS, data=data, index=index)
239
-
240
-
241
- def init_data(data=None, Ndata=1, axes=[], name='myData', source=DataSource['raw'],
242
- labels=None) -> DataWithAxes:
243
- if data is None:
244
- data = DATA2D
245
- return DataWithAxes(name, source, data=[data for ind in range(Ndata)],
246
- axes=axes, labels=labels)
247
-
248
-
249
- def ini_data_to_export():
250
- dat1 = init_data(data=DATA2D, Ndata=2, name='data2D')
251
- dat2 = init_data(data=DATA1D, Ndata=3, name='data1D')
252
- data = DataToExport(name='toexport', data=[dat1, dat2])
253
- return dat1, dat2, data
254
-
255
- import sys
256
-
257
- app = QtWidgets.QApplication(sys.argv)
258
-
259
- dockarea = DockArea()
260
- prog = ViewerDispatcher(dockarea=dockarea, title='Dispatcher')
261
- dockarea.show()
262
-
263
- _, _, dte = ini_data_to_export()
264
-
265
- # N = 2
266
- # viewers = ['Viewer0D', 'Viewer1D', 'Viewer2D']
267
- # viewers = [ViewersEnum[random.choice(viewers)] for ind in range(N)]
268
- # viewers = ['Viewer2D', 'Viewer2D', ]
269
- # print(viewers)
270
- # prog.update_viewers(viewers)
271
-
272
- prog.show_data(dte)
273
-
274
- sys.exit(app.exec_())
@@ -1,298 +0,0 @@
1
- from typing import List, Union, Dict
2
- from numbers import Real
3
-
4
- from qtpy import QtWidgets, QtGui
5
- from qtpy.QtCore import QObject, Slot, Signal, Qt
6
- import sys
7
- import pyqtgraph
8
-
9
- import pymodaq.utils.daq_utils as utils
10
- from pymodaq.utils import data as data_mod
11
- from pymodaq.utils.logger import set_logger, get_module_name
12
- from pymodaq.utils.plotting.data_viewers.viewer import ViewerBase
13
- from pymodaq.utils.managers.action_manager import ActionManager
14
- from pymodaq.utils.plotting.widgets import PlotWidget
15
- from pymodaq.utils.plotting.utils.plot_utils import Data0DWithHistory
16
-
17
- import numpy as np
18
- from collections import OrderedDict
19
- import datetime
20
-
21
- logger = set_logger(get_module_name(__file__))
22
- PLOT_COLORS = [dict(color=color) for color in utils.plot_colors]
23
-
24
-
25
- class DataDisplayer(QObject):
26
- """
27
- This Object deals with the display of 0D data on a plotitem
28
- """
29
-
30
- updated_item = Signal(list)
31
- labels_changed = Signal(list)
32
-
33
- def __init__(self, plotitem: pyqtgraph.PlotItem, plot_colors=PLOT_COLORS):
34
- super().__init__()
35
- self._plotitem = plotitem
36
- self.colors = plot_colors
37
- self._plotitem.addLegend()
38
- self._plot_items: List[pyqtgraph.PlotDataItem] = []
39
- self._min_lines: List[pyqtgraph.InfiniteLine] = []
40
- self._max_lines: List[pyqtgraph.InfiniteLine] = []
41
- self._data = Data0DWithHistory()
42
-
43
- self._mins: List = []
44
- self._maxs: List = []
45
-
46
- self._show_lines: bool = False
47
-
48
- axis = self._plotitem.getAxis('bottom')
49
- axis.setLabel(text='Samples', units='S')
50
-
51
- def update_colors(self, colors: List[QtGui.QPen]):
52
- self.colors[0:len(colors)] = colors
53
- self.update_data(self._data.last_data, force_update=True)
54
-
55
- @property
56
- def legend(self) -> pyqtgraph.LegendItem:
57
- return self._plotitem.legend
58
-
59
- @property
60
- def legend_names(self) -> List[str]:
61
- return [item[1].text for item in self.legend.items]
62
-
63
- @property
64
- def axis(self):
65
- return self._data.xaxis
66
-
67
- def clear_data(self):
68
- self._data.clear_data()
69
- self._mins = []
70
- self._maxs = []
71
-
72
- def update_axis(self, history_length: int):
73
- self._data.length = history_length
74
-
75
- @property
76
- def Ndata(self):
77
- return len(self._data.last_data) if self._data.last_data is not None else 0
78
-
79
- def update_data(self, data: data_mod.DataWithAxes, force_update=False):
80
- if data is not None:
81
- if len(data) != len(self._plot_items) or force_update or data.labels != self.legend_names:
82
- self.update_display_items(data)
83
-
84
- self._data.add_datas(data)
85
- for ind, data_str in enumerate(self._data.datas):
86
- self._plot_items[ind].setData(self._data.xaxis, self._data.datas[data_str])
87
- if len(self._mins) != len(self._data.datas):
88
- self._mins = []
89
- self._maxs = []
90
-
91
- for ind, label in enumerate(self._data.datas):
92
- if len(self._mins) != len(self._data.datas):
93
- self._mins.append(float(np.min(self._data.datas[label])))
94
- self._maxs.append(float(np.max(self._data.datas[label])))
95
- else:
96
- self._mins[ind] = min(self._mins[ind], float(np.min(self._data.datas[label])))
97
- self._maxs[ind] = max(self._maxs[ind], float(np.max(self._data.datas[label])))
98
- self._min_lines[ind].setValue(self._mins[ind])
99
- self._max_lines[ind].setValue(self._maxs[ind])
100
-
101
- def update_display_items(self, data: data_mod.DataWithAxes = None):
102
- while len(self._plot_items) > 0:
103
- plot_item = self._plotitem.removeItem(self._plot_items.pop(0))
104
- self.legend.removeItem(plot_item)
105
- self._plotitem.removeItem(self._max_lines.pop(0))
106
- self._plotitem.removeItem(self._min_lines.pop(0))
107
- if data is not None:
108
- for ind in range(len(data)):
109
- self._plot_items.append(pyqtgraph.PlotDataItem(pen=self.colors[ind]))
110
- self._plotitem.addItem(self._plot_items[-1])
111
- self.legend.addItem(self._plot_items[-1], data.labels[ind])
112
- max_line = pyqtgraph.InfiniteLine(angle=0,
113
- pen=pyqtgraph.mkPen(color=self.colors[ind]['color'],
114
- style=Qt.DashLine))
115
- min_line = pyqtgraph.InfiniteLine(angle=0,
116
- pen=pyqtgraph.mkPen(color=self.colors[ind]['color'],
117
- style=Qt.DashLine))
118
- self._max_lines.append(max_line)
119
- self._min_lines.append(min_line)
120
- max_line.setVisible(self._show_lines)
121
- min_line.setVisible(self._show_lines)
122
- self._plotitem.addItem(self._max_lines[-1])
123
- self._plotitem.addItem(self._min_lines[-1])
124
-
125
- self.updated_item.emit(self._plot_items)
126
- self.labels_changed.emit(data.labels)
127
-
128
- def show_min_max(self, show=True):
129
- self._show_lines = show
130
- for line in self._max_lines:
131
- line.setVisible(show)
132
- for line in self._min_lines:
133
- line.setVisible(show)
134
-
135
-
136
- class View0D(ActionManager, QObject):
137
- def __init__(self, parent_widget: QtWidgets.QWidget = None, show_toolbar=True,
138
- no_margins=False):
139
- QObject.__init__(self)
140
- ActionManager.__init__(self, toolbar=QtWidgets.QToolBar())
141
-
142
- self.no_margins = no_margins
143
- self.data_displayer: DataDisplayer = None
144
- self.other_data_displayers: Dict[str, DataDisplayer] = {}
145
- self.plot_widget: PlotWidget = PlotWidget()
146
- self.values_list = QtWidgets.QListWidget()
147
-
148
- self.setup_actions()
149
-
150
- self.parent_widget = parent_widget
151
- if self.parent_widget is None:
152
- self.parent_widget = QtWidgets.QWidget()
153
- self.parent_widget.show()
154
-
155
- self.data_displayer = DataDisplayer(self.plotitem)
156
-
157
- self._setup_widgets()
158
- self._connect_things()
159
- self._prepare_ui()
160
- if not show_toolbar:
161
- self.splitter.setSizes([0,1])
162
-
163
- self.get_action('Nhistory').setValue(200) #default history length
164
-
165
- def setup_actions(self):
166
- self.add_action('clear', 'Clear plot', 'clear2', 'Clear the current plots')
167
- self.add_widget('Nhistory', pyqtgraph.SpinBox, tip='Set the history length of the plot',
168
- setters=dict(setMaximumWidth=100))
169
- self.add_action('show_data_as_list', 'Show numbers', 'ChnNum', 'If triggered, will display last data as numbers'
170
- 'in a side panel', checkable=True)
171
- self.add_action('show_min_max', 'Show Min/Max lines', 'Statistics',
172
- 'If triggered, will display horizontal dashed lines for min/max of data', checkable=True)
173
-
174
- def _setup_widgets(self):
175
- self.splitter = QtWidgets.QSplitter(Qt.Vertical)
176
- self.parent_widget.setLayout(QtWidgets.QVBoxLayout())
177
- if self.no_margins:
178
- self.parent_widget.layout().setContentsMargins(0, 0, 0, 0)
179
-
180
- self.parent_widget.layout().addWidget(self.splitter)
181
- self.splitter.addWidget(self.toolbar)
182
- self.splitter.setStretchFactor(0, 0)
183
-
184
- splitter_hor = QtWidgets.QSplitter(Qt.Horizontal)
185
- self.splitter.addWidget(splitter_hor)
186
-
187
- splitter_hor.addWidget(self.plot_widget)
188
- splitter_hor.addWidget(self.values_list)
189
-
190
- font = QtGui.QFont()
191
- font.setPointSize(20)
192
- self.values_list.setFont(font)
193
-
194
- def _connect_things(self):
195
- self.connect_action('clear', self.data_displayer.clear_data)
196
- self.connect_action('show_data_as_list', self.show_data_list)
197
- self.connect_action('Nhistory', self.data_displayer.update_axis, signal_name='valueChanged')
198
- self.connect_action('show_min_max', self.data_displayer.show_min_max)
199
-
200
- def _prepare_ui(self):
201
- """add here everything needed at startup"""
202
- self.values_list.setVisible(False)
203
-
204
- def get_double_clicked(self):
205
- return self.plot_widget.view.sig_double_clicked
206
-
207
- @property
208
- def plotitem(self):
209
- return self.plot_widget.plotItem
210
-
211
- def display_data(self, data: data_mod.DataWithAxes, displayer: str = None, **kwargs):
212
- if displayer is None:
213
- self.data_displayer.update_data(data)
214
- elif displayer in self.other_data_displayers:
215
- self.other_data_displayers[displayer].update_data(data)
216
- if self.is_action_checked('show_data_as_list'):
217
- self.values_list.clear()
218
- self.values_list.addItems(['{:.03e}'.format(dat[0]) for dat in data])
219
- QtWidgets.QApplication.processEvents()
220
-
221
- def show_data_list(self, state=None):
222
- if state is None:
223
- state = self.is_action_checked('show_data_as_list')
224
- self.values_list.setVisible(state)
225
-
226
- def add_data_displayer(self, displayer_name: str, plot_colors=PLOT_COLORS):
227
- self.other_data_displayers[displayer_name] = DataDisplayer(self.plotitem, plot_colors)
228
- self.connect_action('clear', self.other_data_displayers[displayer_name].clear_data)
229
-
230
- def remove_data_displayer(self, displayer_name: str):
231
- displayer = self.other_data_displayers.pop(displayer_name, None)
232
- if displayer is not None:
233
- displayer.update_display_items()
234
-
235
-
236
- class Viewer0D(ViewerBase):
237
- """this plots 0D data on a plotwidget with history. Display as numbers in a table is possible.
238
-
239
- Datas and measurements are then exported with the signal data_to_export_signal
240
- """
241
-
242
- def __init__(self, parent=None, title='', show_toolbar=True, no_margins=False):
243
- super().__init__(parent, title)
244
- self.view = View0D(self.parent, show_toolbar=show_toolbar, no_margins=no_margins)
245
- self._labels = []
246
-
247
- def update_colors(self, colors: list, displayer=None):
248
- if displayer is None:
249
- self.view.data_displayer.update_colors(colors)
250
- elif displayer in self.view.other_data_displayers:
251
- self.view.other_data_displayers[displayer].update_colors(colors)
252
-
253
- @property
254
- def labels(self):
255
- return self._labels
256
-
257
- @labels.setter
258
- def labels(self, labels):
259
- if labels != self._labels:
260
- self._labels = labels
261
-
262
- @Slot(list)
263
- def _show_data(self, data: data_mod.DataRaw):
264
- self.labels = data.labels
265
- self.view.display_data(data)
266
- self.data_to_export_signal.emit(self.data_to_export)
267
-
268
-
269
- def main_view():
270
- app = QtWidgets.QApplication(sys.argv)
271
- widget = QtWidgets.QWidget()
272
- prog = View0D(widget)
273
- widget.show()
274
- sys.exit(app.exec_())
275
-
276
-
277
- def main():
278
- app = QtWidgets.QApplication(sys.argv)
279
- widget = QtWidgets.QWidget()
280
- prog = Viewer0D(widget, show_toolbar=False)
281
- from pymodaq.utils.math_utils import gauss1D
282
-
283
- x = np.linspace(0, 200, 201)
284
- y1 = gauss1D(x, 75, 25) + 0.1*np.random.rand(len(x))
285
- y2 = 0.7 * gauss1D(x, 120, 50, 2) + 0.2*np.random.rand(len(x))
286
- widget.show()
287
- prog.get_action('show_data_as_list').trigger()
288
- for ind, data in enumerate(y1):
289
- prog.show_data(data_mod.DataRaw('mydata', data=[np.array([data]), np.array([y2[ind]])],
290
- labels=['lab1', 'lab2']))
291
- QtWidgets.QApplication.processEvents()
292
-
293
- sys.exit(app.exec_())
294
-
295
-
296
- if __name__ == '__main__': # pragma: no cover
297
- #main_view()
298
- main()