pymodaq 4.2.4__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 +28 -12
  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 +164 -115
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +6 -6
  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 -708
  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.4.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. pymodaq/post_treatment/process_to_scalar.py +0 -263
  78. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  311. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  312. pymodaq/resources/VERSION +0 -1
  313. pymodaq/resources/config_template.toml +0 -94
  314. pymodaq/resources/triangulation_data.npy +0 -0
  315. pymodaq/utils/abstract/__init__.py +0 -48
  316. pymodaq/utils/db/__init__.py +0 -0
  317. pymodaq/utils/db/db_logger/__init__.py +0 -0
  318. pymodaq/utils/enums.py +0 -76
  319. pymodaq/utils/factory.py +0 -82
  320. pymodaq/utils/gui_utils/custom_app.py +0 -133
  321. pymodaq/utils/gui_utils/dock.py +0 -107
  322. pymodaq/utils/gui_utils/file_io.py +0 -93
  323. pymodaq/utils/gui_utils/layout.py +0 -34
  324. pymodaq/utils/gui_utils/list_picker.py +0 -38
  325. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  326. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  327. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  328. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  329. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  330. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  331. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  332. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  333. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  334. pymodaq/utils/h5modules/backends.py +0 -1022
  335. pymodaq/utils/h5modules/browsing.py +0 -625
  336. pymodaq/utils/h5modules/data_saving.py +0 -1105
  337. pymodaq/utils/h5modules/exporter.py +0 -119
  338. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  339. pymodaq/utils/h5modules/exporters/base.py +0 -111
  340. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  341. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  342. pymodaq/utils/h5modules/saving.py +0 -866
  343. pymodaq/utils/h5modules/utils.py +0 -115
  344. pymodaq/utils/managers/action_manager.py +0 -489
  345. pymodaq/utils/managers/parameter_manager.py +0 -282
  346. pymodaq/utils/managers/roi_manager.py +0 -726
  347. pymodaq/utils/messenger.py +0 -66
  348. pymodaq/utils/parameter/ioxml.py +0 -542
  349. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  350. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  351. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  352. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  353. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  354. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  355. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  356. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  357. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  358. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  359. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  360. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  361. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  362. pymodaq/utils/plotting/__init__.py +0 -0
  363. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  364. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  365. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  366. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  367. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -826
  368. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  369. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  370. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  371. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  372. pymodaq/utils/plotting/gant_chart.py +0 -123
  373. pymodaq/utils/plotting/image_viewer.py +0 -97
  374. pymodaq/utils/plotting/items/__init__.py +0 -0
  375. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  376. pymodaq/utils/plotting/items/crosshair.py +0 -94
  377. pymodaq/utils/plotting/items/image.py +0 -388
  378. pymodaq/utils/plotting/navigator.py +0 -353
  379. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  380. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  381. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  382. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  383. pymodaq/utils/plotting/utils/__init__.py +0 -0
  384. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  385. pymodaq/utils/plotting/utils/filter.py +0 -585
  386. pymodaq/utils/plotting/utils/lineout.py +0 -226
  387. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  388. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  389. pymodaq/utils/plotting/widgets.py +0 -76
  390. pymodaq/utils/qvariant.py +0 -12
  391. pymodaq/utils/slicing.py +0 -63
  392. pymodaq/utils/units.py +0 -216
  393. pymodaq-4.2.4.dist-info/RECORD +0 -438
  394. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  395. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  396. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  397. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +0 -0
  398. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,37 +1,15 @@
1
- import os
2
- import sys
3
- import datetime
1
+
4
2
  import importlib
5
- import inspect
6
- import json
7
- import functools
8
- import platform
9
- import re
10
- import time
11
- import warnings
12
3
  from packaging import version as version_mod
13
- from pathlib import Path
14
4
  import pkgutil
15
- import traceback
16
5
  import platform
17
- from typing import Union, List
18
- from typing import Iterable as IterableType
19
- from collections.abc import Iterable
20
-
21
- import numpy as np
22
- from qtpy import QtCore
23
- from qtpy.QtCore import QLocale
6
+ from pathlib import Path
24
7
 
25
- from pymodaq.utils import logger as logger_module
26
- from pymodaq.utils.config import get_set_preset_path, Config
27
- from pymodaq.utils.messenger import deprecation_msg
28
- from pymodaq.utils.qvariant import QVariant
8
+ from pymodaq_utils import logger as logger_module
9
+ from pymodaq_utils.config import Config
10
+ from pymodaq_utils.utils import get_entrypoints, ThreadCommand, getLineInfo
29
11
 
30
- if version_mod.parse(platform.python_version()) >= version_mod.parse('3.8'): # from version 3.8 this feature is included in the
31
- # standard lib
32
- from importlib import metadata
33
- else:
34
- import importlib_metadata as metadata
12
+ from pymodaq.utils.config import get_set_preset_path
35
13
 
36
14
  if version_mod.parse(platform.python_version()) >= version_mod.parse('3.9'):
37
15
  # from version 3.9 the cache decorator is available
@@ -45,84 +23,6 @@ logger = logger_module.set_logger(logger_module.get_module_name(__file__))
45
23
  config = Config()
46
24
 
47
25
 
48
- class PlotColors:
49
-
50
- def __init__(self, colors=config('plotting', 'plot_colors')[:]):
51
-
52
- self._internal_counter = -1
53
-
54
- self.check_colors(colors)
55
- self._plot_colors = list(colors)
56
-
57
- def __getitem__(self, item: int):
58
- if not isinstance(item, int):
59
- raise TypeError('getter should be an integer')
60
- return tuple(self._plot_colors[item % len(self._plot_colors)])
61
-
62
- def __len__(self):
63
- return len(self._plot_colors)
64
-
65
- def __iter__(self):
66
- self._internal_counter = -1
67
- return self
68
-
69
- def __next__(self):
70
- if self._internal_counter >= len(self) - 1:
71
- raise StopIteration
72
- self._internal_counter += 1
73
- return self[self._internal_counter]
74
-
75
- def check_colors(self, colors: IterableType):
76
- if not isinstance(colors, Iterable):
77
- raise TypeError('Colors should be a list of 3-tuple 8 bits integer (0-255)')
78
- for color in colors:
79
- self.check_color(color)
80
-
81
- @staticmethod
82
- def check_color(color: IterableType):
83
- if not isinstance(color, Iterable) and len(color) != 3:
84
- raise TypeError('Colors should be a list of 3-tuple 8 bits integer (0-255)')
85
- for col_val in color:
86
- if not (isinstance(col_val, int) and 0 <= col_val <= 255):
87
- raise TypeError('Colors should be a list of 3-tuple 8 bits integer (0-255)')
88
-
89
-
90
- plot_colors = PlotColors()
91
-
92
-
93
- def is_64bits():
94
- return sys.maxsize > 2**32
95
-
96
-
97
- def timer(func):
98
- """Print the runtime of the decorated function"""
99
- @functools.wraps(func)
100
- def wrapper_timer(*args, **kwargs):
101
- start_time = time.perf_counter() # 1
102
- value = func(*args, **kwargs)
103
- end_time = time.perf_counter() # 2
104
- run_time = end_time - start_time # 3
105
- print(f"Finished {func.__name__!r} in {run_time:.4f} secs")
106
- return value
107
- return wrapper_timer
108
-
109
-
110
- def get_version():
111
- """Obtain pymodaq version from the VERSION file
112
-
113
- Follows the layout from the packaging tool hatch, hatchling
114
- """
115
- DEFAULT_PATTERN = r'(?i)^(__version__|VERSION) *= *([\'"])v?(?P<version>.+?)\2'
116
-
117
- with open(str(Path(__file__).parent.parent.joinpath('resources/VERSION')), 'r') as fvers:
118
- contents = fvers.read().strip()
119
- match = re.search(DEFAULT_PATTERN, contents, flags=re.MULTILINE)
120
- groups = match.groupdict()
121
- if 'version' not in groups:
122
- raise ValueError('no group named `version` was defined in the pattern')
123
- return groups['version']
124
-
125
-
126
26
  def copy_preset(): # pragma: no cover
127
27
  path = get_set_preset_path().joinpath('preset_default.xml')
128
28
  if not path.exists(): # copy the preset_default from pymodaq folder and create one in pymodad's local folder
@@ -130,469 +30,6 @@ def copy_preset(): # pragma: no cover
130
30
  path.write_text(file.read())
131
31
 
132
32
 
133
- def set_qt_backend():
134
- backend_present = True
135
- if config('qtbackend', 'backend').lower() not in [mod.lower() for mod in sys.modules]:
136
- backend_present = False
137
- logger.warning(f"The chosen Qt backend ({config('qtbackend', 'backend')}) has not been installed...\n"
138
- f"Trying another...")
139
- backends = config('qtbackend', 'backends')
140
- backends.pop(config('qtbackend', 'backend'))
141
- for backend in backends:
142
- if backend.lower() in [mod.lower() for mod in sys.modules]:
143
- backend_present = True
144
- break
145
-
146
- if backend_present:
147
- os.environ['QT_API'] = config('qtbackend', 'backend')
148
- logger.info('************************')
149
- logger.info(f"{config('qtbackend', 'backend')} Qt backend loaded")
150
- logger.info('************************')
151
- else:
152
- msg = f"No Qt backend could be found in your system, please install either pyqt5/6 or pyside2/6." \
153
- f"pyqt5 is still preferred, while pyqt6 should mostly work."
154
- logger.critical(msg)
155
- warnings.warn(msg, FutureWarning, 3)
156
- print(msg.upper())
157
-
158
-
159
- class JsonConverter:
160
- def __init__(self):
161
- super().__init__()
162
-
163
- @classmethod
164
- def trusted_types(cls):
165
- return ['float', 'int', 'str', 'datetime', 'date', 'time', 'tuple', 'list', 'bool', 'bytes',
166
- 'float64']
167
-
168
- @classmethod
169
- def istrusted(cls, type_name):
170
- return type_name in cls.trusted_types()
171
-
172
- @classmethod
173
- def object2json(cls, obj):
174
- dic = dict(module=type(obj).__module__, type=type(obj).__name__, data=repr(obj))
175
- return json.dumps(dic)
176
-
177
- @classmethod
178
- def json2object(cls, jsonstring):
179
- try:
180
- dic = json.loads(jsonstring)
181
- if isinstance(dic, dict):
182
- if dic['type'] in cls.trusted_types():
183
- return eval(dic['data'])
184
- else:
185
- return dic
186
- else: # pragma: no cover
187
- return dic
188
- except Exception:
189
- return jsonstring
190
-
191
-
192
- def decode_data(encoded_data):
193
- """
194
- Decode QbyteArrayData generated when drop items in table/tree/list view
195
- Parameters
196
- ----------
197
- encoded_data: QByteArray
198
- Encoded data of the mime data to be dropped
199
- Returns
200
- -------
201
- data: list
202
- list of dict whose key is the QtRole in the Model, and the value a QVariant
203
-
204
- """
205
- data = []
206
-
207
- ds = QtCore.QDataStream(encoded_data, QtCore.QIODevice.ReadOnly)
208
- while not ds.atEnd():
209
- row = ds.readInt32()
210
- col = ds.readInt32()
211
-
212
- map_items = ds.readInt32()
213
- item = {}
214
- for ind in range(map_items):
215
- key = ds.readInt32()
216
- #TODO check this is fine
217
- value = QVariant()
218
- #value = None
219
- ds >> value
220
- item[QtCore.Qt.ItemDataRole(key)] = value.value()
221
- data.append(item)
222
- return data
223
-
224
-
225
- #############################
226
-
227
- def capitalize(string, Nfirst=1):
228
- """
229
- Returns same string but with first Nfirst letters upper
230
- Parameters
231
- ----------
232
- string: (str)
233
- Nfirst: (int)
234
- Returns
235
- -------
236
- str
237
- """
238
- return string[:Nfirst].upper() + string[Nfirst:]
239
-
240
-
241
- def uncapitalize(string, Nfirst=1):
242
- return string[:Nfirst].lower() + string[Nfirst:]
243
-
244
-
245
- def getLineInfo():
246
- """get information about where the Exception has been triggered"""
247
- tb = sys.exc_info()[2]
248
- res = ''
249
- for t in traceback.format_tb(tb):
250
- res += t
251
- return res
252
-
253
-
254
- class ThreadCommand:
255
- """Generic object to pass info (command) and data (attribute) between thread or objects using signals
256
-
257
- Parameters
258
- ----------
259
- command: str
260
- The command to be analysed for further action
261
- attribute: any type
262
- the attribute related to the command. The actual type and value depend on the command and the situation
263
- attributes: deprecated, attribute should be used instead
264
-
265
- Attributes
266
- ----------
267
- command : str
268
- The command to be analysed for further action
269
- attribute : any type
270
- the attribute related to the command. The actual type and value depend on the command and the situation
271
- """
272
-
273
- def __init__(self, command: str, attribute=None, attributes=None):
274
- if not isinstance(command, str):
275
- raise TypeError(f'The command in a Threadcommand object should be a string, not a {type(command)}')
276
- self.command = command
277
- if attribute is None and attributes is not None:
278
- deprecation_msg('ThreadCommand signature changed, use attribute in place of attributes')
279
- self.attribute = attributes
280
- self.attributes = attributes
281
- self.attribute = attribute
282
-
283
- def __repr__(self):
284
- return f'Threadcommand: {self.command} with attribute {self.attribute}'
285
-
286
-
287
- def ensure_ndarray(data):
288
- """
289
- Make sure data is returned as a numpy array
290
- Parameters
291
- ----------
292
- data
293
-
294
- Returns
295
- -------
296
- ndarray
297
- """
298
- if not isinstance(data, np.ndarray):
299
- if isinstance(data, list):
300
- data = np.array(data)
301
- else:
302
- data = np.array([data])
303
- return data
304
-
305
-
306
- def setLocale():
307
- """
308
- defines the Locale to use to convert numbers to strings representation using language/country conventions
309
- Default is English and US
310
- """
311
- language = getattr(QLocale, config('style', 'language'))
312
- country = getattr(QLocale, config('style', 'country'))
313
- QLocale.setDefault(QLocale(language, country))
314
-
315
-
316
- def recursive_find_files_extension(ini_path, ext, paths=[]):
317
- with os.scandir(ini_path) as it:
318
- for entry in it:
319
- if os.path.splitext(entry.name)[1][1:] == ext and entry.is_file():
320
- paths.append(entry.path)
321
- elif entry.is_dir():
322
- recursive_find_files_extension(entry.path, ext, paths)
323
- return paths
324
-
325
-
326
- def recursive_find_files(ini_path, exp='make_enum', paths=[],
327
- filters=['build']):
328
- for child in Path(ini_path).iterdir():
329
- if child.is_dir():
330
- recursive_find_files(child, exp, paths, filters)
331
- else:
332
- if exp in child.stem:
333
- if not any([filt in str(child) for filt in filters]):
334
- paths.append(child)
335
- return paths
336
-
337
-
338
- def recursive_find_expr_in_files(ini_path, exp='make_enum', paths=[],
339
- filters=['.git', '.idea', '__pycache__', 'build', 'egg', 'documentation', '.tox'],
340
- replace=False, replace_str=''):
341
-
342
- for child in Path(ini_path).iterdir():
343
- if not any(filt in str(child) for filt in filters):
344
- if child.is_dir():
345
- recursive_find_expr_in_files(child, exp, paths, filters, replace=replace, replace_str=replace_str)
346
- else:
347
- try:
348
- found = False
349
- with child.open('r') as f:
350
- replacement = ''
351
- for ind, line in enumerate(f):
352
- if exp in line:
353
- found = True
354
- paths.append([child, ind, line])
355
- if replace:
356
- replacement += line.replace(exp, replace_str)
357
- else:
358
- if replace:
359
- replacement += line
360
- if replace and found:
361
- with child.open('w') as f:
362
- f.write(replacement)
363
- except Exception:
364
- pass
365
- return paths
366
-
367
-
368
- def count_lines(ini_path, count=0, filters=['lextab', 'yacctab','pycache', 'pyc']):
369
- # if Path(ini_path).is_file():
370
- # with Path(ini_path).open('r') as f:
371
- # count += len(f.readlines())
372
- # return count
373
- for child in Path(ini_path).iterdir():
374
- if child.is_dir():
375
- count = count_lines(child, count)
376
- else:
377
- try:
378
- if not any([filt in child.name for filt in filters]):
379
- if '.py' in child.name:
380
- with child.open('r') as f:
381
- count += len(f.readlines())
382
- else:
383
- print(child.stem)
384
- except Exception:
385
- pass
386
- return count
387
-
388
-
389
- def remove_spaces(string):
390
- """
391
- return a string without any white spaces in it
392
- Parameters
393
- ----------
394
- string
395
-
396
- Returns
397
- -------
398
-
399
- """
400
- return ''.join(string.split())
401
-
402
-
403
- def rint(x):
404
- """
405
- almost same as numpy rint function but return an integer
406
- Parameters
407
- ----------
408
- x: (float or integer)
409
-
410
- Returns
411
- -------
412
- nearest integer
413
- """
414
- return int(np.rint(x))
415
-
416
-
417
- def elt_as_first_element(elt_list, match_word='Mock'):
418
- if not hasattr(elt_list, '__iter__'):
419
- raise TypeError('elt_list must be an iterable')
420
- if elt_list:
421
- ind_elt = 0
422
- for ind, elt in enumerate(elt_list):
423
- if not isinstance(elt, str):
424
- raise TypeError('elt_list must be a list of str')
425
- if match_word in elt:
426
- ind_elt = ind
427
- break
428
- plugin_match = elt_list[ind_elt]
429
- elt_list.remove(plugin_match)
430
- plugins = [plugin_match]
431
- plugins.extend(elt_list)
432
- else:
433
- plugins = []
434
- return plugins
435
-
436
-
437
- def elt_as_first_element_dicts(elt_list, match_word='Mock', key='name'):
438
- if not hasattr(elt_list, '__iter__'):
439
- raise TypeError('elt_list must be an iterable')
440
- if elt_list:
441
- ind_elt = 0
442
- for ind, elt in enumerate(elt_list):
443
- if not isinstance(elt, dict):
444
- raise TypeError('elt_list must be a list of dicts')
445
- if match_word in elt[key]:
446
- ind_elt = ind
447
- break
448
- plugin_match = elt_list[ind_elt]
449
- elt_list.remove(plugin_match)
450
- plugins = [plugin_match]
451
- plugins.extend(elt_list)
452
- else:
453
- plugins = []
454
- return plugins
455
-
456
-
457
- def find_keys_from_val(dict_tmp: dict, val: object):
458
- """Returns the keys from a dict if its value is matching val"""
459
- return [k for k, v in dict_tmp.items() if v == val]
460
-
461
-
462
- def find_object_if_matched_attr_name_val(obj, attr_name, attr_value):
463
- """check if an attribute key/value pair match in a given object
464
-
465
- Parameters
466
- ----------
467
- obj: object
468
- attr_name: str
469
- attribute name to look for in the object
470
- attr_value: object
471
- value to match
472
-
473
- Returns
474
- -------
475
- bool: True if the key/value pair has been found in dict_tmp
476
-
477
- """
478
- if hasattr(obj, attr_name):
479
- if getattr(obj, attr_name) == attr_value:
480
- return True
481
- return False
482
-
483
-
484
- def find_objects_in_list_from_attr_name_val(objects: List[object], attr_name: str,
485
- attr_value: object, return_first=True):
486
- """ lookup within a list of objects. Look for the objects within the list which has the correct attribute name,
487
- value pair
488
-
489
- Parameters
490
- ----------
491
- objects: list
492
- list of objects
493
- attr_name: str
494
- attribute name to look for in the object
495
- attr_value: object
496
- value to match
497
- return_first: bool
498
- if True return the first objects found in the list else all the objects matching
499
-
500
- Returns
501
- -------
502
- list of tuple(object, int): object and index or list of object and indexes
503
- """
504
- selection = []
505
- obj = None
506
- for ind, obj_tmp in enumerate(objects):
507
- if find_object_if_matched_attr_name_val(obj_tmp, attr_name, attr_value):
508
- obj = obj_tmp
509
- if return_first:
510
- break
511
- else:
512
- selection.append((obj_tmp, ind))
513
-
514
- if obj is None:
515
- if return_first:
516
- return None, -1
517
- else:
518
- return []
519
- else:
520
- if return_first:
521
- return obj, ind
522
- else:
523
- return selection
524
-
525
-
526
- def find_dict_if_matched_key_val(dict_tmp, key, value):
527
- """
528
- check if a key/value pair match in a given dictionnary
529
- Parameters
530
- ----------
531
- dict_tmp: (dict) the dictionnary to be tested
532
- key: (str) a key string to look for in dict_tmp
533
- value: (object) any python object
534
-
535
- Returns
536
- -------
537
- bool: True if the key/value pair has been found in dict_tmp
538
-
539
- """
540
- if key in dict_tmp:
541
- if dict_tmp[key] == value:
542
- return True
543
- return False
544
-
545
-
546
- def find_dict_in_list_from_key_val(dicts, key, value, return_index=False):
547
- """ lookup within a list of dicts. Look for the dict within the list which has the correct key, value pair
548
-
549
- Parameters
550
- ----------
551
- dicts: (list) list of dictionnaries
552
- key: (str) specific key to look for in each dict
553
- value: value to match
554
-
555
- Returns
556
- -------
557
- dict: if found otherwise returns None
558
- """
559
- for ind, dict_tmp in enumerate(dicts):
560
- if find_dict_if_matched_key_val(dict_tmp, key, value):
561
- if return_index:
562
- return dict_tmp, ind
563
- else:
564
- return dict_tmp
565
- if return_index:
566
- return None, -1
567
- else:
568
- return None
569
-
570
-
571
- def get_entrypoints(group='pymodaq.plugins') -> List[metadata.EntryPoint]:
572
- """ Get the list of modules defined from a group entry point
573
-
574
- Because of evolution in the package, one or another of the forms below may be deprecated.
575
- We start from the newer way down to the older
576
-
577
- Parameters
578
- ----------
579
- group: str
580
- the name of the group
581
- """
582
- try:
583
- discovered_entrypoints = metadata.entry_points(group=group)
584
- except TypeError:
585
- try:
586
- discovered_entrypoints = metadata.entry_points().select(group=group)
587
- except AttributeError:
588
- discovered_entrypoints = metadata.entry_points().get(group, [])
589
- if isinstance(discovered_entrypoints, tuple): # API for python > 3.8
590
- discovered_entrypoints = list(discovered_entrypoints)
591
- if not isinstance(discovered_entrypoints, list):
592
- discovered_entrypoints = list(discovered_entrypoints)
593
- return discovered_entrypoints
594
-
595
-
596
33
  @cache
597
34
  def get_instrument_plugins(): # pragma: no cover
598
35
  """
@@ -702,142 +139,3 @@ def get_plugins(plugin_type='daq_0Dviewer'): # pragma: no cover
702
139
  """
703
140
  return [plug for plug in get_instrument_plugins() if plug['type'] == plugin_type]
704
141
 
705
-
706
- def check_vals_in_iterable(iterable1, iterable2):
707
- assert len(iterable1) == len(iterable2)
708
- iterable1 = list(iterable1) # so the assertion below is valid for any kind of iterable, list, tuple, ndarray...
709
- iterable2 = list(iterable2)
710
- for val1, val2 in zip(iterable1, iterable2):
711
- assert val1 == val2
712
-
713
-
714
- def caller_name(skip=2):
715
- """Get a name of a caller in the format module.class.method
716
-
717
- `skip` specifies how many levels of stack to skip while getting caller
718
- name. skip=1 means "who calls me", skip=2 "who calls my caller" etc.
719
-
720
- An empty string is returned if skipped levels exceed stack height
721
- """
722
- stack = inspect.stack()
723
- start = 0 + skip
724
- if len(stack) < start + 1:
725
- return ''
726
- parentframe = stack[start][0]
727
-
728
- name = []
729
- module = inspect.getmodule(parentframe)
730
- # `modname` can be None when frame is executed directly in console
731
- # TODO(techtonik): consider using __main__
732
- if module:
733
- name.append(module.__name__)
734
- # detect classname
735
- if 'self' in parentframe.f_locals:
736
- # I don't know any way to detect call from the object method
737
- # XXX: there seems to be no way to detect static method call - it will
738
- # be just a function call
739
- name.append(parentframe.f_locals['self'].__class__.__name__)
740
- codename = parentframe.f_code.co_name
741
- if codename != '<module>': # top level usually
742
- name.append(codename) # function or a method
743
- del parentframe
744
- return ".".join(name)
745
-
746
-
747
- def zeros_aligned(n, align, dtype=np.uint32):
748
- """
749
- Get aligned memory array wih alignment align.
750
- Parameters
751
- ----------
752
- n: (int) length in dtype bytes of memory
753
- align: (int) memory alignment
754
- dtype: (numpy.dtype) type of the stored memory elements
755
-
756
- Returns
757
- -------
758
-
759
- """
760
- dtype = np.dtype(dtype)
761
- nbytes = n * dtype.itemsize
762
- buff = np.zeros(nbytes + align, dtype=np.uint8)
763
- start_index = -buff.ctypes.data % align
764
- return buff[start_index:start_index + nbytes].view(dtype)
765
-
766
-
767
- # ########################
768
- # #File management
769
-
770
- def get_new_file_name(base_path=Path(config('data_saving', 'h5file', 'save_path')), base_name='tttr_data'):
771
- if isinstance(base_path, str):
772
- base_path = Path(base_path)
773
-
774
- today = datetime.datetime.now()
775
-
776
- date = today.strftime('%Y%m%d')
777
- year = today.strftime('%Y')
778
- year_dir = base_path.joinpath(year)
779
- if not year_dir.is_dir():
780
- year_dir.mkdir()
781
- curr_dir = base_path.joinpath(year, date)
782
- if not curr_dir.is_dir():
783
- curr_dir.mkdir()
784
-
785
- files = []
786
- for entry in curr_dir.iterdir():
787
- if entry.name.startswith(base_name) and entry.is_file():
788
- files.append(entry.stem)
789
- files.sort()
790
- if not files:
791
- index = 0
792
- else:
793
- index = int(files[-1][-3:]) + 1
794
-
795
- file = f'{base_name}_{index:03d}'
796
- return file, curr_dir
797
-
798
-
799
- if __name__ == '__main__':
800
- #paths = recursive_find_expr_in_files('C:\\Users\\weber\\Labo\\Programmes Python\\PyMoDAQ_Git', 'visa')
801
- # for p in paths:
802
- # print(str(p))
803
- # v = get_version()
804
- # pass
805
- #plugins = get_plugins() # pragma: no cover
806
- #extensions = get_extension()
807
- #models = get_models()
808
- #count = count_lines('C:\\Users\\weber\\Labo\\Programmes Python\\PyMoDAQ_Git\\pymodaq\src')
809
-
810
-
811
- # import license
812
- # mit = license.find('MIT')
813
- #
814
-
815
- # paths = recursive_find_expr_in_files(r'C:\Users\weber\Labo\Programmes Python\PyMoDAQ_Git',
816
- # exp="cfunc",
817
- # paths=[],
818
- # filters=['.git', '.idea', '__pycache__', 'build', 'egg', 'documentation',
819
- # '.tox',],
820
- # replace=False,
821
- # replace_str="pymodaq.utils")
822
-
823
- #get_version()
824
- get_instrument_plugins()
825
- #get_plugins('daq_move')
826
- #get_plugins('daq_0Dviewer')
827
- pass
828
-
829
- # paths = recursive_find_files('C:\\Users\\weber\\Labo\\Programmes Python\\PyMoDAQ_Git',
830
- # exp='VERSION', paths=[])
831
- # import version
832
- # for file in paths:
833
- # with open(str(file), 'r') as f:
834
- # v = version.Version(f.read())
835
- # v.minor += 1
836
- # v.patch = 0
837
- # with open(str(file), 'w') as f:
838
- # f.write(str(v))
839
-
840
- # for file in paths:
841
- # with open(str(file), 'w') as f:
842
- # f.write(mit.render(name='Sebastien Weber', email='sebastien.weber@cemes.fr'))
843
-