pymodaq 4.4.7__py3-none-any.whl → 5.0.1__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 (415) hide show
  1. pymodaq/__init__.py +57 -91
  2. pymodaq/control_modules/daq_move.py +64 -46
  3. pymodaq/control_modules/daq_move_ui.py +34 -12
  4. pymodaq/control_modules/daq_viewer.py +55 -30
  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 +51 -43
  8. pymodaq/control_modules/utils.py +43 -20
  9. pymodaq/control_modules/viewer_utility_classes.py +54 -18
  10. pymodaq/daq_utils/daq_utils.py +6 -0
  11. pymodaq/dashboard.py +639 -323
  12. pymodaq/examples/function_plotter.py +13 -12
  13. pymodaq/examples/tcp_client.py +1 -1
  14. pymodaq/extensions/__init__.py +1 -1
  15. pymodaq/extensions/bayesian/bayesian_optimisation.py +44 -32
  16. pymodaq/extensions/bayesian/utils.py +10 -10
  17. pymodaq/extensions/console.py +7 -6
  18. pymodaq/extensions/daq_logger/__init__.py +1 -0
  19. pymodaq/extensions/{daq_logger.py → daq_logger/daq_logger.py} +30 -30
  20. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger.py +16 -15
  21. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger_models.py +2 -0
  22. pymodaq/{utils/h5modules → extensions/daq_logger}/h5logging.py +7 -8
  23. pymodaq/extensions/daq_scan.py +42 -34
  24. pymodaq/extensions/daq_scan_ui.py +18 -18
  25. pymodaq/extensions/h5browser.py +2 -3
  26. pymodaq/extensions/pid/__init__.py +4 -2
  27. pymodaq/extensions/pid/daq_move_PID.py +3 -3
  28. pymodaq/extensions/pid/pid_controller.py +59 -50
  29. pymodaq/extensions/pid/utils.py +10 -5
  30. pymodaq/extensions/utils.py +33 -3
  31. pymodaq/post_treatment/load_and_plot.py +10 -7
  32. pymodaq/resources/preset_default.xml +1 -1
  33. pymodaq/updater.py +107 -0
  34. pymodaq/utils/array_manipulation.py +4 -384
  35. pymodaq/utils/calibration_camera.py +12 -9
  36. pymodaq/utils/chrono_timer.py +11 -10
  37. pymodaq/utils/config.py +3 -458
  38. pymodaq/utils/daq_utils.py +9 -715
  39. pymodaq/utils/data.py +17 -2959
  40. pymodaq/utils/enums.py +4 -74
  41. pymodaq/utils/exceptions.py +0 -4
  42. pymodaq/utils/gui_utils/__init__.py +8 -8
  43. pymodaq/utils/gui_utils/loader_utils.py +26 -1
  44. pymodaq/utils/gui_utils/utils.py +8 -162
  45. pymodaq/utils/gui_utils/widgets/lcd.py +6 -109
  46. pymodaq/utils/h5modules/__init__.py +0 -4
  47. pymodaq/utils/h5modules/module_saving.py +9 -8
  48. pymodaq/utils/leco/__init__.py +2 -2
  49. pymodaq/utils/leco/daq_move_LECODirector.py +3 -6
  50. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +5 -5
  51. pymodaq/utils/leco/director_utils.py +2 -2
  52. pymodaq/utils/leco/leco_director.py +3 -3
  53. pymodaq/utils/leco/pymodaq_listener.py +4 -3
  54. pymodaq/utils/leco/utils.py +11 -9
  55. pymodaq/utils/logger.py +4 -76
  56. pymodaq/utils/managers/batchscan_manager.py +16 -19
  57. pymodaq/utils/managers/modules_manager.py +30 -17
  58. pymodaq/utils/managers/overshoot_manager.py +48 -6
  59. pymodaq/utils/managers/preset_manager.py +39 -59
  60. pymodaq/utils/managers/preset_manager_utils.py +28 -22
  61. pymodaq/utils/managers/remote_manager.py +12 -10
  62. pymodaq/utils/math_utils.py +4 -582
  63. pymodaq/utils/messenger.py +4 -64
  64. pymodaq/utils/parameter/__init__.py +6 -9
  65. pymodaq/utils/parameter/utils.py +4 -328
  66. pymodaq/utils/scanner/scan_config.py +1 -1
  67. pymodaq/utils/scanner/scan_factory.py +16 -12
  68. pymodaq/utils/{plotting → scanner}/scan_selector.py +19 -20
  69. pymodaq/utils/scanner/scanner.py +10 -8
  70. pymodaq/utils/scanner/scanners/_1d_scanners.py +8 -5
  71. pymodaq/utils/scanner/scanners/_2d_scanners.py +5 -5
  72. pymodaq/utils/scanner/scanners/sequential.py +8 -8
  73. pymodaq/utils/scanner/scanners/tabular.py +9 -9
  74. pymodaq/utils/scanner/utils.py +6 -4
  75. pymodaq/utils/svg/svg_viewer2D.py +3 -4
  76. pymodaq/utils/tcp_ip/mysocket.py +4 -110
  77. pymodaq/utils/tcp_ip/serializer.py +4 -801
  78. pymodaq/utils/tcp_ip/tcp_server_client.py +15 -13
  79. pymodaq-5.0.1.dist-info/METADATA +242 -0
  80. pymodaq-5.0.1.dist-info/RECORD +122 -0
  81. {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/WHEEL +1 -1
  82. {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/entry_points.txt +1 -0
  83. pymodaq/examples/custom_app.py +0 -258
  84. pymodaq/examples/custom_viewer.py +0 -112
  85. pymodaq/examples/parameter_ex.py +0 -138
  86. pymodaq/examples/preset_MockCamera.xml +0 -1
  87. pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.py +0 -142
  88. pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.ui +0 -232
  89. pymodaq/post_treatment/daq_measurement/daq_measurement_main.py +0 -391
  90. pymodaq/post_treatment/daq_measurement/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -2
  91. pymodaq/post_treatment/process_to_scalar.py +0 -263
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/algo.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/input.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/random.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  309. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  310. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  311. pymodaq/resources/QtDesigner_Ressources/Icon_Library/target.png +0 -0
  312. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  313. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  314. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  315. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  316. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  317. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  318. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  319. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  320. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  321. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  322. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  323. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  324. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  325. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  326. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  327. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -238
  328. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127453
  329. pymodaq/resources/QtDesigner_Ressources/__init__.py +0 -0
  330. pymodaq/resources/QtDesigner_Ressources/credit.rst +0 -7
  331. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  332. pymodaq/resources/VERSION +0 -2
  333. pymodaq/resources/config_template.toml +0 -96
  334. pymodaq/resources/triangulation_data.npy +0 -0
  335. pymodaq/utils/abstract/__init__.py +0 -48
  336. pymodaq/utils/db/__init__.py +0 -0
  337. pymodaq/utils/db/db_logger/__init__.py +0 -0
  338. pymodaq/utils/factory.py +0 -82
  339. pymodaq/utils/gui_utils/custom_app.py +0 -133
  340. pymodaq/utils/gui_utils/dock.py +0 -107
  341. pymodaq/utils/gui_utils/file_io.py +0 -94
  342. pymodaq/utils/gui_utils/layout.py +0 -34
  343. pymodaq/utils/gui_utils/list_picker.py +0 -38
  344. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  345. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  346. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  347. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  348. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  349. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  350. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  351. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -110
  352. pymodaq/utils/h5modules/backends.py +0 -1022
  353. pymodaq/utils/h5modules/browsing.py +0 -627
  354. pymodaq/utils/h5modules/data_saving.py +0 -1107
  355. pymodaq/utils/h5modules/exporter.py +0 -119
  356. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  357. pymodaq/utils/h5modules/exporters/base.py +0 -111
  358. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  359. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  360. pymodaq/utils/h5modules/saving.py +0 -866
  361. pymodaq/utils/h5modules/utils.py +0 -115
  362. pymodaq/utils/managers/action_manager.py +0 -489
  363. pymodaq/utils/managers/parameter_manager.py +0 -279
  364. pymodaq/utils/managers/roi_manager.py +0 -740
  365. pymodaq/utils/parameter/ioxml.py +0 -545
  366. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  367. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  368. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  369. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  370. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  371. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  372. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  373. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  374. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  375. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -166
  376. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  377. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  378. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  379. pymodaq/utils/plotting/__init__.py +0 -0
  380. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  381. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  382. pymodaq/utils/plotting/data_viewers/viewer.py +0 -275
  383. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  384. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -826
  385. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  386. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  387. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  388. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  389. pymodaq/utils/plotting/gant_chart.py +0 -123
  390. pymodaq/utils/plotting/image_viewer.py +0 -97
  391. pymodaq/utils/plotting/items/__init__.py +0 -0
  392. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  393. pymodaq/utils/plotting/items/crosshair.py +0 -94
  394. pymodaq/utils/plotting/items/image.py +0 -388
  395. pymodaq/utils/plotting/navigator.py +0 -353
  396. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  397. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  398. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  399. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  400. pymodaq/utils/plotting/utils/__init__.py +0 -0
  401. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  402. pymodaq/utils/plotting/utils/filter.py +0 -585
  403. pymodaq/utils/plotting/utils/lineout.py +0 -226
  404. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  405. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  406. pymodaq/utils/plotting/widgets.py +0 -76
  407. pymodaq/utils/qvariant.py +0 -12
  408. pymodaq/utils/slicing.py +0 -63
  409. pymodaq/utils/units.py +0 -216
  410. pymodaq-4.4.7.dist-info/METADATA +0 -163
  411. pymodaq-4.4.7.dist-info/RECORD +0 -446
  412. /pymodaq/{post_treatment/daq_analysis → daq_utils}/__init__.py +0 -0
  413. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  414. /pymodaq/{post_treatment/daq_measurement → extensions/daq_logger/db}/__init__.py +0 -0
  415. {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,391 +0,0 @@
1
- from qtpy import QtWidgets
2
- from qtpy.QtCore import Qt, QObject, Slot, Signal
3
-
4
- import sys
5
- from pymodaq.post_treatment.daq_measurement.daq_measurement_GUI import Ui_Form
6
- from pymodaq.utils import daq_utils as utils
7
- from pymodaq.utils.plotting.utils.filter import FourierFilterer
8
- from scipy.optimize import curve_fit
9
- import numpy as np
10
- from pymodaq.utils.enums import BaseEnum
11
-
12
-
13
- class Measurement_type(BaseEnum):
14
- Cursor_Integration = 0
15
- Max = 1
16
- Min = 2
17
- Gaussian_Fit = 3
18
- Lorentzian_Fit = 4
19
- Exponential_Decay_Fit = 5
20
- Sinus = 6
21
-
22
- @classmethod
23
- def update_measurement_subtype(cls, mtype):
24
- measurement_gaussian_subitems = ["amp", "dx", "x0", "offset"]
25
- measurement_laurentzian_subitems = ["alpha", "gamma", "x0", "offset"]
26
- measurement_decay_subitems = ["N0", "gamma", 'x0', "offset"]
27
- measurement_cursor_subitems = ["sum", "mean", "std"]
28
- measurement_sinus_subtitems = ['A', 'dx', 'phi', 'offset']
29
- variables = ", "
30
- formula = ""
31
- subitems = []
32
- if mtype == 'Cursor_Integration': # "Cursor integration":
33
- subitems = measurement_cursor_subitems
34
-
35
- if mtype == 'Gaussian_Fit': # "Gaussian Fit":
36
- subitems = measurement_gaussian_subitems
37
- formula = "amp*np.exp(-2*np.log(2)*(x-x0)**2/dx**2)+offset"
38
- variables = variables.join(measurement_gaussian_subitems)
39
-
40
- elif mtype == 'Lorentzian_Fit': # "Lorentzian Fit":
41
- subitems = measurement_laurentzian_subitems
42
- variables = variables.join(measurement_laurentzian_subitems)
43
- formula = "alpha/np.pi*gamma/2/((x-x0)**2+(gamma/2)**2)+offset"
44
-
45
- elif mtype == 'Exponential_Decay_Fit': # "Exponential Decay Fit":
46
- subitems = measurement_decay_subitems
47
- variables = variables.join(measurement_decay_subitems)
48
- formula = "N0*np.exp(-(x-x0)/gamma)+offset"
49
-
50
- elif mtype == 'Sinus':
51
- subitems = measurement_sinus_subtitems
52
- variables = variables.join(measurement_sinus_subtitems)
53
- formula = "A*np.sin(2*np.pi*x/dx-phi)+offset"
54
-
55
- return [variables, formula, subitems]
56
-
57
- def gaussian_func(self, x, amp, dx, x0, offset):
58
- return amp * np.exp(-2 * np.log(2) * (x - x0) ** 2 / dx ** 2) + offset
59
-
60
- def laurentzian_func(self, x, alpha, gamma, x0, offset):
61
- return alpha / np.pi * 1 / 2 * gamma / ((x - x0) ** 2 + (1 / 2 * gamma) ** 2) + offset
62
-
63
- def decaying_func(self, x, N0, gamma, x0, offset):
64
- return N0 * np.exp(-(x - x0) / gamma) + offset
65
-
66
- def sinus_func(self, x, A, dx, phi, offset):
67
- return A * np.sin(2 * np.pi * x / dx - phi) + offset
68
-
69
-
70
- class DAQ_Measurement(Ui_Form, QObject):
71
- """
72
- =================== ================================== =======================================
73
- **Attributes** **Type** **Description**
74
-
75
-
76
- *ui* QObject The local instance of User Interface
77
- *wait_time* int The default delay of showing
78
- *parent* QObject The QObject initializing the UI
79
- *xdata* 1D numpy array The x axis data
80
- *ydata* 1D numpy array The y axis data
81
- *measurement_types* instance of daq_utils.DAQ_enums The type of the measurement, between:
82
- * 'Cursor_Integration'
83
- * 'Max'
84
- * 'Min'
85
- * 'Gaussian_Fit'
86
- * 'Lorentzian_Fit'
87
- * 'Exponential_Decay_Fit'
88
- =================== ================================== =======================================
89
-
90
- References
91
- ----------
92
- Ui_Form, QObject, qtpy, pyqtgraph
93
- """
94
- measurement_signal = Signal(list)
95
-
96
- def __init__(self, parent):
97
-
98
- super(Ui_Form, self).__init__()
99
- self.ui = Ui_Form()
100
- self.ui.setupUi(parent)
101
-
102
- self.widg = QtWidgets.QWidget()
103
- self.fourierfilt = FourierFilterer(self.widg)
104
- self.ui.splitter_2.addWidget(self.widg)
105
- self.ui.graph1D = self.fourierfilt.viewer1D.plotwidget
106
- QtWidgets.QApplication.processEvents()
107
-
108
- self.ui.splitter.setSizes([200, 400])
109
- self.ui.statusbar = QtWidgets.QStatusBar(parent)
110
- self.ui.statusbar.setMaximumHeight(15)
111
- self.ui.StatusBarLayout.addWidget(self.ui.statusbar)
112
- self.wait_time = 1000
113
- self.parent = parent
114
- self.xdata = None
115
- self.ydata = None
116
-
117
- self.measurement_types = Measurement_type.names()
118
- self.measurement_type = Measurement_type(0)
119
- self.ui.measurement_type_combo.clear()
120
- self.ui.measurement_type_combo.addItems(self.measurement_types)
121
-
122
- self.ui.fit_curve = self.fourierfilt.viewer1D.plotwidget.plot()
123
- self.ui.fit_curve.setPen("y")
124
- self.ui.fit_curve.setVisible(False)
125
-
126
- self.ui.selected_region = self.fourierfilt.viewer1D.ROI
127
- self.ui.selected_region.setZValue(-10)
128
- self.ui.selected_region.setBrush('b')
129
- self.ui.selected_region.setOpacity(0.2)
130
- self.ui.selected_region.setVisible(True)
131
- self.fourierfilt.viewer1D.plotwidget.addItem(self.ui.selected_region)
132
-
133
- # Connecting buttons:
134
- self.ui.Quit_pb.clicked.connect(self.Quit_fun, type=Qt.QueuedConnection)
135
- self.ui.measurement_type_combo.currentTextChanged[str].connect(self.update_measurement_subtype)
136
- self.ui.measure_subtype_combo.currentTextChanged[str].connect(self.update_measurement)
137
- self.update_measurement_subtype(self.ui.measurement_type_combo.currentText(), update=False)
138
- self.ui.selected_region.sigRegionChanged.connect(self.update_measurement)
139
- self.ui.result_sb.valueChanged.connect(self.ui.result_lcd.display)
140
-
141
- @Slot(dict)
142
- def update_fft_filter(self, d):
143
- self.frequency = d['frequency']
144
- self.phase = d['phase']
145
- self.update_measurement()
146
-
147
- def Quit_fun(self):
148
- """
149
- close the current instance of daq_measurement.
150
-
151
- """
152
- # insert anything that needs to be closed before leaving
153
- self.parent.close()
154
-
155
- def update_status(self, txt, wait_time=0):
156
- """
157
- Update the statut bar showing the given text message with a delay of wait_time ms (0s by default).
158
-
159
- =============== ========= ===========================
160
- **Parameters**
161
-
162
- *txt* string the text message to show
163
-
164
- *wait_time* int the delay time of waiting
165
- =============== ========= ===========================
166
-
167
- """
168
- self.ui.statusbar.showMessage(txt, wait_time)
169
-
170
- @Slot(str)
171
- def update_measurement_subtype(self, mtype, update=True):
172
- """
173
- | Update the ui-measure_subtype_combo from subitems and formula attributes, if specified by update parameter.
174
- | Linked with the update_measurement method
175
-
176
- ================ ========== =====================================================================================
177
- **Parameters** **Type** **Description**
178
-
179
- mtype string the Measurement_type index of the Measurement_type array (imported from daq_utils)
180
-
181
- update boolean the update boolean link with the update_measurement method
182
- ================ ========== =====================================================================================
183
-
184
- See Also
185
- --------
186
- update_measurement_subtype, update_measurement, update_status
187
-
188
- """
189
- self.measurement_type = Measurement_type[mtype]
190
- [variables, self.formula, self.subitems] = Measurement_type.update_measurement_subtype(mtype)
191
-
192
- try:
193
- self.ui.measure_subtype_combo.clear()
194
- self.ui.measure_subtype_combo.addItems(self.subitems)
195
- self.ui.formula_edit.setPlainText(self.formula)
196
-
197
- if update:
198
- self.update_measurement()
199
- except Exception as e:
200
- self.update_status(str(e), wait_time=self.wait_time)
201
-
202
- def update_measurement(self):
203
- """
204
- Update :
205
- * the measurement results from the update_measurements method
206
- * the statut bar on cascade (if needed)
207
- * the User Interface function curve state and data (if needed).
208
-
209
- Emit the measurement_signal corresponding.
210
-
211
- See Also
212
- --------
213
- update_measurement, update_status
214
-
215
- """
216
- try:
217
- xlimits = self.ui.selected_region.getRegion()
218
- mtype = self.ui.measurement_type_combo.currentText()
219
- msubtype = self.ui.measure_subtype_combo.currentText()
220
- if mtype == 'Sinus':
221
-
222
- # boundaries = utils.find_index(self.xdata, [xlimits[0], xlimits[1]])
223
- # sub_xaxis = self.xdata[boundaries[0][0]:boundaries[1][0]]
224
- # sub_data = self.ydata[boundaries[0][0]:boundaries[1][0]]
225
- # self.fourierfilt.parent.setVisible(True)
226
- self.fourierfilt.show_data(dict(data=self.ydata, xaxis=self.xdata))
227
- else:
228
- # self.fourierfilt.parent.setVisible(False)
229
- pass
230
-
231
- measurement_results = self.do_measurement(xlimits[0], xlimits[1], self.xdata, self.ydata, mtype, msubtype)
232
- if measurement_results['status'] is not None:
233
- self.update_status(measurement_results['status'], wait_time=self.wait_time)
234
- return
235
- self.ui.result_sb.setValue(measurement_results['value'])
236
- self.measurement_signal.emit([measurement_results['value']])
237
- if measurement_results['datafit'] is not None:
238
- self.ui.fit_curve.setVisible(True)
239
- self.ui.fit_curve.setData(measurement_results['xaxis'], measurement_results['datafit'])
240
- else:
241
- self.ui.fit_curve.setVisible(False)
242
- except Exception as e:
243
- self.update_status(str(e), wait_time=self.wait_time)
244
-
245
- def eval_func(self, x, *args):
246
- dic = dict(zip(self.subitems, args))
247
- dic.update(dict(np=np, x=x))
248
- return eval(self.formula, dic)
249
-
250
- def do_measurement(self, xmin, xmax, xaxis, data1D, mtype, msubtype):
251
- try:
252
- boundaries = utils.find_index(xaxis, [xmin, xmax])
253
- sub_xaxis = xaxis[boundaries[0][0]:boundaries[1][0]]
254
- sub_data = data1D[boundaries[0][0]:boundaries[1][0]]
255
- mtypes = Measurement_type.names()
256
- if msubtype in self.subitems:
257
- msub_ind = self.subitems.index(msubtype)
258
-
259
- measurement_results = dict(status=None, value=0, xaxis=np.array([]), datafit=np.array([]))
260
-
261
- if mtype == 'Cursor_Integration': # "Cursor Intensity Integration":
262
- if msubtype == "sum":
263
- result_measurement = np.sum(sub_data)
264
- elif msubtype == "mean":
265
- result_measurement = np.mean(sub_data)
266
- elif msubtype == "std":
267
- result_measurement = np.std(sub_data)
268
- else:
269
- result_measurement = 0
270
-
271
- elif mtype == 'Max': # "Max":
272
- result_measurement = np.max(sub_data)
273
-
274
- elif mtype == 'Min': # "Min":
275
- result_measurement = np.min(sub_data)
276
-
277
- elif mtype == 'Gaussian_Fit': # "Gaussian Fit":
278
- measurement_results['xaxis'] = sub_xaxis
279
- offset = np.min(sub_data)
280
- amp = np.max(sub_data) - np.min(sub_data)
281
- m = utils.my_moment(sub_xaxis, sub_data)
282
- p0 = [amp, m[1], m[0], offset]
283
- popt, pcov = curve_fit(self.eval_func, sub_xaxis, sub_data, p0=p0)
284
- measurement_results['datafit'] = self.eval_func(sub_xaxis, *popt)
285
- result_measurement = popt[msub_ind]
286
-
287
- elif mtype == 'Lorentzian_Fit': # "Lorentzian Fit":
288
- measurement_results['xaxis'] = sub_xaxis
289
- offset = np.min(sub_data)
290
- amp = np.max(sub_data) - np.min(sub_data)
291
- m = utils.my_moment(sub_xaxis, sub_data)
292
- p0 = [amp, m[1], m[0], offset]
293
- popt, pcov = curve_fit(self.eval_func, sub_xaxis, sub_data, p0=p0)
294
- measurement_results['datafit'] = self.eval_func(sub_xaxis, *popt)
295
- if msub_ind == 4: # amplitude
296
- result_measurement = popt[0] * 2 / (np.pi * popt[1]) # 2*alpha/(pi*gamma)
297
- else:
298
- result_measurement = popt[msub_ind]
299
-
300
- elif mtype == 'Exponential_Decay_Fit': # "Exponential Decay Fit":
301
- ind_x0 = utils.find_index(sub_data, np.max(sub_data))[0][0]
302
- x0 = sub_xaxis[ind_x0]
303
- sub_xaxis = sub_xaxis[ind_x0:]
304
- sub_data = sub_data[ind_x0:]
305
- offset = min([sub_data[0], sub_data[-1]])
306
- measurement_results['xaxis'] = sub_xaxis
307
- N0 = np.max(sub_data) - offset
308
- t37 = sub_xaxis[utils.find_index(sub_data - offset, 0.37 * N0)[0][0]] - x0
309
- # polynome = np.polyfit(sub_xaxis, -np.log((sub_data - 0.99 * offset) / N0), 1)
310
- p0 = [N0, t37, x0, offset]
311
- popt, pcov = curve_fit(self.eval_func, sub_xaxis, sub_data, p0=p0)
312
- measurement_results['datafit'] = self.eval_func(sub_xaxis, *popt)
313
- result_measurement = popt[msub_ind]
314
-
315
- elif mtype == 'Sinus': #
316
- offset = np.mean(sub_data)
317
- A = (np.max(sub_data) - np.min(sub_data)) / 2
318
- phi = self.fourierfilt.phase
319
- dx = 1 / self.fourierfilt.frequency
320
- measurement_results['xaxis'] = sub_xaxis
321
- p0 = [A, dx, phi, offset]
322
- popt, pcov = curve_fit(self.eval_func, sub_xaxis, sub_data, p0=p0)
323
- measurement_results['datafit'] = self.eval_func(sub_xaxis, *popt)
324
- result_measurement = popt[msub_ind]
325
-
326
- # elif mtype=="Custom Formula":
327
- # #offset=np.min(sub_data)
328
- # #amp=np.max(sub_data)-np.min(sub_data)
329
- # #m=utils.my_moment(sub_xaxis,sub_data)
330
- # #p0=[amp,m[1],m[0],offset]
331
- # popt, pcov = curve_fit(self.custom_func, sub_xaxis, sub_data,p0=[140,750,50,15])
332
- # self.curve_fitting_sig.emit([sub_xaxis,self.gaussian_func(sub_xaxis,*popt)])
333
- # result_measurement=popt[msub_ind]
334
- else:
335
- result_measurement = 0
336
-
337
- measurement_results['value'] = result_measurement
338
-
339
- return measurement_results
340
- except Exception as e:
341
- result_measurement = 0
342
- measurement_results['status'] = str(e)
343
- return measurement_results
344
-
345
- def update_data(self, xdata=None, ydata=None):
346
- """
347
- | Update xdata attribute with the numpy linspcae regular distribution (if param is none) and update the User Interface curve data.
348
- | Call the update_measurement method synchronously to keep same values.
349
-
350
- =============== ============ ======================
351
- **Parameters** **Type** **Description**
352
-
353
- *xdata* float list the x axis data
354
- *ydata* float list the y axis data
355
- =============== ============ ======================
356
-
357
- See Also
358
- --------
359
- update_measurement
360
-
361
- """
362
- if xdata is None:
363
- self.xdata = np.linspace(0, len(ydata) - 1, len(ydata))
364
- else:
365
- self.xdata = xdata
366
- self.ydata = ydata
367
- self.fourierfilt.show_data(dict(data=self.ydata, xaxis=self.xdata))
368
- self.update_measurement()
369
-
370
-
371
- if __name__ == '__main__':
372
- app = QtWidgets.QApplication(sys.argv)
373
- Form = QtWidgets.QWidget()
374
- from pymodaq.utils.daq_utils import gauss1D
375
-
376
- prog = DAQ_Measurement(Form)
377
- xdata = np.linspace(0, 400, 401)
378
- x0 = 50
379
- dx = 20
380
- tau = 27
381
- tau2 = 100
382
- ydata_gauss = 10 * gauss1D(xdata, x0, dx) + np.random.rand(len(xdata))
383
- ydata_expodec = np.zeros((len(xdata)))
384
- ydata_expodec[:50] = 10 * gauss1D(xdata[:50], x0, dx, 2)
385
- ydata_expodec[50:] = 10 * np.exp(-(xdata[50:] - x0) / tau) # +10*np.exp(-(xdata[50:]-x0)/tau2)
386
- ydata_expodec += 2 * np.random.rand(len(xdata))
387
- ydata_sin = 10 + 2 * np.sin(2 * np.pi * xdata / 21 - np.deg2rad(55)) + 2 * np.random.rand(len(xdata))
388
- prog.update_data(xdata, ydata_sin)
389
- Form.show()
390
-
391
- sys.exit(app.exec_())
@@ -1,2 +0,0 @@
1
- cd "C:\DAQ\Python\PyMoDAQ_Git\pymodaq\pymodaq\daq_measurement"
2
- C:\WPy-3710\python-3.7.1.amd64\Scripts\pyuic5.bat -x DAQ_Measurement_GUI.ui -o DAQ_Measurement_GUI.py
@@ -1,263 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created the 04/11/2022
4
-
5
- @author: Sebastien Weber
6
- """
7
- import numpy as np
8
- from numbers import Number
9
- from typing import List, Tuple
10
- from abc import ABCMeta, abstractmethod, abstractproperty
11
-
12
- from pymodaq.utils.factory import ObjectFactory
13
- from pymodaq.utils import math_utils as mutils
14
- from pymodaq.utils.data import DataWithAxes, Axis, DataRaw, DataBase, DataDim, DataCalculated
15
-
16
-
17
- config_processors = {
18
- }
19
-
20
-
21
- class DataProcessorBase(metaclass=ABCMeta):
22
- """Apply processing functions to signal data. This function should return a DataWithAxes.
23
-
24
- Attributes
25
- ----------
26
- apply_to: DataDim
27
- Specify on which type of data dimensionality this processor can be applied to, if only 1D:
28
- apply_to = DataDim['Data1D']
29
-
30
- """
31
-
32
- apply_to: DataDim = abstractproperty
33
-
34
- def process(self, data: DataWithAxes) -> DataWithAxes:
35
- return self.operate(data)
36
-
37
- @abstractmethod
38
- def operate(self, sub_data: DataWithAxes):
39
- pass
40
-
41
- @staticmethod
42
- def flatten_signal_dim(sub_data: DataWithAxes) -> Tuple[Tuple, np.ndarray]:
43
- """flattens data's ndarrays along the signal dimensions"""
44
- data_arrays = []
45
- new_shape = [sub_data.shape[ind] for ind in sub_data.nav_indexes]
46
- new_shape.append(np.prod([sub_data.shape[ind] for ind in sub_data.sig_indexes]))
47
-
48
- # for each data in subdata, apply the function, here argmax, along the flattened dimension. Then unravel the
49
- # possible multiple indexes (1 for 1D, 2 for 2D)
50
- for ind, data in enumerate(sub_data):
51
- data_arrays.append(data.reshape(new_shape))
52
- return new_shape, data_arrays
53
-
54
- def __call__(self, **kwargs):
55
- return self(**kwargs)
56
-
57
-
58
- class DataProcessorFactory(ObjectFactory):
59
- def get(self, processor_name, **kwargs) -> DataProcessorBase:
60
- return self.create(processor_name, **kwargs)
61
-
62
- @property
63
- def functions(self):
64
- """Get the list of processor functions"""
65
- return self.keys_function(do_sort=False)
66
-
67
- def functions_filtered(self, dim: DataDim):
68
- """Get the list of processor functions that could be applied to data having a given dimensionality"""
69
- return [key for key in self.functions if self.get(key).apply_to >= dim]
70
-
71
-
72
- @DataProcessorFactory.register('mean')
73
- class MeanProcessor(DataProcessorBase):
74
- apply_to = DataDim['DataND']
75
-
76
- def operate(self, sub_data: DataWithAxes):
77
- data_arrays = [np.atleast_1d(np.mean(data, axis=sub_data.sig_indexes)) for data in sub_data]
78
- return sub_data.deepcopy_with_new_data(data_arrays, sub_data.sig_indexes)
79
-
80
-
81
- @DataProcessorFactory.register('std')
82
- class StdProcessor(DataProcessorBase):
83
- apply_to = DataDim['DataND']
84
-
85
- def operate(self, sub_data: DataWithAxes):
86
- data_arrays = [np.atleast_1d(np.std(data, axis=sub_data.sig_indexes)) for data in sub_data]
87
- return sub_data.deepcopy_with_new_data(data_arrays, sub_data.sig_indexes)
88
-
89
-
90
- @DataProcessorFactory.register('sum')
91
- class SumProcessor(DataProcessorBase):
92
- apply_to = DataDim['DataND']
93
-
94
- def operate(self, sub_data: DataWithAxes):
95
- data_arrays = [np.atleast_1d(np.sum(data, axis=sub_data.sig_indexes)) for data in sub_data]
96
- return sub_data.deepcopy_with_new_data(data_arrays, sub_data.sig_indexes)
97
-
98
-
99
- @DataProcessorFactory.register('max')
100
- class MaxProcessor(DataProcessorBase):
101
- apply_to = DataDim['DataND']
102
-
103
- def operate(self, sub_data: DataWithAxes):
104
- data_arrays = [np.atleast_1d(np.max(data, axis=sub_data.sig_indexes)) for data in sub_data]
105
- return sub_data.deepcopy_with_new_data(data_arrays, sub_data.sig_indexes)
106
-
107
-
108
- @DataProcessorFactory.register('min')
109
- class MinProcessor(DataProcessorBase):
110
- apply_to = DataDim['DataND']
111
-
112
- def operate(self, sub_data: DataWithAxes):
113
- data_arrays = [np.atleast_1d(np.min(data, axis=sub_data.sig_indexes)) for data in sub_data]
114
- return sub_data.deepcopy_with_new_data(data_arrays, sub_data.sig_indexes)
115
-
116
-
117
- @DataProcessorFactory.register('argmax')
118
- class ArgMaxProcessor(DataProcessorBase):
119
- apply_to = DataDim['DataND']
120
-
121
- def operate(self, sub_data: DataWithAxes):
122
- """Extract info from sub-DataWithAxes
123
-
124
- Retrieve the signal axis values of the maximum position of the data
125
-
126
- Notes
127
- -----
128
- For more complex processors, such as the argmin, argmax ... , one cannot use directly the numpy function
129
- (compared to min, max, mean...). Indeed one has to first flatten the data arrays on the signal axes, then apply
130
- the function on the flatten dimension, here get the indexes of the minimum along the flattened dimension (as
131
- a function of the eventual navigations dimensions). From this index, on then obtain as many indexes as signal
132
- dimensions (1 for 1D Signals, 2 for 2D signals). And we do this for as many data there is in sub_data.
133
- """
134
- new_data_arrays = []
135
- new_shape, flattened_arrays = self.flatten_signal_dim(sub_data)
136
-
137
- for dat in flattened_arrays:
138
- indexes = np.unravel_index(np.nanargmax(dat, len(new_shape)-1), sub_data.shape)[len(sub_data.nav_indexes):]
139
- # from the unraveled index, retrieve the corresponding axis value
140
- for ind in range(len(indexes)):
141
- axis_data = sub_data.get_axis_from_index(sub_data.sig_indexes[ind])[0].get_data()
142
- new_data_arrays.append(np.atleast_1d(axis_data[indexes[ind]]))
143
- return DataCalculated('processed_data', data=new_data_arrays, nav_indexes=sub_data.nav_indexes,
144
- axes=[axis for axis in sub_data.axes if axis.index in sub_data.nav_indexes],
145
- distribution=sub_data.distribution)
146
-
147
-
148
- @DataProcessorFactory.register('argmin')
149
- class ArgMinProcessor(DataProcessorBase):
150
- apply_to = DataDim['DataND']
151
-
152
- def operate(self, sub_data: DataWithAxes):
153
- """Extract info from sub-DataWithAxes
154
-
155
- Retrieve the signal axis values of the minimum position of the data
156
-
157
- Notes
158
- -----
159
- For more complex processors, such as the argmin, argmax ... , one cannot use directly the numpy function
160
- (compared to min, max, mean...). Indeed one has to first flatten the data arrays on the signal axes, then apply
161
- the function on the flatten dimension, here get the indexes of the minimum along the flattened dimension (as
162
- a function of the eventual navigations dimensions). From this index, on then obtain as many indexes as signal
163
- dimensions (1 for 1D Signals, 2 for 2D signals). And we do this for as many data there is in sub_data.
164
- """
165
- new_data_arrays = []
166
- new_shape, flattened_arrays = self.flatten_signal_dim(sub_data)
167
-
168
- for dat in flattened_arrays:
169
- indexes = np.unravel_index(np.nanargmin(dat, len(new_shape)-1), sub_data.shape)[len(sub_data.nav_indexes):]
170
- # from the unraveled index, retrieve the corresponding axis value
171
- for ind in range(len(indexes)):
172
- axis_data = sub_data.get_axis_from_index(sub_data.sig_indexes[ind])[0].get_data()
173
- new_data_arrays.append(np.atleast_1d(axis_data[indexes[ind]]))
174
- return DataCalculated('processed_data', data=new_data_arrays, nav_indexes=sub_data.nav_indexes,
175
- axes=[axis for axis in sub_data.axes if axis.index in sub_data.nav_indexes],
176
- distribution=sub_data.distribution)
177
-
178
-
179
- @DataProcessorFactory.register('argmean')
180
- class ArgMeanProcessor(DataProcessorBase):
181
- apply_to = DataDim['Data1D']
182
-
183
- def operate(self, sub_data: DataWithAxes):
184
- """Extract info from sub-DataWithAxes
185
-
186
- Retrieve the signal mean axis values
187
-
188
- Notes
189
- -----
190
- For more complex processors, such as the argmin, argmax ... , one cannot use directly the numpy function
191
- (compared to min, max, mean...). Indeed one has to first flatten the data arrays on the signal axes, then apply
192
- the function on the flatten dimension, here get the indexes of the minimum along the flattened dimension (as
193
- a function of the eventual navigations dimensions). From this index, on then obtain as many indexes as signal
194
- dimensions (1 for 1D Signals, 2 for 2D signals). And we do this for as many data there is in sub_data.
195
- """
196
- new_data_arrays = []
197
- new_shape, flattened_arrays = self.flatten_signal_dim(sub_data)
198
- values = sub_data.get_axis_from_index(sub_data.sig_indexes[0])[0].get_data()
199
- for dat in flattened_arrays:
200
- weights = dat
201
- new_data_arrays.append(np.atleast_1d(np.average(values, axis=len(new_shape) - 1, weights=weights)))
202
- return DataCalculated('processed_data', data=new_data_arrays, nav_indexes=sub_data.nav_indexes,
203
- axes=[axis for axis in sub_data.axes if axis.index in sub_data.nav_indexes])
204
-
205
-
206
- @DataProcessorFactory.register('argstd')
207
- class ArgStdProcessor(DataProcessorBase):
208
- apply_to = DataDim['Data1D']
209
-
210
- def operate(self, sub_data: DataWithAxes):
211
- """Extract info from sub-DataWithAxes
212
-
213
- Retrieve the signal mean axis values
214
-
215
- Notes
216
- -----
217
- For more complex processors, such as the argmin, argmax ... , one cannot use directly the numpy function
218
- (compared to min, max, mean...). Indeed one has to first flatten the data arrays on the signal axes, then apply
219
- the function on the flatten dimension, here get the indexes of the minimum along the flattened dimension (as
220
- a function of the eventual navigations dimensions). From this index, on then obtain as many indexes as signal
221
- dimensions (1 for 1D Signals, 2 for 2D signals). And we do this for as many data there is in sub_data.
222
- """
223
- new_data_arrays = []
224
- new_shape, flattened_arrays = self.flatten_signal_dim(sub_data)
225
- values = sub_data.get_axis_from_index(sub_data.sig_indexes[0])[0].get_data()
226
- for dat in flattened_arrays:
227
- weights = dat
228
- w_avg = np.atleast_1d(np.average(values, axis=len(new_shape) - 1, weights=weights))
229
- new_data_arrays.append(np.atleast_1d(np.sqrt(
230
- np.sum(weights * (values - w_avg) ** 2, axis=len(new_shape) - 1) /
231
- np.sum(weights, axis=len(new_shape) - 1))))
232
- return DataCalculated('processed_data', data=new_data_arrays, nav_indexes=sub_data.nav_indexes,
233
- axes=[axis for axis in sub_data.axes if axis.index in sub_data.nav_indexes])
234
-
235
-
236
- if __name__ == '__main__':
237
- import copy
238
- processors = DataProcessorFactory()
239
- print('Builders:\n'
240
- f'{processors.builders}')
241
-
242
- print('Math functions:\n'
243
- f'{processors.functions}')
244
-
245
- # test 2D signals
246
- Nsigx = 200
247
- Nsigy = 100
248
- Nnav = 10
249
- x = np.linspace(-Nsigx / 2, Nsigx / 2 - 1, Nsigx)
250
- y = np.linspace(-Nsigy / 2, Nsigy / 2 - 1, Nsigy)
251
-
252
- dat = np.zeros((Nnav, Nsigy, Nsigx))
253
- for ind in range(Nnav):
254
- dat[ind] = ind * mutils.gauss2D(x, 10 * (ind - Nnav / 2), 25 / np.sqrt(2),
255
- y, 2 * (ind - Nnav / 2), 10 / np.sqrt(2))
256
-
257
- data = DataRaw('mydata', data=[dat], nav_indexes=(0,),
258
- axes=[Axis('nav', data=np.linspace(0, Nnav-1, Nnav), index=0),
259
- Axis('sigy', data=y, index=1),
260
- Axis('sigx', data=x, index=2)])
261
- new_data = processors.get('sum', **config_processors).operate(data.isig[25:75, 75:125])
262
- print(new_data)
263
- print(new_data.data)