pymodaq 4.2.3__py3-none-any.whl → 5.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (399) hide show
  1. pymodaq/__init__.py +30 -23
  2. pymodaq/control_modules/daq_move.py +27 -14
  3. pymodaq/control_modules/daq_move_ui.py +33 -16
  4. pymodaq/control_modules/daq_viewer.py +38 -28
  5. pymodaq/control_modules/daq_viewer_ui.py +6 -6
  6. pymodaq/control_modules/mocks.py +1 -1
  7. pymodaq/control_modules/move_utility_classes.py +19 -10
  8. pymodaq/control_modules/utils.py +18 -12
  9. pymodaq/control_modules/viewer_utility_classes.py +13 -4
  10. pymodaq/dashboard.py +166 -118
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +7 -7
  13. pymodaq/examples/function_plotter.py +13 -12
  14. pymodaq/examples/parameter_ex.py +50 -25
  15. pymodaq/examples/tcp_client.py +1 -1
  16. pymodaq/extensions/__init__.py +1 -1
  17. pymodaq/extensions/bayesian/bayesian_optimisation.py +15 -12
  18. pymodaq/extensions/bayesian/utils.py +10 -10
  19. pymodaq/extensions/console.py +10 -13
  20. pymodaq/extensions/{daq_logger.py → daq_logger/daq_logger.py} +36 -56
  21. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger.py +16 -15
  22. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger_models.py +2 -0
  23. pymodaq/{utils/h5modules → extensions/daq_logger}/h5logging.py +7 -8
  24. pymodaq/extensions/daq_scan.py +153 -247
  25. pymodaq/extensions/daq_scan_ui.py +11 -9
  26. pymodaq/extensions/h5browser.py +8 -8
  27. pymodaq/extensions/pid/__init__.py +6 -3
  28. pymodaq/extensions/pid/daq_move_PID.py +4 -2
  29. pymodaq/extensions/pid/pid_controller.py +15 -12
  30. pymodaq/extensions/pid/utils.py +10 -5
  31. pymodaq/extensions/utils.py +5 -3
  32. pymodaq/post_treatment/load_and_plot.py +10 -7
  33. pymodaq/resources/preset_default.xml +1 -1
  34. pymodaq/utils/array_manipulation.py +4 -384
  35. pymodaq/utils/calibration_camera.py +12 -9
  36. pymodaq/utils/chrono_timer.py +7 -5
  37. pymodaq/utils/config.py +3 -450
  38. pymodaq/utils/daq_utils.py +6 -664
  39. pymodaq/utils/data.py +9 -2774
  40. pymodaq/utils/exceptions.py +0 -4
  41. pymodaq/utils/gui_utils/__init__.py +8 -8
  42. pymodaq/utils/gui_utils/loader_utils.py +38 -0
  43. pymodaq/utils/gui_utils/utils.py +6 -138
  44. pymodaq/utils/h5modules/__init__.py +0 -4
  45. pymodaq/utils/h5modules/module_saving.py +15 -8
  46. pymodaq/utils/leco/__init__.py +2 -2
  47. pymodaq/utils/leco/daq_move_LECODirector.py +2 -2
  48. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +2 -2
  49. pymodaq/utils/leco/director_utils.py +2 -2
  50. pymodaq/utils/leco/leco_director.py +3 -3
  51. pymodaq/utils/leco/pymodaq_listener.py +2 -2
  52. pymodaq/utils/leco/utils.py +1 -1
  53. pymodaq/utils/logger.py +4 -76
  54. pymodaq/utils/managers/batchscan_manager.py +16 -19
  55. pymodaq/utils/managers/modules_manager.py +10 -7
  56. pymodaq/utils/managers/overshoot_manager.py +3 -5
  57. pymodaq/utils/managers/preset_manager.py +37 -15
  58. pymodaq/utils/managers/preset_manager_utils.py +11 -9
  59. pymodaq/utils/managers/remote_manager.py +12 -10
  60. pymodaq/utils/math_utils.py +4 -572
  61. pymodaq/utils/parameter/__init__.py +4 -11
  62. pymodaq/utils/parameter/utils.py +4 -299
  63. pymodaq/utils/scanner/scan_config.py +1 -1
  64. pymodaq/utils/scanner/scan_factory.py +16 -12
  65. pymodaq/utils/{plotting → scanner}/scan_selector.py +19 -20
  66. pymodaq/utils/scanner/scanner.py +10 -8
  67. pymodaq/utils/scanner/scanners/_1d_scanners.py +8 -5
  68. pymodaq/utils/scanner/scanners/_2d_scanners.py +5 -5
  69. pymodaq/utils/scanner/scanners/sequential.py +8 -8
  70. pymodaq/utils/scanner/scanners/tabular.py +9 -9
  71. pymodaq/utils/scanner/utils.py +6 -4
  72. pymodaq/utils/svg/svg_viewer2D.py +3 -4
  73. pymodaq/utils/tcp_ip/serializer.py +64 -16
  74. pymodaq/utils/tcp_ip/tcp_server_client.py +10 -8
  75. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +1 -1
  78. pymodaq/post_treatment/process_to_scalar.py +0 -263
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  311. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  312. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  313. pymodaq/resources/VERSION +0 -1
  314. pymodaq/resources/config_template.toml +0 -90
  315. pymodaq/resources/triangulation_data.npy +0 -0
  316. pymodaq/utils/abstract/__init__.py +0 -48
  317. pymodaq/utils/db/__init__.py +0 -0
  318. pymodaq/utils/db/db_logger/__init__.py +0 -0
  319. pymodaq/utils/enums.py +0 -76
  320. pymodaq/utils/factory.py +0 -82
  321. pymodaq/utils/gui_utils/custom_app.py +0 -133
  322. pymodaq/utils/gui_utils/dock.py +0 -107
  323. pymodaq/utils/gui_utils/file_io.py +0 -93
  324. pymodaq/utils/gui_utils/layout.py +0 -34
  325. pymodaq/utils/gui_utils/list_picker.py +0 -38
  326. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  327. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  328. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  329. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  330. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  331. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  332. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  333. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  334. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  335. pymodaq/utils/h5modules/backends.py +0 -1022
  336. pymodaq/utils/h5modules/browsing.py +0 -625
  337. pymodaq/utils/h5modules/data_saving.py +0 -1101
  338. pymodaq/utils/h5modules/exporter.py +0 -119
  339. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  340. pymodaq/utils/h5modules/exporters/base.py +0 -111
  341. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  342. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  343. pymodaq/utils/h5modules/saving.py +0 -866
  344. pymodaq/utils/h5modules/utils.py +0 -115
  345. pymodaq/utils/managers/action_manager.py +0 -489
  346. pymodaq/utils/managers/parameter_manager.py +0 -282
  347. pymodaq/utils/managers/roi_manager.py +0 -726
  348. pymodaq/utils/messenger.py +0 -66
  349. pymodaq/utils/parameter/ioxml.py +0 -542
  350. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  351. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  352. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  353. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  354. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  355. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  356. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  357. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  358. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  359. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  360. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  361. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  362. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  363. pymodaq/utils/plotting/__init__.py +0 -0
  364. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  365. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  366. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  367. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  368. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -820
  369. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  370. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  371. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  372. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  373. pymodaq/utils/plotting/gant_chart.py +0 -123
  374. pymodaq/utils/plotting/image_viewer.py +0 -97
  375. pymodaq/utils/plotting/items/__init__.py +0 -0
  376. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  377. pymodaq/utils/plotting/items/crosshair.py +0 -94
  378. pymodaq/utils/plotting/items/image.py +0 -388
  379. pymodaq/utils/plotting/navigator.py +0 -353
  380. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  381. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  382. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  383. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  384. pymodaq/utils/plotting/utils/__init__.py +0 -0
  385. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  386. pymodaq/utils/plotting/utils/filter.py +0 -585
  387. pymodaq/utils/plotting/utils/lineout.py +0 -226
  388. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  389. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  390. pymodaq/utils/plotting/widgets.py +0 -76
  391. pymodaq/utils/qvariant.py +0 -12
  392. pymodaq/utils/slicing.py +0 -63
  393. pymodaq/utils/units.py +0 -216
  394. pymodaq-4.2.3.dist-info/RECORD +0 -438
  395. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  396. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  397. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  398. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,88 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created the 26/01/2023
4
-
5
- @author: Sebastien Weber
6
- """
7
- from typing import List
8
-
9
- from qtpy import QtWidgets, QtCore
10
-
11
- from pymodaq.utils.plotting.data_viewers.viewer1Dbasic import Viewer1DBasic
12
- from pymodaq.utils.data import Axis
13
- from pymodaq.utils.math_utils import find_index
14
-
15
-
16
- class AxesViewer(QtCore.QObject):
17
- navigation_changed = QtCore.Signal()
18
-
19
- def __init__(self, parent_widget: QtWidgets.QWidget):
20
- super().__init__()
21
- self._axes: List[Axis]
22
- self.parent = parent_widget
23
- self.parent.setLayout(QtWidgets.QVBoxLayout())
24
- self.nav_axes_viewers: List[Viewer1DBasic] = []
25
-
26
- def clear_viewers(self):
27
- while len(self.nav_axes_viewers) != 0:
28
- viewer = self.nav_axes_viewers.pop(0)
29
- self.parent.layout().removeWidget(viewer.parent)
30
- viewer.parent.close()
31
-
32
- def add_viewers(self, nviewers: int):
33
- widgets = []
34
- for ind in range(nviewers):
35
- widgets.append(QtWidgets.QWidget())
36
- self.parent.layout().addWidget(widgets[-1])
37
- self.nav_axes_viewers.append(Viewer1DBasic(widgets[-1], show_line=True))
38
-
39
- def set_nav_viewers(self, axes: List[Axis]):
40
- self._axes = axes
41
- if len(self.nav_axes_viewers) != len(axes):
42
- self.clear_viewers()
43
- self.add_viewers(len(axes))
44
-
45
- for ind in range(len(axes)):
46
- self.nav_axes_viewers[ind].roi_line_signal.connect(self._emit_nav_signal)
47
- self.nav_axes_viewers[ind].show_data([axes[ind].get_data()])
48
- self.nav_axes_viewers[ind].set_axis_label(dict(orientation='bottom',
49
- label='Scan index',
50
- units=''))
51
- self.nav_axes_viewers[ind].set_axis_label(dict(orientation='left',
52
- label=axes[ind].label,
53
- units=axes[ind].units))
54
-
55
- def _emit_nav_signal(self):
56
- self.navigation_changed.emit()
57
-
58
- def get_crosshairs(self):
59
- return tuple([viewer.get_line_position() for viewer in self.nav_axes_viewers])
60
-
61
- def get_indexes(self):
62
- return [int(cross) for cross in self.get_crosshairs()]
63
-
64
- def setVisible(self, show=True):
65
- """convenience method to show or hide the paretn widget"""
66
- self.parent.setVisible(show)
67
-
68
-
69
- if __name__ == '__main__':
70
- import sys
71
- import numpy as np
72
- app = QtWidgets.QApplication(sys.argv)
73
-
74
- widget = QtWidgets.QWidget()
75
- prog = AxesViewer(widget)
76
- widget.show()
77
- labels = ['']
78
- N = 2
79
- axes = [Axis(label=f'Axis{ind:02d}', units='s', data=np.random.rand(50)) for ind in range(N)]
80
- prog.set_nav_viewers(axes)
81
-
82
- def print_positions():
83
- print(prog.get_crosshairs())
84
-
85
- prog.navigation_changed.connect(print_positions)
86
-
87
- sys.exit(app.exec_())
88
-
@@ -1,585 +0,0 @@
1
- import numpy as np
2
- from pyqtgraph.parametertree import Parameter
3
- from qtpy import QtCore, QtWidgets, QtGui
4
- from qtpy.QtCore import QPointF, Slot, Signal, QObject
5
- from typing import List, Tuple
6
-
7
- from pyqtgraph import LinearRegionItem
8
-
9
- from pymodaq.utils import data as data_mod
10
- from pymodaq.utils import daq_utils as utils
11
- from pymodaq.utils import math_utils as mutils
12
- from pymodaq.utils.managers.roi_manager import ROIManager, LinearROI, RectROI
13
- from pymodaq.utils.plotting.items.crosshair import Crosshair
14
- from pymodaq.utils.plotting.items.image import UniformImageItem
15
- from pymodaq.utils.plotting.data_viewers.viewer1Dbasic import Viewer1DBasic
16
- from pymodaq.utils.logger import set_logger, get_module_name
17
- from pymodaq.utils.data import DataFromRoi, DataToExport, Axis, DataWithAxes
18
-
19
-
20
- from pymodaq.post_treatment.process_to_scalar import DataProcessorFactory
21
-
22
-
23
- logger = set_logger(get_module_name(__file__))
24
-
25
-
26
- data_processors = DataProcessorFactory()
27
-
28
-
29
- class Filter:
30
-
31
- def __init__(self):
32
- self._is_active = False
33
- self._slot_to_send_data = None
34
-
35
- def register_activation_signal(self, activation_signal):
36
- activation_signal.connect(lambda x: self.set_active(x))
37
-
38
- def register_target_slot(self, slot):
39
- self._slot_to_send_data = slot
40
-
41
- @Slot(bool)
42
- def set_active(self, activate=True):
43
- self._is_active = activate
44
-
45
- def filter_data(self, data: data_mod.DataFromPlugins):
46
- if self._is_active:
47
- filtered_data = self._filter_data(data)
48
- if filtered_data is not None and self._slot_to_send_data is not None:
49
- self._slot_to_send_data(filtered_data)
50
-
51
- def _filter_data(self, data: data_mod.DataFromPlugins) -> DataToExport:
52
- raise NotImplementedError
53
-
54
-
55
- class Filter1DFromCrosshair(Filter):
56
- def __init__(self, crosshair: Crosshair):
57
- """
58
- Extract data along a crosshair using coordinates and data displayed in graph_items such as imageItems
59
- Parameters
60
- ----------
61
- crosshair : Crosshair
62
- """
63
- super().__init__()
64
- self.crosshair = crosshair
65
- self._x, self._y = 0., 0.
66
- self._axis: data_mod.Axis = None
67
-
68
- def update_axis(self, axis: data_mod.Axis):
69
- self._axis = axis
70
-
71
- def _filter_data(self, data: data_mod.DataFromPlugins) -> DataToExport:
72
- dte = DataToExport('Crosshair')
73
- if data is not None:
74
- axis = data.get_axis_from_index(0, create=False)[0]
75
- if axis is not None:
76
- self.update_axis(axis)
77
-
78
- self._x, self._y = self.crosshair.get_positions()
79
- dwa = data.isig[data.axes[0].find_indexes([self._x])[0]]
80
- dwa.axes = [Axis('x', data=np.array([self._x]))]
81
- dte.append(dwa)
82
- # for label, dat in zip(data.labels, data.data):
83
- # dte.append(DataFromRoi('crosshair', data=[np.array([dat[ind_x]]) for dat in data.data],
84
- # axes=[Axis(data=np.array([self._axis.get_data()[ind_x]]))],
85
- # labels=data.labels))
86
- return dte
87
-
88
-
89
- class Filter2DFromCrosshair(Filter):
90
- def __init__(self, crosshair: Crosshair, graph_items, image_keys):
91
- """
92
- Extract data along a crosshair using coordinates and data displayed in graph_items such as imageItems
93
- Parameters
94
- ----------
95
- crosshair : (Crosshair)
96
- graph_items : (dict)
97
- image_keys : (list) list of string identifier to link datas to their graph_items. This means that in
98
- _filter_data, datas['data'][key] is plotted on graph_items[key] for key in image_keys
99
- """
100
- super().__init__()
101
- self._graph_items = graph_items
102
- self._image_keys = image_keys
103
- self.crosshair = crosshair
104
- self._x, self._y = 0., 0.
105
-
106
- def set_graph_items(self, graph_items):
107
- self._graph_items = graph_items
108
-
109
- @Slot(bool)
110
- def set_active(self, activate=True):
111
- self._is_active = activate
112
- if activate:
113
- self.crosshair.crosshair_dragged.emit(*self.crosshair.get_positions())
114
-
115
- def _filter_data(self, dwa: data_mod.DataFromPlugins) -> DataToExport:
116
- dte = DataToExport('Crosshair')
117
- if dwa is not None:
118
- self._x, self._y = self.crosshair.get_positions()
119
- data_type = dwa.distribution
120
- if data_type == 'uniform':
121
- dte = self.get_data_from_uniform(dwa)
122
- elif data_type == 'spread':
123
- dte = self.get_data_from_spread(dwa)
124
- return dte
125
-
126
- def get_data_from_uniform(self, dwa: DataWithAxes) -> DataToExport:
127
- indx, indy = self.mapfromview(self._x, self._y, 'red')
128
-
129
- data_H_index = slice(None, None, 1)
130
- data_V_index = slice(None, None, 1)
131
- H_indexes = (utils.rint(indy), data_H_index)
132
- V_indexes = (data_V_index, utils.rint(indx))
133
- dte = DataToExport('Crosshair')
134
- try:
135
- if not (0 <= utils.rint(indy) < dwa.shape[0]):
136
- raise IndexError
137
- dwa_hor = dwa.isig[H_indexes]
138
- dwa_hor.labels = [f'Crosshair/{label}' for label in dwa_hor.labels]
139
- dwa_hor.name = 'hor'
140
- dte.append(dwa_hor)
141
- except IndexError:
142
- pass
143
- try:
144
- if not (0 <= utils.rint(indx) < dwa.shape[1]):
145
- raise IndexError
146
- dwa_ver = dwa.isig[V_indexes]
147
- dwa_ver.labels = [f'Crosshair/{label}' for label in dwa_ver.labels]
148
- dwa_ver.name = 'ver'
149
- dte.append(dwa_ver)
150
- except IndexError:
151
- pass
152
- try:
153
- if not (0 <= utils.rint(indy) < dwa.shape[0]) \
154
- or \
155
- not (0 <= utils.rint(indx) < dwa.shape[1]):
156
- raise IndexError
157
- dwa_int = dwa.isig[utils.rint(indy), utils.rint(indx)]
158
- dwa_int.labels = [f'Crosshair/{label}' for label in dwa_int.labels]
159
- dwa_int.name = 'int'
160
- dte.append(dwa_int)
161
- except IndexError:
162
- pass
163
- return dte
164
-
165
- def get_data_from_spread(self, dwa: DataWithAxes) -> DataToExport:
166
-
167
- data_H_index = slice(None, None, 1)
168
- data_V_index = slice(None, None, 1)
169
- posx, posy = self.mapfromview(self._x, self._y, 'red')
170
-
171
- hor_data = []
172
- ver_data = []
173
- int_data = []
174
- hor_axis = None
175
- ver_axis = None
176
-
177
- for ind, data_key in enumerate(self._graph_items):
178
- if ind < len(dwa):
179
- points, data = self._graph_items[data_key].get_points_at(axis='y', val=posy)
180
- x_sorted_indexes = np.argsort(points[:, 0])
181
- hor_axis = points[x_sorted_indexes, 0][data_H_index]
182
-
183
- hor_data.append(data[x_sorted_indexes][data_H_index])
184
-
185
- points, data = self._graph_items[data_key].get_points_at(axis='x', val=posx)
186
- y_sorted_indexes = np.argsort(points[:, 1])
187
- ver_axis = points[y_sorted_indexes, 1][data_V_index]
188
-
189
- ver_data.append(data[y_sorted_indexes][data_V_index])
190
-
191
- int_data.append(np.array([self._graph_items[data_key].get_val_at((posx, posy))]))
192
-
193
- dte = DataToExport('Crosshair')
194
- if len(hor_data) > 0 and len(hor_axis) > 0:
195
- dte.append(DataFromRoi('hor', data=hor_data,
196
- axes=[Axis(dwa.axes[1].label, dwa.axes[1].units, data=hor_axis)]),)
197
- if len(ver_data) > 0 and len(ver_axis) > 0:
198
- dte.append(DataFromRoi('ver', data=ver_data,
199
- axes=[Axis(dwa.axes[0].label, dwa.axes[0].units, data=ver_axis)]))
200
- if len(int_data) > 0:
201
- dte.append(DataFromRoi('int', data=int_data))
202
-
203
- return dte
204
-
205
- def mapfromview(self, x, y, item_key='red'):
206
- """
207
- get item coordinates from view coordinates
208
- Parameters
209
- ----------
210
- x: (float) x coordinate in the view reference frame
211
- y: (float) y coordinate in the view refernece frame
212
-
213
- Returns
214
- -------
215
- x: (float) coordinate in the item reference frame
216
- y: (float) coordinate in the item reference frame
217
- """
218
- point = self._graph_items[item_key].mapFromView(QPointF(x, y))
219
- return point.x(), point.y()
220
-
221
-
222
- class Filter1DFromRois(Filter):
223
- """
224
-
225
- Parameters
226
- ----------
227
- roi_manager:ROIManager
228
- graph_item: PlotItems
229
- """
230
- def __init__(self, roi_manager: ROIManager):
231
-
232
- super().__init__()
233
- self._roi_settings = roi_manager.settings
234
- self._ROIs = roi_manager.ROIs
235
- self._axis: data_mod.Axis = None
236
-
237
- def update_axis(self, axis: data_mod.Axis):
238
- self._axis = axis
239
-
240
- def _filter_data(self, data: data_mod.DataFromPlugins) -> DataToExport:
241
- dte = DataToExport('roi1D')
242
- try:
243
- axis = data.get_axis_from_index(0, create=False)[0]
244
- if axis is not None:
245
- self.update_axis(axis)
246
- if data is not None:
247
- for roi_key, roi in self._ROIs.items():
248
- if self._roi_settings['ROIs', roi_key, 'use_channel'] == 'All':
249
- data_index = list(range(len(data.labels)))
250
- else:
251
- try:
252
- data_index = [data.labels.index(self._roi_settings['ROIs', roi_key,
253
- 'use_channel'])]
254
- except ValueError:
255
- data_index = [0]
256
- dte_tmp = self.get_data_from_roi(roi, self._roi_settings.child('ROIs', roi_key),
257
- data)
258
- if self._roi_settings['ROIs', roi_key, 'use_channel'] == 'All':
259
- dte.append(dte_tmp.data)
260
- else:
261
- for index in data_index:
262
- for dwa in dte_tmp.data:
263
- dte.append(dwa.pop(index))
264
-
265
- except Exception as e:
266
- pass
267
- finally:
268
- return dte
269
-
270
- def get_data_from_roi(self, roi: LinearROI, roi_param: Parameter, data: data_mod.DataWithAxes) -> DataToExport:
271
- if data is not None:
272
- dte = DataToExport('ROI1D')
273
- _slice = self.get_slice_from_roi(roi, data)
274
- sub_data: DataFromRoi = data.isig[_slice]
275
- sub_data.name = 'HorData'
276
- sub_data.origin = roi_param.name()
277
- sub_data.labels = [f'{roi_param.name()}/{label}' for label in sub_data.labels]
278
- dte.append(sub_data)
279
- if sub_data.size != 0:
280
- processed_data = data_processors.get(roi_param['math_function']).process(sub_data)
281
- else:
282
- processed_data = None
283
- if processed_data is not None:
284
- processed_data.name = 'IntData'
285
- dte.append(processed_data)
286
- return dte
287
-
288
- def get_slice_from_roi(self, roi: RectROI, data: data_mod.DataWithAxes) -> slice:
289
- ind_x_min, ind_x_max = data.get_axis_from_index(data.sig_indexes[0])[0].find_indexes(roi.getRegion())
290
- size = data.get_axis_from_index(0)[0].size
291
- ind_x_min = int(min(max(ind_x_min, 0), size))
292
- ind_x_max = int(max(0, min(ind_x_max, size)))
293
- return slice(ind_x_min, ind_x_max)
294
-
295
-
296
- class Filter2DFromRois(Filter):
297
- """Filters 2D data using 2D ROIs
298
-
299
- Parameters
300
- ----------
301
- roi_manager: ROIManager
302
- graph_item: UniformImageItem or SpreadImageItem
303
- The graphical item where data and ROIs are plotted
304
- image_keys : (list) list of string identifier to link datas to their graph_items. This means that in
305
- _filter_data, datas.data[key] is plotted on graph_items[key] for key in image_keys
306
- """
307
- def __init__(self, roi_manager: ROIManager, graph_item: UniformImageItem, image_keys):
308
-
309
- super().__init__()
310
- self._roi_settings = roi_manager.settings
311
- self._image_keys = image_keys
312
- self._graph_item = graph_item
313
- self.axes = (0, 1)
314
- self._ROIs = roi_manager.ROIs
315
-
316
- def _filter_data(self, dwa: data_mod.DataFromPlugins) -> DataToExport:
317
- dte = DataToExport('ROI')
318
- if dwa is not None:
319
- try:
320
- labels = []
321
- for roi_key, roi in self._ROIs.items():
322
- label = self._roi_settings['ROIs', roi_key, 'use_channel']
323
- if label is not None:
324
- if label != 'All':
325
- sub_data = dwa.deepcopy()
326
- sub_data.data = [dwa[dwa.labels.index(label)]]
327
- sub_data.labels = [label]
328
- else:
329
- sub_data = dwa
330
- dte_temp = self.get_xydata_from_roi(roi, sub_data,
331
- self._roi_settings['ROIs',
332
- roi_key, 'math_function'])
333
-
334
- dte.append(dte_temp)
335
- except Exception as e:
336
- logger.warning(f'Issue with the ROI: {str(e)}')
337
- return dte
338
-
339
- def get_slices_from_roi(self, roi: RectROI, data_shape: tuple) -> Tuple[slice, slice]:
340
- x, y = roi.pos().x(), roi.pos().y()
341
- width, height = roi.size().x(), roi.size().y()
342
- size_y, size_x = data_shape
343
- ind_x_min = int(min(max(x, 0), size_x))
344
- ind_y_min = int(min(max(y, 0), size_y))
345
- ind_x_max = int(max(0, min(x+width, size_x)))
346
- ind_y_max = int(max(0, min(y+height, size_y)))
347
- return slice(ind_y_min,ind_y_max), slice(ind_x_min, ind_x_max)
348
-
349
- def get_xydata_from_roi(self, roi: RectROI, dwa: DataWithAxes, math_function: str) -> DataToExport:
350
- dte = DataToExport(roi.name)
351
- if dwa is not None:
352
- labels = [f'{roi.name}/{label}' for label in dwa.labels]
353
- if dwa.distribution.name == 'spread':
354
- xvals, yvals, data = self.get_xydata_spread(dwa, roi)
355
- if len(data) == 0:
356
- return dte
357
- ind_xaxis = np.argsort(xvals)
358
- ind_yaxis = np.argsort(yvals)
359
- xvals = xvals[ind_xaxis]
360
- yvals = yvals[ind_yaxis]
361
- data_H = data[ind_xaxis]
362
- data_V = data[ind_yaxis]
363
- int_data = np.array([np.mean(data)])
364
-
365
- _x_axis = dwa.get_axis_from_index_spread(0, 0)
366
- x_axis = Axis(_x_axis.label, _x_axis.units, data=xvals, index=0, spread_order=0)
367
- _y_axis = dwa.get_axis_from_index_spread(0, 1)
368
- y_axis = Axis(_y_axis.label, _y_axis.units, data=yvals, index=0, spread_order=0)
369
- sub_data_hor = DataFromRoi('hor', distribution='spread', data=[data_H], axes=[x_axis],)
370
- sub_data_ver = DataFromRoi('ver', distribution='spread', data=[data_V], axes=[y_axis])
371
- math_data = DataFromRoi('int', data=int_data)
372
- else:
373
- slices = self.get_slices_from_roi(roi, dwa.shape)
374
- sub_data: DataFromRoi = dwa.isig[slices[0], slices[1]]
375
- sub_data_hor = sub_data.mean(0)
376
- sub_data_ver = sub_data.mean(1)
377
- math_data = data_processors.get(math_function).process(sub_data)
378
-
379
- sub_data_hor.name = 'hor'
380
- sub_data_hor.origin = roi.name
381
- sub_data_hor.labels = labels
382
- sub_data_ver.name = 'ver'
383
- sub_data_ver.origin = roi.name
384
- sub_data_ver.labels = labels
385
- math_data.name = 'int'
386
- math_data.origin = roi.name
387
- math_data.labels = labels
388
-
389
- dte.append([sub_data_hor, sub_data_ver, math_data])
390
- return dte
391
-
392
- #TODO possibly not used anymore to be deleted
393
- #
394
- # def get_xydata(self, data: np.ndarray, roi: RectROI):
395
- # data, coords = self.data_from_roi(data, roi)
396
- #
397
- # if data is not None:
398
- # xvals = np.linspace(np.min(np.min(coords[1, :, :])), np.max(np.max(coords[1, :, :])),
399
- # data.shape[1])
400
- # yvals = np.linspace(np.min(np.min(coords[0, :, :])), np.max(np.max(coords[0, :, :])),
401
- # data.shape[0])
402
- # else:
403
- # xvals = yvals = data = np.array([])
404
- # return xvals, yvals, data
405
- #
406
- # def data_from_roi(self, data, roi):
407
- # data, coords = roi.getArrayRegion(data, self._graph_item, self.axes, returnMappedCoords=True)
408
- # return data, coords
409
-
410
- def get_xydata_spread(self, data, roi):
411
- xvals = []
412
- yvals = []
413
- data_out = []
414
- for ind in range(data.shape[0]):
415
- # invoke the QPainterpath of the ROI (from the shape method)
416
- if roi.shape().contains(QPointF(data.get_axis_from_index(0)[0].get_data()[ind] - roi.pos().x(),
417
- data.get_axis_from_index(0)[1].get_data()[ind] - roi.pos().y())):
418
- xvals.append(data.get_axis_from_index(0)[0].get_data()[ind])
419
- yvals.append(data.get_axis_from_index(0)[1].get_data()[ind])
420
- data_out.append(data[0][ind])
421
- data_out = np.array(data_out)
422
- xvals = np.array(xvals)
423
- yvals = np.array(yvals)
424
- return xvals, yvals, data_out
425
-
426
-
427
- class FourierFilterer(QObject):
428
- filter_changed = Signal(dict)
429
-
430
- def __init__(self, parent=None):
431
- super().__init__()
432
- if parent is None:
433
- parent = QtWidgets.QWidget()
434
-
435
- self.parent = parent
436
-
437
- self.raw_data = None
438
- self.data = None
439
- self.data_fft = None
440
- self.filter = None
441
- self.xaxis = None
442
- self.yaxis = None
443
- self.xaxisft = None
444
- self.yaxisft = None
445
-
446
- self.frequency = 0
447
- self.phase = 0
448
-
449
- self.c = None
450
- self.viewer2D = None
451
- self.setUI()
452
-
453
- def setUI(self):
454
- self.vlayout = QtWidgets.QVBoxLayout()
455
- self.parent.setLayout(self.vlayout)
456
-
457
- form = QtWidgets.QWidget()
458
- self.viewer1D = Viewer1DBasic(form)
459
- self.vlayout.addWidget(form)
460
- self.fftbutton1D = QtWidgets.QPushButton()
461
- self.fftbutton1D.setText("")
462
- icon = QtGui.QIcon()
463
- icon.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/FFT.png"), QtGui.QIcon.Normal,
464
- QtGui.QIcon.Off)
465
- self.fftbutton1D.setIcon(icon)
466
- self.fftbutton1D.setCheckable(True)
467
- self.fftbutton1D.clicked.connect(self.update_plot)
468
-
469
- vbox = self.viewer1D.parent.layout()
470
- widg = QtWidgets.QWidget()
471
- hbox = QtWidgets.QHBoxLayout()
472
- widg.setLayout(hbox)
473
- vbox.insertWidget(0, widg)
474
- hbox.addWidget(self.fftbutton1D)
475
- hbox.addStretch()
476
-
477
- self.viewer1D.ROI = LinearRegionItem(values=[0, 100])
478
- self.viewer1D.plotwidget.plotItem.addItem(self.viewer1D.ROI)
479
- self.data_filtered_plot = self.viewer1D.plotwidget.plotItem.plot()
480
- self.data_filtered_plot.setPen('w')
481
- self.viewer1D.ROI.sigRegionChangeFinished.connect(self.set_data)
482
-
483
- self.viewer1D.ROIfft = LinearRegionItem()
484
- self.viewer1D.plotwidget.plotItem.addItem(self.viewer1D.ROIfft)
485
- self.viewer1D.ROIfft.sigRegionChangeFinished.connect(self.update_filter)
486
-
487
- self.parent.show()
488
-
489
- def calculate_fft(self):
490
-
491
- ftaxis, axis = mutils.ftAxis_time(len(self.xaxis), np.max(self.xaxis) - np.min(self.xaxis))
492
- self.xaxisft = ftaxis / (2 * np.pi)
493
- self.data_fft = mutils.ft(self.data)
494
-
495
- def show_data(self, data):
496
- """
497
- show data and fft
498
- Parameters
499
- ----------
500
- data: (dict) with keys 'data', optionally 'xaxis' and 'yaxis'
501
- """
502
- try:
503
- self.raw_data = data
504
-
505
- if 'xaxis' in data:
506
- self.xaxis = data['xaxis']
507
- else:
508
- self.xaxis = np.arange(0, data['data'].shape[0], 1)
509
- self.raw_data['xaxis'] = self.xaxis
510
- # self.viewer1D.ROI.setRegion((np.min(self.xaxis), np.max(self.xaxis)))
511
- self.set_data()
512
- except Exception as e:
513
- logger.exception(str(e))
514
-
515
- def set_data(self):
516
- xlimits = self.viewer1D.ROI.getRegion()
517
- indexes = mutils.find_index(self.raw_data['xaxis'], xlimits)
518
- self.data = self.raw_data['data'][indexes[0][0]:indexes[1][0]]
519
- self.xaxis = self.raw_data['xaxis'][indexes[0][0]:indexes[1][0]]
520
- try:
521
- self.calculate_fft()
522
- except Exception as e:
523
- logger.exception(str(e))
524
- self.viewer1D.x_axis = self.xaxis
525
- self.update_plot()
526
-
527
- def update_filter(self):
528
- try:
529
- xmin, xmax = self.viewer1D.ROIfft.getRegion()
530
- self.filter = mutils.gauss1D(self.xaxisft, np.mean([xmin, xmax]), xmax - xmin)
531
- self.data = np.real(mutils.ift(self.filter * self.data_fft))
532
- index = np.argmax(self.filter * self.data_fft)
533
- self.frequency = self.xaxisft[index]
534
- self.phase = np.angle(self.data_fft[index])
535
-
536
- self.filter_changed.emit(dict(frequency=self.frequency, phase=self.phase))
537
- self.update_plot()
538
- except Exception as e:
539
- logger.exception(str(e))
540
-
541
- def update_plot(self):
542
-
543
- if self.fftbutton1D.isChecked():
544
- if self.data_fft is not None:
545
- if self.filter is not None:
546
- self.viewer1D.show_data([np.abs(self.data_fft), np.max(np.abs(self.data_fft)) * self.filter])
547
- else:
548
- self.viewer1D.show_data([np.abs(self.data_fft)])
549
- self.viewer1D.x_axis = dict(data=self.xaxisft, label='freq.')
550
- self.viewer1D.ROIfft.setVisible(True)
551
- self.viewer1D.ROI.setVisible(False)
552
- self.data_filtered_plot.setVisible(False)
553
- else:
554
- if self.raw_data is not None:
555
- self.viewer1D.show_data([self.raw_data['data']])
556
- self.viewer1D.x_axis = dict(data=self.raw_data['xaxis'], label='Pxls')
557
- self.data_filtered_plot.setData(self.xaxis, self.data)
558
- self.data_filtered_plot.setVisible(True)
559
- self.viewer1D.ROIfft.setVisible(False)
560
- self.viewer1D.ROI.setVisible(True)
561
-
562
-
563
- if __name__ == '__main__':
564
- import sys
565
-
566
- app = QtWidgets.QApplication(sys.argv)
567
- prog = FourierFilterer()
568
-
569
- from pymodaq.utils.daq_utils import gauss1D
570
-
571
- xdata = np.linspace(0, 400, 401)
572
- x0 = 50
573
- dx = 20
574
- tau = 27
575
- tau2 = 100
576
- ydata_gauss = 10 * gauss1D(xdata, x0, dx) + np.random.rand(len(xdata))
577
- ydata_expodec = np.zeros((len(xdata)))
578
- ydata_expodec[:50] = 10 * gauss1D(xdata[:50], x0, dx, 2)
579
- ydata_expodec[50:] = 10 * np.exp(-(xdata[50:] - x0) / tau) # +10*np.exp(-(xdata[50:]-x0)/tau2)
580
- ydata_expodec += 2 * np.random.rand(len(xdata))
581
- ydata_sin = 10 + 2 * np.sin(2 * np.pi * 0.1 * xdata - np.deg2rad(55)) + np.sin(
582
- 2 * np.pi * 0.008 * xdata - np.deg2rad(-10)) + 2 * np.random.rand(len(xdata))
583
-
584
- prog.show_data(dict(data=ydata_sin, xaxis=xdata))
585
- sys.exit(app.exec_())