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