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,25 +1,26 @@
1
1
  import os
2
2
  import sys
3
3
 
4
- import pymodaq.utils.config
5
4
  from qtpy.QtCore import QObject, Signal
6
5
  from qtpy import QtGui, QtWidgets
7
6
 
8
- from pymodaq.utils.logger import set_logger, get_module_name, get_module_name
9
- from pymodaq.utils.parameter import ioxml
10
- from pymodaq.utils import daq_utils as utils
11
- from pymodaq.utils.gui_utils import select_file
12
- from pymodaq.utils.parameter import ParameterTree, Parameter
13
- from pyqtgraph.parametertree import registerParameterType
14
- from pyqtgraph.parametertree.parameterTypes.basetypes import GroupParameter
7
+
8
+ from pymodaq.utils.config import get_set_remote_path
9
+
10
+ from pymodaq_utils.logger import set_logger, get_module_name
11
+ from pymodaq_gui.parameter import ioxml
12
+ from pymodaq_gui.utils import select_file
13
+ from pymodaq_gui.parameter import ParameterTree, Parameter
14
+ from pymodaq_gui.parameter.pymodaq_ptypes import registerParameterType, GroupParameter
15
15
 
16
16
  logger = set_logger(get_module_name(__file__))
17
- remote_path = pymodaq.utils.config.get_set_remote_path()
17
+ remote_path = get_set_remote_path()
18
18
  remote_types = ['ShortCut', 'Joystick']
19
19
 
20
20
  actuator_actions = ['move_Rel', 'move_Rel_p', 'move_Rel_m']
21
21
  detector_actions = ['snap', 'grab', 'stop']
22
22
  remote_types = ['Keyboard', 'Joystick']
23
+
23
24
  try:
24
25
  import pygame
25
26
  is_pygame = True
@@ -122,7 +123,8 @@ class ScalableGroupModules(GroupParameter):
122
123
  # param['show_pb'] = True
123
124
 
124
125
  if self.opts['modtype'] == 'Actuator':
125
- child = {'title': f'Actuator {typ}', 'name': f'{name_prefix}{newindex:03d}', 'type': 'group',
126
+ child = {'title': f'Actuator {typ}', 'name': f'{name_prefix}{newindex:03d}',
127
+ 'type': 'group',
126
128
  'removable': True, 'children': params, 'removable': True, 'renamable': False}
127
129
  else:
128
130
  child = {'title': f'Detector {typ}', 'name': f'det_{newindex:03d}', 'type': 'group',
@@ -1,574 +1,6 @@
1
- import numpy
2
- import numpy as np
3
- from numbers import Number
4
- from typing import List, Union, Tuple
5
- from pymodaq.utils.logger import get_module_name, set_logger
6
- from collections.abc import Iterable
1
+ from pymodaq_utils.math_utils import *
7
2
 
8
- logger = set_logger(get_module_name(__file__))
9
-
10
-
11
- def my_moment(x, y):
12
- """Returns the moments of a distribution y over an axe x
13
-
14
- Parameters
15
- ----------
16
- x: list or ndarray
17
- vector of floats
18
- y: list or ndarray
19
- vector of floats corresponding to the x axis
20
-
21
- Returns
22
- -------
23
- m: list
24
- Contains moment of order 0 (mean) and of order 1 (std) of the distribution y
25
- """
26
- dx = np.mean(np.diff(x))
27
- norm = np.sum(y) * dx
28
- m = [np.sum(x * y) * dx / norm]
29
- m.extend([np.sqrt(np.sum((x - m[0]) ** 2 * y) * dx / norm)])
30
- return m
31
-
32
-
33
- def normalize(x):
34
- x = x - np.min(x)
35
- x = x / np.max(x)
36
- return x
37
-
38
-
39
- def odd_even(x):
40
- """
41
- odd_even tells if a number is odd (return True) or even (return False)
42
-
43
- Parameters
44
- ----------
45
- x: the integer number to test
46
-
47
- Returns
48
- -------
49
- bool : boolean
50
- """
51
- if not isinstance(x, int):
52
- raise TypeError(f'{x} should be an integer')
53
- if int(x) % 2 == 0:
54
- bool = False
55
- else:
56
- bool = True
57
- return bool
58
-
59
-
60
- def greater2n(x):
61
- """
62
- return the first power of 2 greater than x
63
- Parameters
64
- ----------
65
- x: (int or float) a number
66
-
67
- Returns
68
- -------
69
- int: the power of 2 greater than x
70
- """
71
- if isinstance(x, bool):
72
- raise TypeError(f'{x} should be an integer or a float')
73
- if hasattr(x, '__iter__'):
74
- res = []
75
- for el in x:
76
- if isinstance(el, bool):
77
- raise TypeError(f'{el} should be an integer or a float')
78
- if not (isinstance(el, int) or isinstance(el, float)):
79
- raise TypeError(f'{x} elements should be integer or float')
80
- res.append(1 << (int(el) - 1).bit_length())
81
- if isinstance(x, np.ndarray):
82
- return np.array(res)
83
- else:
84
- return res
85
- else:
86
- if not (isinstance(x, int) or isinstance(x, float)):
87
- raise TypeError(f'{x} should be an integer or a float')
88
- return 1 << (int(x) - 1).bit_length()
89
-
90
-
91
- def linspace_step(start, stop, step):
92
- """
93
- Compute a regular linspace_step distribution from start to stop values.
94
-
95
- =============== =========== ======================================
96
- **Parameters** **Type** **Description**
97
- *start* scalar the starting value of distribution
98
- *stop* scalar the stopping value of distribution
99
- *step* scalar the length of a distribution step
100
- =============== =========== ======================================
101
-
102
- Returns
103
- -------
104
-
105
- scalar array
106
- The computed distribution axis as an array.
107
- """
108
- if np.sign(stop - start) != np.sign(step) or start == stop:
109
- raise ValueError('Invalid value for one parameter')
110
- Nsteps = int(np.ceil((stop - start) / step))
111
- new_stop = start + (Nsteps - 1) * step
112
- if np.abs(new_stop + step - stop) < 1e-12:
113
- Nsteps += 1
114
- new_stop = start + (Nsteps - 1) * step
115
- return np.linspace(start, new_stop, Nsteps)
116
-
117
-
118
- def linspace_step_N(start, step, Npts):
119
- stop = (Npts - 1) * step + start
120
- return linspace_step(start, stop, step)
121
-
122
-
123
- def find_index(x, threshold: Union[Number, List[Number]]) -> List[tuple]:
124
- """find_index finds the index ix such that x(ix) is the closest from threshold
125
-
126
- Parameters
127
- ----------
128
- x : vector
129
- threshold : list of real numbers
130
-
131
- Returns
132
- -------
133
- out : list of 2-tuple containing ix,x[ix]
134
- out=[(ix0,xval0),(ix1,xval1),...]
135
- """
136
-
137
- if not hasattr(threshold, '__iter__'):
138
- threshold = [threshold]
139
- out = []
140
- for value in threshold:
141
- ix = int(np.argmin(np.abs(x - value)))
142
- out.append((ix, x[ix]))
143
- return out
144
-
145
-
146
- def find_common_index(x: Iterable, y: Iterable, x0: Number, y0: Number) -> Tuple:
147
- """find the index in two vectors corresponding to x0 and y0"""
148
- vals = x + 1j * y
149
- val = x0 + 1j * y0
150
- ind = int(np.argmin(np.abs(vals - val)))
151
- return ind, x[ind], y[ind]
152
-
153
-
154
- def gauss1D(x, x0, dx, n=1):
155
- """
156
- compute the gaussian function along a vector x, centered in x0 and with a
157
- FWHM i intensity of dx. n=1 is for the standart gaussian while n>1 defines
158
- a hypergaussian
159
-
160
- Parameters
161
- ----------
162
- x: (ndarray) first axis of the 2D gaussian
163
- x0: (float) the central position of the gaussian
164
- dx: (float) :the FWHM of the gaussian
165
- n=1 : an integer to define hypergaussian, n=1 by default for regular gaussian
166
- Returns
167
- -------
168
- out : vector
169
- the value taken by the gaussian along x axis
170
-
171
- """
172
- if dx <= 0:
173
- raise ValueError('dx should be strictly positive')
174
- if not isinstance(n, int):
175
- raise TypeError('n should be a positive integer')
176
- elif n < 0:
177
- raise ValueError('n should be a positive integer')
178
- out = np.exp(-2 * np.log(2) ** (1 / n) * (((x - x0) / dx)) ** (2 * n))
179
- return out
180
-
181
-
182
- def gauss2D(x, x0, dx, y, y0, dy, n=1, angle=0):
183
- """
184
- compute the 2D gaussian function along a vector x, centered in x0 and with a
185
- FWHM in intensity of dx and smae along y axis. n=1 is for the standard gaussian while n>1 defines
186
- a hypergaussian. optionally rotate it by an angle in degree
187
-
188
- Parameters
189
- ----------
190
- x: (ndarray) first axis of the 2D gaussian
191
- x0: (float) the central position of the gaussian
192
- dx: (float) :the FWHM of the gaussian
193
- y: (ndarray) second axis of the 2D gaussian
194
- y0: (float) the central position of the gaussian
195
- dy: (float) :the FWHM of the gaussian
196
- n=1 : an integer to define hypergaussian, n=1 by default for regular gaussian
197
- angle: (float) a float to rotate main axes, in degree
198
-
199
- Returns
200
- -------
201
- out : ndarray 2 dimensions
202
-
203
- """
204
- if angle == 0:
205
- data = np.transpose(np.outer(gauss1D(x, x0, dx, n), gauss1D(y, y0, dy, n)))
206
-
207
- else:
208
-
209
- theta = np.radians(angle)
210
- c, s = np.cos(theta), np.sin(theta)
211
- R = np.array(((c, -s), (s, c)))
212
- (x0r, y0r) = tuple(R.dot(np.array([x0, y0])))
213
-
214
- data = np.zeros((len(y), len(x)))
215
-
216
- for indx, xtmp in enumerate(x):
217
- for indy, ytmp in enumerate(y):
218
- rotatedvect = R.dot(np.array([xtmp, ytmp]))
219
- data[indy, indx] = gauss1D(rotatedvect[0], x0r, dx, n) * gauss1D(rotatedvect[1], y0r, dy, n)
220
-
221
- return data
222
-
223
-
224
- def rotate2D(origin:tuple = (0,0), point:tuple = (0,0), angle:float = 0):
225
- """
226
- Rotate a point counterclockwise by a given angle around a given origin.
227
-
228
- The angle should be given in radians.
229
- Parameters
230
- ----------
231
- origin: (tuple) x,y coordinate from which to rotate
232
- point: (tuple) x,y coordinate of point to rotate
233
- angle: (float) a float to rotate main axes, in radian
234
-
235
- Returns
236
- -------
237
- out : (tuple) x,y coordinate of rotated point
238
-
239
- """
240
- ox, oy = origin
241
- px, py = point
242
-
243
- qx = ox + np.cos(angle) * (px - ox) - np.sin(angle) * (py - oy)
244
- qy = oy + np.sin(angle) * (px - ox) + np.cos(angle) * (py - oy)
245
- return qx, qy
246
-
247
- def ftAxis(Npts, omega_max):
248
- """
249
- Given two numbers Npts,omega_max, return two vectors spanning the temporal
250
- and spectral range. They are related by Fourier Transform
251
-
252
- Parameters
253
- ----------
254
- Npts: (int)
255
- A number of points defining the length of both grids
256
- omega_max: (float)
257
- The maximum circular frequency in the spectral domain. its unit defines
258
- the temporal units. ex: omega_max in rad/fs implies time_grid in fs
259
-
260
- Returns
261
- -------
262
- omega_grid: (ndarray)
263
- The spectral axis of the FFT
264
- time_grid: (ndarray))
265
- The temporal axis of the FFT
266
- See Also
267
- --------
268
- ftAxis, ftAxis_time, ift, ft2, ift2
269
- """
270
- if not isinstance(Npts, int):
271
- raise TypeError('n should be a positive integer, if possible power of 2')
272
- elif Npts < 1:
273
- raise ValueError('n should be a strictly positive integer')
274
- dT = 2 * np.pi / (2 * omega_max)
275
- omega_grid = np.linspace(-omega_max, omega_max, Npts)
276
- time_grid = dT * np.linspace(-(Npts - 1) / 2, (Npts - 1) / 2, Npts)
277
- return omega_grid, time_grid
278
-
279
-
280
- def ftAxis_time(Npts, time_max):
281
- """
282
- Given two numbers Npts,omega_max, return two vectors spanning the temporal
283
- and spectral range. They are related by Fourier Transform
284
-
285
- Parameters
286
- ----------
287
- Npts : number
288
- A number of points defining the length of both grids
289
- time_max : number
290
- The maximum tmporal window
291
-
292
- Returns
293
- -------
294
- omega_grid : vector
295
- The spectral axis of the FFT
296
- time_grid : vector
297
- The temporal axis of the FFT
298
- See Also
299
- --------
300
- ftAxis, ftAxis_time, ift, ft2, ift2
301
- """
302
- if not isinstance(Npts, int):
303
- raise TypeError('n should be a positive integer, if possible power of 2')
304
- elif Npts < 1:
305
- raise ValueError('n should be a strictly positive integer')
306
- dT = time_max / Npts
307
- omega_max = (Npts - 1) / 2 * 2 * np.pi / time_max
308
- omega_grid = np.linspace(-omega_max, omega_max, Npts)
309
- time_grid = dT * np.linspace(-(Npts - 1) / 2, (Npts - 1) / 2, Npts)
310
- return omega_grid, time_grid
311
-
312
-
313
- def ft(x, dim=-1):
314
- """
315
- Process the 1D fast fourier transform and swaps the axis to get coorect results using ftAxis
316
- Parameters
317
- ----------
318
- x: (ndarray) the array on which the FFT should be done
319
- dim: the axis over which is done the FFT (default is the last of the array)
320
-
321
- Returns
322
- -------
323
- See Also
324
- --------
325
- ftAxis, ftAxis_time, ift, ft2, ift2
326
- """
327
- if not isinstance(dim, int):
328
- raise TypeError('dim should be an integer specifying the array dimension over which to do the calculation')
329
- assert isinstance(x, np.ndarray)
330
- assert dim >= -1
331
- assert dim <= len(x.shape) - 1
332
-
333
- out = np.fft.fftshift(np.fft.fft(np.fft.fftshift(x, axes=dim), axis=dim), axes=dim)
334
- return out
335
-
336
-
337
- def ift(x, dim=0):
338
- """
339
- Process the inverse 1D fast fourier transform and swaps the axis to get correct results using ftAxis
340
- Parameters
341
- ----------
342
- x: (ndarray) the array on which the FFT should be done
343
- dim: the axis over which is done the FFT (default is the last of the array)
344
-
345
- Returns
346
- -------
347
- See Also
348
- --------
349
- ftAxis, ftAxis_time, ift, ft2, ift2
350
- """
351
- if not isinstance(dim, int):
352
- raise TypeError('dim should be an integer specifying the array dimension over which to do the calculation')
353
- assert isinstance(x, np.ndarray)
354
- assert dim >= -1
355
- assert dim <= len(x.shape) - 1
356
- out = np.fft.fftshift(np.fft.ifft(np.fft.fftshift(x, axes=dim), axis=dim), axes=dim)
357
- return out
358
-
359
-
360
- def ft2(x, dim=(-2, -1)):
361
- """
362
- Process the 2D fast fourier transform and swaps the axis to get correct results using ftAxis
363
- Parameters
364
- ----------
365
- x: (ndarray) the array on which the FFT should be done
366
- dim: the axis over which is done the FFT (default is the last of the array)
367
-
368
- Returns
369
- -------
370
- See Also
371
- --------
372
- ftAxis, ftAxis_time, ift, ft2, ift2
373
- """
374
- assert isinstance(x, np.ndarray)
375
- if hasattr(dim, '__iter__'):
376
- for d in dim:
377
- if not isinstance(d, int):
378
- raise TypeError(
379
- 'elements in dim should be an integer specifying the array dimension over which to do the calculation')
380
- assert d <= len(x.shape)
381
- else:
382
- if not isinstance(dim, int):
383
- raise TypeError(
384
- 'elements in dim should be an integer specifying the array dimension over which to do the calculation')
385
- assert dim <= len(x.shape)
386
- out = np.fft.fftshift(np.fft.fft2(np.fft.fftshift(x, axes=dim)), axes=dim)
387
- return out
388
-
389
-
390
- def ift2(x, dim=(-2, -1)):
391
- """
392
- Process the inverse 2D fast fourier transform and swaps the axis to get correct results using ftAxis
393
- Parameters
394
- ----------
395
- x: (ndarray) the array on which the FFT should be done
396
- dim: the axis (or a tuple of axes) over which is done the FFT (default is the last of the array)
397
-
398
- Returns
399
- -------
400
- See Also
401
- --------
402
- ftAxis, ftAxis_time, ift, ft2, ift2
403
- """
404
- assert isinstance(x, np.ndarray)
405
- if hasattr(dim, '__iter__'):
406
- for d in dim:
407
- if not isinstance(d, int):
408
- raise TypeError(
409
- 'elements in dim should be an integer specifying the array dimension over which to do the calculation')
410
- assert d <= len(x.shape)
411
- else:
412
- if not isinstance(dim, int):
413
- raise TypeError(
414
- 'elements in dim should be an integer specifying the array dimension over which to do the calculation')
415
- assert dim <= len(x.shape)
416
- out = np.fft.fftshift(np.fft.ifft2(np.fft.fftshift(x, axes=dim)), axes=dim)
417
- return out
418
-
419
-
420
- def flatten(xs):
421
- """Flatten nested list"""
422
- for x in xs:
423
- if isinstance(x, Iterable) and not isinstance(x, (str, bytes)):
424
- yield from flatten(x)
425
- else:
426
- yield x
427
-
428
- class LSqEllipse:
429
-
430
- def fit(self, data):
431
- """Lest Squares fitting algorithm
432
-
433
- Theory taken from (*)
434
- Solving equation Sa=lCa. with a = |a b c d f g> and a1 = |a b c>
435
- a2 = |d f g>
436
-
437
- Args
438
- ----
439
- data (list:list:float): list of two lists containing the x and y data of the
440
- ellipse. of the form [[x1, x2, ..., xi],[y1, y2, ..., yi]]
441
-
442
- Returns
443
- ------
444
- coef (list): list of the coefficients describing an ellipse
445
- [a,b,c,d,f,g] corresponding to ax**2+2bxy+cy**2+2dx+2fy+g
446
- """
447
- x, y = numpy.asarray(data, dtype=float)
448
-
449
- # Quadratic part of design matrix [eqn. 15] from (*)
450
- D1 = numpy.mat(numpy.vstack([x ** 2, x * y, y ** 2])).T
451
- # Linear part of design matrix [eqn. 16] from (*)
452
- D2 = numpy.mat(numpy.vstack([x, y, numpy.ones(len(x))])).T
453
-
454
- # forming scatter matrix [eqn. 17] from (*)
455
- S1 = D1.T * D1
456
- S2 = D1.T * D2
457
- S3 = D2.T * D2
458
-
459
- # Constraint matrix [eqn. 18]
460
- C1 = numpy.mat('0. 0. 2.; 0. -1. 0.; 2. 0. 0.')
461
-
462
- # Reduced scatter matrix [eqn. 29]
463
- M = C1.I * (S1 - S2 * S3.I * S2.T)
464
-
465
- # M*|a b c >=l|a b c >. Find eigenvalues and eigenvectors from this equation [eqn. 28]
466
- eval, evec = numpy.linalg.eig(M)
467
-
468
- # eigenvector must meet constraint 4ac - b^2 to be valid.
469
- cond = 4 * numpy.multiply(evec[0, :], evec[2, :]) - numpy.power(evec[1, :], 2)
470
- a1 = evec[:, numpy.nonzero(cond.A > 0)[1]]
471
-
472
- # |d f g> = -S3^(-1)*S2^(T)*|a b c> [eqn. 24]
473
- a2 = -S3.I * S2.T * a1
474
-
475
- # eigenvectors |a b c d f g>
476
- self.coef = numpy.vstack([a1, a2])
477
- self._save_parameters()
478
-
479
- def _save_parameters(self):
480
- """finds the important parameters of the fitted ellipse
481
-
482
- Theory taken form http://mathworld.wolfram
483
-
484
- Args
485
- -----
486
- coef (list): list of the coefficients describing an ellipse
487
- [a,b,c,d,f,g] corresponding to ax**2+2bxy+cy**2+2dx+2fy+g
488
-
489
- Returns
490
- _______
491
- center (List): of the form [x0, y0]
492
- width (float): major axis
493
- height (float): minor axis
494
- phi (float): rotation of major axis form the x-axis in radians
495
- """
496
-
497
- # eigenvectors are the coefficients of an ellipse in general form
498
- # a*x^2 + 2*b*x*y + c*y^2 + 2*d*x + 2*f*y + g = 0 [eqn. 15) from (**) or (***)
499
- a = self.coef[0, 0]
500
- b = self.coef[1, 0] / 2.
501
- c = self.coef[2, 0]
502
- d = self.coef[3, 0] / 2.
503
- f = self.coef[4, 0] / 2.
504
- g = self.coef[5, 0]
505
-
506
- # finding center of ellipse [eqn.19 and 20] from (**)
507
- x0 = (c * d - b * f) / (b ** 2. - a * c)
508
- y0 = (a * f - b * d) / (b ** 2. - a * c)
509
-
510
- # Find the semi-axes lengths [eqn. 21 and 22] from (**)
511
- numerator = 2 * (a * f * f + c * d * d + g * b * b - 2 * b * d * f - a * c * g)
512
- denominator1 = (b * b - a * c) * ((c - a) * numpy.sqrt(1 + 4 * b * b / ((a - c) * (a - c))) - (c + a))
513
- denominator2 = (b * b - a * c) * ((a - c) * numpy.sqrt(1 + 4 * b * b / ((a - c) * (a - c))) - (c + a))
514
- width = numpy.sqrt(numerator / denominator1)
515
- height = numpy.sqrt(numerator / denominator2)
516
-
517
- # angle of counterclockwise rotation of major-axis of ellipse to x-axis [eqn. 23] from (**)
518
- # or [eqn. 26] from (***).
519
- phi = .5 * numpy.arctan((2. * b) / (a - c))
520
-
521
- self._center = [x0, y0]
522
- self._width = width
523
- self._height = height
524
- self._phi = phi
525
-
526
- @property
527
- def center(self):
528
- return self._center
529
-
530
- @property
531
- def width(self):
532
- return self._width
533
-
534
- @property
535
- def height(self):
536
- return self._height
537
-
538
- @property
539
- def phi(self):
540
- """angle of counterclockwise rotation of major-axis of ellipse to x-axis
541
- [eqn. 23] from (**)
542
- """
543
- return self._phi
544
-
545
- def parameters(self):
546
- return self.center, self.width, self.height, self.phi
547
-
548
-
549
- def make_test_ellipse(center=[1, 1], width=1, height=.6, phi=3.14 / 5):
550
- """Generate Elliptical data with noise
551
-
552
- Args
553
- ----
554
- center (list:float): (<x_location>, <y_location>)
555
- width (float): semimajor axis. Horizontal dimension of the ellipse (**)
556
- height (float): semiminor axis. Vertical dimension of the ellipse (**)
557
- phi (float:radians): tilt of the ellipse, the angle the semimajor axis
558
- makes with the x-axis
559
-
560
- Returns
561
- -------
562
- data (list:list:float): list of two lists containing the x and y data of the
563
- ellipse. of the form [[x1, x2, ..., xi],[y1, y2, ..., yi]]
564
- """
565
- t = numpy.linspace(0, 2 * numpy.pi, 1000)
566
- x_noise, y_noise = numpy.random.rand(2, len(t))
567
-
568
- ellipse_x = center[0] + width * numpy.cos(t) * numpy.cos(phi) - height * numpy.sin(t) * numpy.sin(
569
- phi) + x_noise / 2.
570
- ellipse_y = center[1] + width * numpy.cos(t) * numpy.sin(phi) + height * numpy.sin(t) * numpy.cos(
571
- phi) + y_noise / 2.
572
-
573
- return [ellipse_x, ellipse_y]
3
+ from pymodaq_utils.warnings import deprecation_msg
574
4
 
5
+ deprecation_msg('Importing math_utils stuff from pymodaq is deprecated in pymodaq>5.0.0,'
6
+ 'please use the pymodaq_utils.math_utils module')
@@ -1,13 +1,6 @@
1
- from qtpy import QtWidgets
1
+ from pymodaq_gui.parameter import Parameter, ParameterTree, utils, ioxml, pymodaq_ptypes
2
2
 
3
- from pyqtgraph.parametertree import parameterTypes, Parameter, ParameterTree
4
- from . import pymodaq_ptypes
3
+ from pymodaq_utils.warnings import deprecation_msg
5
4
 
6
-
7
- class ParameterTree(ParameterTree):
8
- def __init__(self, *args, **kwargs):
9
- super().__init__(*args, **kwargs)
10
-
11
- self.header().setVisible(True)
12
- self.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Interactive)
13
- self.header().setMinimumSectionSize(150)
5
+ deprecation_msg('Importing Parameter stuff from pymodaq is deprecated in pymodaq>5.0.0,'
6
+ 'please use the pymodaq_gui package')