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,800 +0,0 @@
1
- from abc import ABCMeta, abstractmethod, abstractproperty
2
- import sys
3
- from typing import List, Tuple, Union
4
-
5
- import numpy as np
6
-
7
- try:
8
- from scipy.spatial import QhullError # works for newer version of scipy
9
- from scipy.spatial import Delaunay as Triangulation
10
- except ImportError:
11
- from scipy.spatial.qhull import QhullError # works for old version of scipy
12
- from scipy.spatial.qhull import Delaunay as Triangulation
13
-
14
- from qtpy import QtWidgets
15
- from qtpy.QtCore import QObject, Slot, Signal, QRectF, QPointF
16
-
17
- from pymodaq.utils.logger import set_logger, get_module_name
18
- from pymodaq.utils.gui_utils.dock import DockArea, Dock
19
- from pymodaq.utils.plotting.data_viewers.viewer1D import Viewer1D
20
- from pymodaq.utils.plotting.utils.axes_viewer import AxesViewer
21
- from pymodaq.utils.plotting.data_viewers.viewer2D import Viewer2D
22
- from pymodaq.utils.plotting.data_viewers.viewer0D import Viewer0D
23
- import pymodaq.utils.daq_utils as utils
24
- import pymodaq.utils.math_utils as mutils
25
- from pymodaq.utils.data import DataRaw, Axis, DataDistribution, DataWithAxes, DataDim, DataCalculated
26
-
27
- from pymodaq.utils.plotting.data_viewers.viewer import ViewerBase
28
- from pymodaq.utils.managers.action_manager import ActionManager
29
- from pymodaq.utils.managers.parameter_manager import ParameterManager
30
- from pymodaq.post_treatment.process_to_scalar import DataProcessorFactory
31
- from pymodaq.utils.managers.roi_manager import SimpleRectROI, LinearROI
32
-
33
-
34
- logger = set_logger(get_module_name(__file__))
35
- data_processors = DataProcessorFactory()
36
-
37
- DEBUG_VIEWER = False
38
-
39
-
40
- class BaseDataDisplayer(QObject):
41
- data_dim_signal = Signal(str)
42
- processor_changed = Signal(object)
43
- distribution: DataDistribution = abstractproperty()
44
-
45
- def __init__(self, viewer0D: Viewer0D, viewer1D: Viewer1D, viewer2D: Viewer2D, navigator1D: Viewer1D,
46
- navigator2D: Viewer2D, axes_viewer: AxesViewer):
47
- super().__init__()
48
- self._viewer0D = viewer0D
49
- self._viewer1D = viewer1D
50
- self._viewer2D = viewer2D
51
- self._navigator1D = navigator1D
52
- self._navigator2D = navigator2D
53
- self._axes_viewer = axes_viewer
54
-
55
- self._data: DataWithAxes = None
56
- self._nav_limits: tuple = (0, 10, None, None)
57
- self._signal_at: tuple = (0, 0)
58
-
59
- self._filter_type: str = None
60
- self._processor = None
61
-
62
- self._show_nav_integration = False
63
-
64
- @property
65
- def data_shape(self):
66
- return self._data.shape if self._data is not None else None
67
-
68
- def update_filter(self, filter_type: str):
69
- if filter_type in self._processor.functions:
70
- self._filter_type = filter_type
71
- self.update_nav_data(*self._nav_limits)
72
-
73
- def update_processor(self, math_processor: DataProcessorFactory):
74
- self._processor = math_processor
75
- self.processor_changed.emit(math_processor)
76
-
77
- def update_data(self, data: DataRaw, force_update=False):
78
- if self._data is None or self._data.shape != data.shape or force_update:
79
- self._data = data
80
- self.init(data)
81
- else:
82
- self._data.data = data.data[0]
83
-
84
- self.data_dim_signal.emit(self._data.get_data_dimension())
85
-
86
- self.update_viewer_data(*self._signal_at)
87
- self.update_nav_data(*self._nav_limits)
88
-
89
- def show_nav_integration(self, show=True):
90
- self._show_nav_integration = show
91
- self.update_viewer_data(*self._signal_at)
92
-
93
- @abstractmethod
94
- def init_rois(self, data: DataRaw):
95
- """Init crosshairs and ROIs in viewers if needed"""
96
- ...
97
-
98
- @abstractmethod
99
- def init(self):
100
- """init viewers or postprocessing once new data are loaded"""
101
- ...
102
-
103
- @abstractmethod
104
- def update_viewer_data(self, **kwargs):
105
- """ Update the signal display depending on the position of the crosshair in the navigation panels
106
-
107
- """
108
- ...
109
-
110
- def updated_nav_integration(self):
111
- """ Means the ROI select of the 2D viewer has been moved """
112
- ...
113
-
114
- @abstractmethod
115
- def update_nav_data(self, x, y, width=None, height=None):
116
- """Display navigator data potentially postprocessed from filters in the signal viewers"""
117
- ...
118
-
119
- @abstractmethod
120
- def get_nav_data(self, data: DataWithAxes, x, y, width=None, height=None) -> DataWithAxes:
121
- """Get filtered data"""
122
- ...
123
-
124
- def update_nav_data_from_roi(self, roi: Union[SimpleRectROI, LinearROI]):
125
- if isinstance(roi, LinearROI):
126
- x, y = roi.getRegion()
127
- self._nav_limits = (x, y, None, None)
128
- elif isinstance(roi, SimpleRectROI):
129
- x, y = roi.pos().x(), roi.pos().y()
130
- width, height = roi.size().x(), roi.size().y()
131
- self._nav_limits = (int(x), int(y), int(width), int(height))
132
- self.update_nav_data(*self._nav_limits)
133
-
134
- @staticmethod
135
- def get_out_of_range_limits(x, y, width, height):
136
- if x < 0:
137
- width = width + x
138
- x = 0
139
- if y < 0:
140
- height = height + y
141
- y = 0
142
- return x, y, width, height
143
-
144
- def update_nav_indexes(self, nav_indexes: List[int]):
145
- self._data.nav_indexes = nav_indexes
146
- self.update_data(self._data, force_update=True)
147
-
148
- def update_nav_limits(self, x, y, width=None, height=None):
149
- self._nav_limits = x, y, width, height
150
-
151
-
152
- class UniformDataDisplayer(BaseDataDisplayer):
153
- """Specialized object to filter and plot linearly spaced data in dedicated viewers
154
-
155
- Meant for any navigation axes and up to signal data dimensionality of 2 (images)
156
- """
157
- distribution = DataDistribution['uniform']
158
-
159
- def __init__(self, *args, **kwargs):
160
- super().__init__(*args, **kwargs)
161
-
162
- def init(self, data: DataRaw):
163
- if len(data.nav_indexes) > 2:
164
- self._axes_viewer.set_nav_viewers(self._data.get_nav_axes_with_data())
165
- processor: DataProcessorFactory = data_processors
166
- self.update_processor(processor)
167
-
168
- def init_rois(self, nav_axes_limits: List[Tuple[float, float]] = None,
169
- sig_axis_limits: List[Tuple[float, float]] = None):
170
-
171
- if len(nav_axes_limits) == 1:
172
- self._navigator1D.crosshair.set_crosshair_position(np.mean(nav_axes_limits[0]))
173
-
174
- if len(nav_axes_limits) == 2:
175
- self._navigator2D.crosshair.set_crosshair_position(
176
- *self._navigator2D.view.unscale_axis(np.mean(nav_axes_limits[1]),
177
- np.mean(nav_axes_limits[0]))
178
- )
179
- if len(sig_axis_limits) == 1:
180
- self._viewer1D.roi.setPos((float(np.mean(sig_axis_limits[0]) -
181
- np.abs(np.diff(sig_axis_limits[0]))[0] / 3),
182
- float(np.mean(sig_axis_limits[0]) +
183
- np.abs(np.diff(sig_axis_limits[0]))[0] / 3))
184
- )
185
- if len(sig_axis_limits) == 2:
186
- scaled_axes = np.array(self._viewer2D.view.unscale_axis(np.array(sig_axis_limits[1]),
187
- np.array(sig_axis_limits[0])))
188
-
189
- self._viewer2D.roi.setSize(
190
- float(np.diff(scaled_axes[0])[0]) / 3,
191
- float(np.diff(scaled_axes[1])[0]) / 3)
192
-
193
- self._viewer2D.roi.setPos(
194
- float(np.mean(scaled_axes[0])) - float(np.diff(scaled_axes[0])[0]) / 6,
195
- float(np.mean(scaled_axes[1])) - float(np.diff(scaled_axes[1])[0]) / 6)
196
-
197
- def updated_nav_integration(self):
198
- """ Means the ROI select of the 2D viewer has been moved """
199
- self.update_viewer_data(*self._signal_at)
200
-
201
- def update_viewer_data(self, posx=0, posy=0):
202
- """ Update the signal display depending on the position of the crosshair in the navigation panels
203
-
204
- Parameters
205
- ----------
206
- posx: float
207
- from the 1D or 2D Navigator crosshair or from one of the navigation axis viewer (in that case
208
- nav_axis tells from which navigation axis the position comes from)
209
- posy: float
210
- from the 2D Navigator crosshair
211
- """
212
- self._signal_at = posx, posy
213
- if self._data is not None:
214
- try:
215
- if len(self._data.nav_indexes) == 0:
216
- data = self._data
217
-
218
- elif len(self._data.nav_indexes) == 1:
219
- nav_axis = self._data.axes_manager.get_nav_axes()[0]
220
- if posx < nav_axis.min() or posx > nav_axis.max():
221
- return
222
- ind_x = nav_axis.find_index(posx)
223
- logger.debug(f'Getting the data at nav index {ind_x}')
224
- data: DataCalculated = self._data.inav[ind_x]
225
- if self._show_nav_integration:
226
- if self._navigator1D.view.is_action_checked('ROIselect'):
227
- x0, x1 = self._navigator1D.view.ROIselect.getRegion()
228
- ind_x0 = max(0, int(nav_axis.find_index(x0)))
229
- ind_x1 = min(int(nav_axis.max()), int(nav_axis.find_index(x1)))
230
- data.append(self._data.inav[ind_x0:ind_x1].mean(axis=(nav_axis.index)))
231
- else:
232
- data.append(self._data.mean(axis=nav_axis.index))
233
-
234
- elif len(self._data.nav_indexes) == 2:
235
- nav_x = self._data.axes_manager.get_nav_axes()[1]
236
- nav_y = self._data.axes_manager.get_nav_axes()[0]
237
- if posx < nav_x.min() or posx > nav_x.max():
238
- return
239
- if posy < nav_y.min() or posy > nav_y.max():
240
- return
241
- ind_x = nav_x.find_index(posx)
242
- ind_y = nav_y.find_index(posy)
243
- logger.debug(f'Getting the data at nav indexes {ind_y} and {ind_x}')
244
- data = self._data.inav[ind_y, ind_x]
245
- if self._show_nav_integration:
246
- if self._navigator2D.view.is_action_checked('ROIselect'):
247
- ind_x0 = max(0, int(self._navigator2D.view.ROIselect.x()))
248
- ind_y0 = max(0, int(self._navigator2D.view.ROIselect.y()))
249
- ind_x1 = min(int(nav_x.max()), ind_x0 + int(self._navigator2D.view.ROIselect.size().x()))
250
- ind_y1 = min(int(nav_y.max()), ind_y0 + int(self._navigator2D.view.ROIselect.size().y()))
251
- data.append(self._data.inav[ind_y0:ind_y1, ind_x0:ind_x1].mean(axis=(nav_x.index, nav_y.index)))
252
- else:
253
- data.append(self._data.mean(axis=(nav_x.index, nav_y.index)))
254
- else:
255
- data = self._data.inav.__getitem__(self._axes_viewer.get_indexes())
256
-
257
- if len(self._data.axes_manager.sig_shape) == 0: # means 0D data, plot on 0D viewer
258
- self._viewer0D.show_data(data)
259
-
260
- elif len(self._data.axes_manager.sig_shape) == 1: # means 1D data, plot on 1D viewer
261
- self._viewer1D.show_data(data)
262
-
263
- elif len(self._data.axes_manager.sig_shape) == 2: # means 2D data, plot on 2D viewer
264
- self._viewer2D.show_data(data)
265
- if DEBUG_VIEWER:
266
- x, y, width, height = self.get_out_of_range_limits(*self._nav_limits)
267
- _data_sig = data.isig[y: y + height, x: x + width]
268
- self._debug_viewer_2D.show_data(_data_sig)
269
-
270
- except Exception as e:
271
- logger.exception(str(e))
272
-
273
- def update_nav_data(self, x, y, width=None, height=None):
274
- if self._data is not None and self._filter_type is not None and len(self._data.nav_indexes) != 0:
275
- nav_data = self.get_nav_data(self._data, x, y, width, height)
276
- if nav_data is not None:
277
- nav_data.nav_indexes = () # transform nav axes in sig axes for plotting
278
- if len(nav_data.shape) < 2:
279
- self._navigator1D.show_data(nav_data)
280
- elif len(nav_data.shape) == 2:
281
- self._navigator2D.show_data(nav_data)
282
- else:
283
- self._axes_viewer.set_nav_viewers(self._data.get_nav_axes_with_data())
284
-
285
- def get_nav_data(self, data: DataRaw, x, y, width=None, height=None):
286
- try:
287
- navigator_data = None
288
- if len(data.axes_manager.sig_shape) == 0: # signal data is 0D
289
- navigator_data = data.deepcopy()
290
-
291
- elif len(data.axes_manager.sig_shape) == 1: # signal data is 1D
292
- indx, indy = data.get_axis_from_index(data.sig_indexes[0])[0].find_indexes((x, y))
293
- navigator_data = self._processor.get(self._filter_type).process(data.isig[indx:indy])
294
-
295
- elif len(data.axes_manager.sig_shape) == 2: # signal data is 2D
296
- x, y, width, height = self.get_out_of_range_limits(x, y, width, height)
297
- if not (width is None or height is None or width < 2 or height < 2):
298
- navigator_data = self._processor.get(self._filter_type).process(data.isig[y: y + height, x: x + width])
299
- else:
300
- navigator_data = None
301
- else:
302
- navigator_data = None
303
-
304
- return navigator_data
305
-
306
- except Exception as e:
307
- logger.warning('Could not compute the mathematical function')
308
- finally:
309
- return navigator_data
310
-
311
-
312
- class SpreadDataDisplayer(BaseDataDisplayer):
313
- """Specialized object to filter and plot non uniformly spaced data in dedicated viewers
314
-
315
- Meant for any navigation axes and up to signal data dimensionality of 2 (images)
316
- """
317
- distribution = DataDistribution['spread']
318
-
319
- def __init__(self, *args, **kwargs):
320
- super().__init__(*args, **kwargs)
321
-
322
- self.triangulation = True
323
-
324
- def init(self, data: DataWithAxes):
325
- processor = data_processors # if len(data.axes_manager.sig_shape) > 1 else math_processors1D
326
- self.update_processor(processor)
327
-
328
- def init_rois(self, nav_axes_limits: List[Tuple[float, float]] = None,
329
- sig_axis_limits: List[Tuple[float, float]] = None):
330
- pass
331
-
332
- def update_viewer_data(self, posx=0, posy=0):
333
- """ Update the signal display depending on the position of the crosshair in the navigation panels
334
-
335
- Spread data can be customly represented using:
336
- if signal data is 0D:
337
- * A viewer 1D with non-linearly spaced data points (for 1 navigation axis)
338
- * A viewer 2D with its SpreadImage item (for 2 navigation axis)
339
- * A double panel: viewer for signal data and viewer 1D for all nav axes as a function of index in the data
340
- otherwise:
341
- * A double panel: viewer for signal data and viewer 1D for all nav axes as a function of index in the data
342
- series
343
-
344
- Parameters
345
- ----------
346
- posx: float
347
- from the 1D or 2D Navigator crosshair or from one of the navigation axis viewer (in that case
348
- nav_axis tells from which navigation axis the position comes from)
349
- posy: float
350
- from the 2D Navigator crosshair
351
- """
352
- self._signal_at = posx, posy
353
-
354
- if self._data is not None:
355
- try:
356
- nav_axes = sorted(self._data.get_nav_axes_with_data(), key=lambda axis: axis.spread_order)
357
-
358
- if len(nav_axes) == 1:
359
- # signal data plotted as a function of nav_axes[0] so get the index corresponding to
360
- # the position posx
361
- ind_nav = nav_axes[0].find_index(posx)
362
- data = self._data.inav[ind_nav]
363
-
364
- elif len(nav_axes) == 2 and self.triangulation:
365
- # signal data plotted as a function of nav_axes[0] and nav_axes[1] so get the common
366
- # index corresponding to the position posx and posy
367
- ind_nav, x0, y0 = mutils.find_common_index(nav_axes[0].data, nav_axes[1].data, posx, posy)
368
- data = self._data.inav[ind_nav]
369
- else:
370
- # navigation plotted as a function of index all nav_axes so get the index corresponding to
371
- # the position posx
372
- data = self._data.inav[int(posx)]
373
-
374
- if len(self._data.axes_manager.sig_shape) == 0: # means 0D data, plot on 0D viewer
375
- self._viewer0D.show_data(data)
376
-
377
- elif len(self._data.axes_manager.sig_shape) == 1: # means 1D data, plot on 1D viewer
378
- self._viewer1D.show_data(data)
379
-
380
- elif len(self._data.axes_manager.sig_shape) == 2: # means 2D data, plot on 2D viewer
381
- self._viewer2D.show_data(data)
382
- if DEBUG_VIEWER:
383
- x, y, width, height = self.get_out_of_range_limits(*self._nav_limits)
384
- _data_sig = data.isig[y: y + height, x: x + width]
385
- self._debug_viewer_2D.show_data(_data_sig)
386
-
387
- except Exception as e:
388
- logger.exception(str(e))
389
-
390
- def update_nav_data(self, x, y, width=None, height=None):
391
- if self._data is not None and self._filter_type is not None and len(self._data.nav_indexes) != 0:
392
- nav_data = self.get_nav_data(self._data, x, y, width, height)
393
- if nav_data is not None:
394
- nav_axes = nav_data.get_nav_axes_with_data()
395
- if len(nav_axes) < 2:
396
- #nav_data.nav_indexes = ()
397
- self._navigator1D.show_data(nav_data)
398
- elif len(nav_axes) == 2:
399
- try:
400
- Triangulation(np.array([axis.get_data() for axis in nav_data.get_nav_axes()]))
401
- self._navigator2D.show_data(nav_data)
402
- except QhullError as e:
403
- self.triangulation = False
404
- self._navigator2D.setVisible(False)
405
- self._navigator1D.setVisible(True)
406
- data_arrays = [axis.get_data() for axis in nav_axes]
407
- labels = [axis.label for axis in nav_axes]
408
- nav_data = DataCalculated('nav', data=data_arrays, labels=labels)
409
- self._navigator1D.show_data(nav_data)
410
- else:
411
- data_arrays = [axis.get_data() for axis in nav_axes]
412
- labels = [axis.label for axis in nav_axes]
413
- nav_data = DataCalculated('nav', data=data_arrays, labels=labels)
414
- self._navigator1D.show_data(nav_data)
415
-
416
- def get_nav_data(self, data: DataRaw, x, y, width=None, height=None):
417
- try:
418
- navigator_data = None
419
- if len(data.axes_manager.sig_shape) == 0: # signal data is 0D
420
- navigator_data = data
421
-
422
- elif len(data.axes_manager.sig_shape) == 1: # signal data is 1D
423
- ind_x = data.get_axis_from_index(data.sig_indexes[0])[0].find_index(x)
424
- ind_y = data.get_axis_from_index(data.sig_indexes[0])[0].find_index(y)
425
- navigator_data = self._processor.get(self._filter_type).process(data.isig[ind_x:ind_y])
426
-
427
- elif len(data.axes_manager.sig_shape) == 2: # signal data is 2D
428
- x, y, width, height = self.get_out_of_range_limits(x, y, width, height)
429
- if not (width is None or height is None or width < 2 or height < 2):
430
- navigator_data = self._processor.get(self._filter_type).process(data.isig[y: y + height, x: x + width])
431
- else:
432
- navigator_data = None
433
- else:
434
- navigator_data = None
435
-
436
- return navigator_data
437
-
438
- except Exception as e:
439
- logger.warning('Could not compute the mathematical function')
440
- finally:
441
- return navigator_data
442
-
443
- def get_nav_position(self, posx=0, posy=None):
444
- """
445
- crosshair position from the "spread" data viewer. Should return scan index where the scan was closest to posx,
446
- posy coordinates
447
- Parameters
448
- ----------
449
- posx
450
- posy
451
-
452
- See Also
453
- --------
454
- update_viewer_data
455
- """
456
- # todo adapt to new layout
457
-
458
- nav_axes = self.get_selected_axes()
459
- if len(nav_axes) != 0:
460
- if 'datas' in nav_axes[0]:
461
- datas = nav_axes[0]['datas']
462
- xaxis = datas[0]
463
- if len(datas) > 1:
464
- yaxis = datas[1]
465
- ind_scan = utils.find_common_index(xaxis, yaxis, posx, posy)
466
- else:
467
- ind_scan = mutils.find_index(xaxis, posx)[0]
468
-
469
- self.navigator1D.ui.crosshair.set_crosshair_position(ind_scan[0])
470
-
471
-
472
- class ViewerND(ParameterManager, ActionManager, ViewerBase):
473
- params = [
474
- {'title': 'Set data spread 1D-0D', 'name': 'set_data_spread1D0D', 'type': 'action', 'visible': False},
475
- {'title': 'Set data spread 1D-1D', 'name': 'set_data_spread1D1D', 'type': 'action', 'visible': False},
476
- {'title': 'Set data spread 1D-2D', 'name': 'set_data_spread1D2D', 'type': 'action', 'visible': False},
477
- {'title': 'Set data spread 2D-0D', 'name': 'set_data_spread2D0D', 'type': 'action', 'visible': False},
478
- {'title': 'Set data spread 2D-1D', 'name': 'set_data_spread2D1D', 'type': 'action', 'visible': False},
479
- {'title': 'Set data spread 2D-2D', 'name': 'set_data_spread2D2D', 'type': 'action', 'visible': False},
480
- {'title': 'Set data spread 3D-0D', 'name': 'set_data_spread3D0D', 'type': 'action', 'visible': False},
481
- {'title': 'Set data 4D', 'name': 'set_data_4D', 'type': 'action', 'visible': False},
482
- {'title': 'Set data 3D', 'name': 'set_data_3D', 'type': 'action', 'visible': False},
483
- {'title': 'Set data 2D', 'name': 'set_data_2D', 'type': 'action', 'visible': False},
484
- {'title': 'Set data 1D', 'name': 'set_data_1D', 'type': 'action', 'visible': False},
485
- {'title': 'Signal shape', 'name': 'data_shape_settings', 'type': 'group', 'children': [
486
- {'title': 'Initial Data shape:', 'name': 'data_shape_init', 'type': 'str', 'value': "",
487
- 'readonly': True},
488
- {'title': 'Axes shape:', 'name': 'nav_axes_shapes', 'type': 'group', 'children': [],
489
- 'readonly': True},
490
- {'title': 'Data shape:', 'name': 'data_shape', 'type': 'str', 'value': "", 'readonly': True},
491
- {'title': 'Navigator axes:', 'name': 'navigator_axes', 'type': 'itemselect'},
492
- {'title': 'Set Nav axes:', 'name': 'set_nav_axes', 'type': 'action', 'visible': True},
493
- ]},
494
- ]
495
-
496
- def __init__(self, parent: QtWidgets.QWidget = None, title=''):
497
- ViewerBase.__init__(self, parent, title=title)
498
- ActionManager.__init__(self, toolbar=QtWidgets.QToolBar())
499
- ParameterManager.__init__(self)
500
-
501
- self._area = None
502
- self._data = None
503
-
504
- self.viewer0D: Viewer0D = None
505
- self.viewer1D: Viewer1D = None
506
- self.viewer2D: Viewer2D = None
507
- self.navigator1D: Viewer1D = None
508
- self.navigator2D: Viewer2D = None
509
- self.axes_viewer: AxesViewer = None
510
-
511
- self.setup_widgets()
512
-
513
- self.data_displayer: BaseDataDisplayer = None
514
-
515
- self.setup_actions()
516
-
517
- self.connect_things()
518
-
519
- self.prepare_ui()
520
-
521
- def update_data_displayer(self, distribution: DataDistribution):
522
- if distribution.name == 'uniform':
523
- self.data_displayer = UniformDataDisplayer(self.viewer0D, self.viewer1D, self.viewer2D,
524
- self.navigator1D, self.navigator2D,
525
- self.axes_viewer)
526
- else:
527
- self.data_displayer = SpreadDataDisplayer(self.viewer0D, self.viewer1D, self.viewer2D,
528
- self.navigator1D, self.navigator2D,
529
- self.axes_viewer)
530
-
531
- self.navigator1D.crosshair.crosshair_dragged.connect(self.data_displayer.update_viewer_data)
532
-
533
- self.navigator1D.ROI_select_signal.connect(self.data_displayer.updated_nav_integration)
534
-
535
- self.navigator2D.crosshair_dragged.connect(self.data_displayer.update_viewer_data)
536
-
537
- self.navigator2D.ROI_select_signal.connect(self.data_displayer.updated_nav_integration)
538
- self.axes_viewer.navigation_changed.connect(self.data_displayer.update_viewer_data)
539
- self.data_displayer.data_dim_signal.connect(self.update_data_dim)
540
-
541
- self.viewer1D.roi.sigRegionChanged.connect(self.data_displayer.update_nav_data_from_roi)
542
-
543
- self.viewer2D.roi.sigRegionChanged.connect(self.data_displayer.update_nav_data_from_roi)
544
-
545
- self.get_action('filters').currentTextChanged.connect(self.data_displayer.update_filter)
546
- self.connect_action('integrate_nav', self.data_displayer.show_nav_integration)
547
- self.data_displayer.processor_changed.connect(self.update_filters)
548
-
549
- def _show_data(self, data: DataRaw, **kwargs):
550
- force_update = False
551
- self.settings.child('data_shape_settings', 'data_shape_init').setValue(str(data.shape))
552
- self.settings.child('data_shape_settings', 'navigator_axes').setValue(
553
- dict(all_items=[str(ax.index) for ax in data.axes],
554
- selected=[str(ax.index) for ax in data.get_nav_axes()]))
555
-
556
- if self._data is None or self._data.dim != data.dim or self._data.nav_indexes != data.nav_indexes:
557
- force_update = True
558
- if 'force_update' in kwargs:
559
- force_update = kwargs['force_update']
560
-
561
- if self.data_displayer is None or data.distribution != self.data_displayer.distribution:
562
- self.update_data_displayer(data.distribution)
563
-
564
- self.data_displayer.update_data(data, force_update=force_update)
565
- self._data = data
566
-
567
- if force_update:
568
- self.update_widget_visibility(data)
569
- self.data_displayer.init_rois(data.axes_limits(data.nav_indexes),
570
- data.axes_limits(data.sig_indexes))
571
- self.data_to_export_signal.emit(self.data_to_export)
572
-
573
- def set_data_test(self, data_shape='3D'):
574
- if 'spread' in data_shape:
575
- data_tri = np.load('../../../resources/triangulation_data.npy')
576
- axes = [Axis(data=data_tri[:, 0], index=0, label='x_axis', units='xunits', spread_order=0)]
577
-
578
- if 'spread2D' in data_shape or 'spread3D' in data_shape:
579
- axes.append(Axis(data=data_tri[:, 1], index=0, label='y_axis', units='yunits', spread_order=1))
580
- if data_shape == 'spread2D0D':
581
- data = data_tri[:, 2]
582
- elif data_shape == 'spread2D1D':
583
- x = np.linspace(-50, 50, 100)
584
- data = np.zeros((data_tri.shape[0], len(x)))
585
- for ind in range(data_tri.shape[0]):
586
- data[ind, :] = data_tri[ind, 2] * mutils.gauss1D(x, 0.01*ind - 10, 20)
587
- axes.append(Axis(data=x, index=1, label='sig_axis'))
588
- elif data_shape == 'spread2D2D':
589
- x = np.linspace(-50, 50, 100)
590
- y = np.linspace(-200, 200, 75)
591
- data = np.zeros((data_tri.shape[0], len(y), len(x)))
592
- for ind in range(data_tri.shape[0]):
593
- #data[ind, :] = data_tri[ind, 2] * mutils.gauss2D(0.01*x, 0.1*ind - 20, 20, y, 0.1*ind-20, 10)
594
- data[ind, :] = mutils.gauss2D(x, 10*data_tri[ind, 0], 20, y, 20*data_tri[ind, 1], 30)
595
- axes.append(Axis(data=x, index=1, label='sig_axis0'))
596
- axes.append(Axis(data=y, index=2, label='sig_axis1'))
597
- elif data_shape == 'spread3D0D':
598
- if 'spread2D' in data_shape or 'spread3D' in data_shape:
599
- axes.append(Axis(data=data_tri[:, 1], index=0, label='z_axis', units='zunits', spread_order=2))
600
- data = data_tri[:, 2]
601
-
602
- else:
603
- if data_shape == 'spread1D0D':
604
- data = data_tri[:, 2]
605
- elif data_shape == 'spread1D1D':
606
- x = np.linspace(-50, 50, 100)
607
- data = np.zeros((data_tri.shape[0], len(x)))
608
- for ind in range(data_tri.shape[0]):
609
- data[ind, :] = data_tri[ind, 2] * mutils.gauss1D(x, 0.01 * ind - 10, 20)
610
- axes.append(Axis(data=x, index=1, label='sig_axis'))
611
- elif data_shape == 'spread1D2D':
612
- x = np.linspace(-50, 50, 100)
613
- y = np.linspace(-200, 200, 75)
614
- data = np.zeros((data_tri.shape[0], len(y), len(x)))
615
- for ind in range(data_tri.shape[0]):
616
- # data[ind, :] = data_tri[ind, 2] * mutils.gauss2D(0.01*x, 0.1*ind - 20, 20, y, 0.1*ind-20, 10)
617
- data[ind, :] = mutils.gauss2D(x, 10 * data_tri[ind, 0], 20, y, 20 * data_tri[ind, 1], 30)
618
- axes.append(Axis(data=x, index=1, label='sig_axis0'))
619
- axes.append(Axis(data=y, index=2, label='sig_axis1'))
620
-
621
- dataraw = DataRaw('NDdata', distribution='spread', dim='DataND',
622
- data=[data], nav_indexes=(0, ),
623
- axes=axes)
624
- else:
625
- x = mutils.linspace_step(-10, 10, 0.2)
626
- y = mutils.linspace_step(-30, 30, 2)
627
- t = mutils.linspace_step(-200, 200, 2)
628
- z = mutils.linspace_step(-50, 50, 0.5)
629
- data = np.zeros((len(y), len(x), len(t), len(z)))
630
- amp = mutils.gauss2D(x, 0, 5, y, 0, 4) + 0.1 * np.random.rand(len(y), len(x))
631
- amp = np.ones((len(y), len(x), len(t), len(z)))
632
- for indx in range(len(x)):
633
- for indy in range(len(y)):
634
- data[indy, indx, :, :] = amp[indy, indx] * (
635
- mutils.gauss2D(z, -50 + indx * 1, 20,
636
- t, 0 + 2 * indy, 30)
637
- + np.random.rand(len(t), len(z)) / 10)
638
-
639
- if data_shape == '4D':
640
- dataraw = DataRaw('NDdata', data=data, dim='DataND', nav_indexes=[0, 1],
641
- axes=[Axis(data=y, index=0, label='y_axis', units='yunits'),
642
- Axis(data=x, index=1, label='x_axis', units='xunits'),
643
- Axis(data=t, index=2, label='t_axis', units='tunits'),
644
- Axis(data=z, index=3, label='z_axis', units='zunits')])
645
- elif data_shape == '3D':
646
- data = [np.sum(data, axis=2)]
647
- dataraw = DataRaw('NDdata', data=data, dim='DataND', nav_indexes=[0, 1],
648
- axes=[Axis(data=y, index=0, label='y_axis', units='yunits'),
649
- Axis(data=x, index=1, label='x_axis', units='xunits'),
650
- Axis(data=t, index=2, label='t_axis', units='tunits')])
651
- elif data_shape == '2D':
652
- data = [np.sum(data, axis=(2, 3))]
653
- dataraw = DataRaw('NDdata', data=data, dim='DataND', nav_indexes=[0],
654
- axes=[Axis(data=y, index=0, label='y_axis', units='yunits'),
655
- Axis(data=x, index=1, label='x_axis', units='xunits')],
656
- )
657
- elif data_shape == '1D':
658
- data = [np.sum(data, axis=(0, 1, 2))]
659
- dataraw = DataRaw('NDdata', data=data, dim='DataND', nav_indexes=[],
660
- axes=[Axis(data=z, index=0, label='z_axis', units='zunits')])
661
- self._show_data(dataraw, force_update=True)
662
-
663
- def update_widget_visibility(self, data: DataRaw = None,
664
- nav_indexes:Tuple[int] = None):
665
- if data is None:
666
- data = self._data
667
- if nav_indexes is None:
668
- nav_indexes = data.nav_indexes
669
- self.viewer0D.setVisible(len(data.shape) - len(nav_indexes) == 0)
670
- self.viewer1D.setVisible(len(data.shape) - len(nav_indexes) == 1)
671
- self.viewer2D.setVisible(len(data.shape) - len(nav_indexes) == 2)
672
- self.viewer1D.roi.setVisible(len(nav_indexes) != 0)
673
- self.viewer2D.roi.setVisible(len(nav_indexes) != 0)
674
- self._dock_navigation.setVisible(len(nav_indexes) != 0)
675
- #nav_axes = data.get_nav_axes()
676
-
677
- if data.distribution.name == 'uniform':
678
- self.navigator1D.setVisible(len(nav_indexes) == 1)
679
- self.navigator2D.setVisible(len(nav_indexes) == 2)
680
- self.axes_viewer.setVisible(len(nav_indexes) > 2)
681
- else:
682
- self.navigator2D.setVisible(len(nav_indexes) == 2 and self.data_displayer.triangulation)
683
- self.navigator1D.setVisible(len(nav_indexes) == 1 or len(nav_indexes) > 2 or
684
- len(nav_indexes) == 2 and
685
- not self.data_displayer.triangulation)
686
-
687
- def update_filters(self, processor: DataProcessorFactory):
688
- self.get_action('filters').clear()
689
- self.get_action('filters').addItems(processor.functions_filtered('DataND'))
690
-
691
- def show_settings(self, show: bool = True):
692
- if show:
693
- self.settings_tree.show()
694
- else:
695
- self.settings_tree.hide()
696
-
697
- def prepare_ui(self):
698
- self.navigator1D.setVisible(False)
699
- self.viewer2D.setVisible(False)
700
- self.navigator1D.setVisible(False)
701
- self.viewer2D.setVisible(False)
702
-
703
- def setup_actions(self):
704
- self.add_action('setaxes', icon_name='cartesian', checkable=True, tip='Change navigation/signal axes')
705
- self.add_widget('filters', QtWidgets.QComboBox, tip='Filter type to apply to signal data')
706
- self.add_action('integrate_nav',icon_name='integrator', checkable=True,
707
- tip='Integrate the navigation data')
708
-
709
- def reshape_data(self):
710
- _nav_indexes = [int(index) for index in
711
- self.settings.child('data_shape_settings', 'navigator_axes').value()['selected']]
712
- self.update_widget_visibility(nav_indexes=_nav_indexes)
713
- self.data_displayer.update_nav_indexes(_nav_indexes)
714
-
715
- def connect_things(self):
716
- self.settings.child('set_data_1D').sigActivated.connect(lambda: self.set_data_test('1D'))
717
- self.settings.child('set_data_2D').sigActivated.connect(lambda: self.set_data_test('2D'))
718
- self.settings.child('set_data_3D').sigActivated.connect(lambda: self.set_data_test('3D'))
719
- self.settings.child('set_data_4D').sigActivated.connect(lambda: self.set_data_test('4D'))
720
- self.settings.child('set_data_spread2D0D').sigActivated.connect(lambda: self.set_data_test('spread2D0D'))
721
- self.settings.child('set_data_spread2D1D').sigActivated.connect(lambda: self.set_data_test('spread2D1D'))
722
- self.settings.child('set_data_spread2D2D').sigActivated.connect(lambda: self.set_data_test('spread2D2D'))
723
- self.settings.child('set_data_spread1D0D').sigActivated.connect(lambda: self.set_data_test('spread1D0D'))
724
- self.settings.child('set_data_spread1D1D').sigActivated.connect(lambda: self.set_data_test('spread1D1D'))
725
- self.settings.child('set_data_spread1D2D').sigActivated.connect(lambda: self.set_data_test('spread1D2D'))
726
- self.settings.child('set_data_spread3D0D').sigActivated.connect(lambda: self.set_data_test('spread3D0D'))
727
- self.settings.child('data_shape_settings', 'set_nav_axes').sigActivated.connect(self.reshape_data)
728
-
729
- self.navigator1D.get_action('crosshair').trigger()
730
- self.connect_action('setaxes', self.show_settings)
731
-
732
- def setup_widgets(self):
733
- self.parent.setLayout(QtWidgets.QVBoxLayout())
734
- self.parent.layout().addWidget(self.toolbar)
735
-
736
- self._area = DockArea()
737
- self.parent.layout().addWidget(self._area)
738
-
739
- viewer0D_widget = QtWidgets.QWidget()
740
- self.viewer0D = Viewer0D(viewer0D_widget)
741
-
742
- viewer1D_widget = QtWidgets.QWidget()
743
- self.viewer1D = Viewer1D(viewer1D_widget)
744
- self.viewer1D.roi = LinearROI()
745
- self.viewer1D.view.plotitem.addItem(self.viewer1D.roi)
746
-
747
- viewer2D_widget = QtWidgets.QWidget()
748
- self.viewer2D = Viewer2D(viewer2D_widget)
749
- self.viewer2D.roi = SimpleRectROI(centered=True)
750
- self.viewer2D.view.plotitem.addItem(self.viewer2D.roi)
751
-
752
- self.viewer2D.set_action_visible('flip_ud', False)
753
- self.viewer2D.set_action_visible('flip_lr', False)
754
- self.viewer2D.set_action_visible('rotate', False)
755
- self.viewer2D.get_action('autolevels').trigger()
756
-
757
- self._dock_signal = Dock('Signal')
758
- self._dock_signal.addWidget(viewer0D_widget)
759
- self._dock_signal.addWidget(viewer1D_widget)
760
- self._dock_signal.addWidget(viewer2D_widget)
761
-
762
- navigator1D_widget = QtWidgets.QWidget()
763
- self.navigator1D = Viewer1D(navigator1D_widget)
764
- navigator2D_widget = QtWidgets.QWidget()
765
- self.navigator2D = Viewer2D(navigator2D_widget)
766
- self.navigator2D.get_action('autolevels').trigger()
767
- self.navigator2D.get_action('crosshair').trigger()
768
-
769
- nav_axes_widget = QtWidgets.QWidget()
770
- nav_axes_widget.setVisible(False)
771
- self.axes_viewer = AxesViewer(nav_axes_widget)
772
-
773
- self._dock_navigation = Dock('Navigation')
774
- self._dock_navigation.addWidget(navigator1D_widget)
775
- self._dock_navigation.addWidget(navigator2D_widget)
776
- self._dock_navigation.addWidget(nav_axes_widget)
777
-
778
- self._area.addDock(self._dock_navigation)
779
- self._area.addDock(self._dock_signal, 'right', self._dock_navigation)
780
-
781
- def update_data_dim(self, dim: str):
782
- self.settings.child('data_shape_settings', 'data_shape').setValue(dim)
783
-
784
-
785
- def main():
786
- app = QtWidgets.QApplication(sys.argv)
787
- widget = QtWidgets.QWidget()
788
- prog = ViewerND(widget)
789
- for child in prog.settings.children():
790
- if 'set_data_' in child.name():
791
- child.show(True)
792
- prog.show_settings()
793
-
794
- widget.show()
795
- sys.exit(app.exec_())
796
-
797
-
798
- if __name__ == '__main__':
799
- main()
800
-