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.
- pymodaq/__init__.py +57 -91
- pymodaq/control_modules/daq_move.py +64 -46
- pymodaq/control_modules/daq_move_ui.py +34 -12
- pymodaq/control_modules/daq_viewer.py +55 -30
- pymodaq/control_modules/daq_viewer_ui.py +6 -6
- pymodaq/control_modules/mocks.py +1 -1
- pymodaq/control_modules/move_utility_classes.py +51 -43
- pymodaq/control_modules/utils.py +43 -20
- pymodaq/control_modules/viewer_utility_classes.py +54 -18
- pymodaq/daq_utils/daq_utils.py +6 -0
- pymodaq/dashboard.py +639 -323
- pymodaq/examples/function_plotter.py +13 -12
- pymodaq/examples/tcp_client.py +1 -1
- pymodaq/extensions/__init__.py +1 -1
- pymodaq/extensions/bayesian/bayesian_optimisation.py +44 -32
- pymodaq/extensions/bayesian/utils.py +10 -10
- pymodaq/extensions/console.py +7 -6
- pymodaq/extensions/daq_logger/__init__.py +1 -0
- pymodaq/extensions/{daq_logger.py → daq_logger/daq_logger.py} +30 -30
- pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger.py +16 -15
- pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger_models.py +2 -0
- pymodaq/{utils/h5modules → extensions/daq_logger}/h5logging.py +7 -8
- pymodaq/extensions/daq_scan.py +42 -34
- pymodaq/extensions/daq_scan_ui.py +18 -18
- pymodaq/extensions/h5browser.py +2 -3
- pymodaq/extensions/pid/__init__.py +4 -2
- pymodaq/extensions/pid/daq_move_PID.py +3 -3
- pymodaq/extensions/pid/pid_controller.py +59 -50
- pymodaq/extensions/pid/utils.py +10 -5
- pymodaq/extensions/utils.py +33 -3
- pymodaq/post_treatment/load_and_plot.py +10 -7
- pymodaq/resources/preset_default.xml +1 -1
- pymodaq/updater.py +107 -0
- pymodaq/utils/array_manipulation.py +4 -384
- pymodaq/utils/calibration_camera.py +12 -9
- pymodaq/utils/chrono_timer.py +11 -10
- pymodaq/utils/config.py +3 -458
- pymodaq/utils/daq_utils.py +9 -715
- pymodaq/utils/data.py +17 -2959
- pymodaq/utils/enums.py +4 -74
- pymodaq/utils/exceptions.py +0 -4
- pymodaq/utils/gui_utils/__init__.py +8 -8
- pymodaq/utils/gui_utils/loader_utils.py +26 -1
- pymodaq/utils/gui_utils/utils.py +8 -162
- pymodaq/utils/gui_utils/widgets/lcd.py +6 -109
- pymodaq/utils/h5modules/__init__.py +0 -4
- pymodaq/utils/h5modules/module_saving.py +9 -8
- pymodaq/utils/leco/__init__.py +2 -2
- pymodaq/utils/leco/daq_move_LECODirector.py +3 -6
- pymodaq/utils/leco/daq_xDviewer_LECODirector.py +5 -5
- pymodaq/utils/leco/director_utils.py +2 -2
- pymodaq/utils/leco/leco_director.py +3 -3
- pymodaq/utils/leco/pymodaq_listener.py +4 -3
- pymodaq/utils/leco/utils.py +11 -9
- pymodaq/utils/logger.py +4 -76
- pymodaq/utils/managers/batchscan_manager.py +16 -19
- pymodaq/utils/managers/modules_manager.py +30 -17
- pymodaq/utils/managers/overshoot_manager.py +48 -6
- pymodaq/utils/managers/preset_manager.py +39 -59
- pymodaq/utils/managers/preset_manager_utils.py +28 -22
- pymodaq/utils/managers/remote_manager.py +12 -10
- pymodaq/utils/math_utils.py +4 -582
- pymodaq/utils/messenger.py +4 -64
- pymodaq/utils/parameter/__init__.py +6 -9
- pymodaq/utils/parameter/utils.py +4 -328
- pymodaq/utils/scanner/scan_config.py +1 -1
- pymodaq/utils/scanner/scan_factory.py +16 -12
- pymodaq/utils/{plotting → scanner}/scan_selector.py +19 -20
- pymodaq/utils/scanner/scanner.py +10 -8
- pymodaq/utils/scanner/scanners/_1d_scanners.py +8 -5
- pymodaq/utils/scanner/scanners/_2d_scanners.py +5 -5
- pymodaq/utils/scanner/scanners/sequential.py +8 -8
- pymodaq/utils/scanner/scanners/tabular.py +9 -9
- pymodaq/utils/scanner/utils.py +6 -4
- pymodaq/utils/svg/svg_viewer2D.py +3 -4
- pymodaq/utils/tcp_ip/mysocket.py +4 -110
- pymodaq/utils/tcp_ip/serializer.py +4 -801
- pymodaq/utils/tcp_ip/tcp_server_client.py +15 -13
- pymodaq-5.0.1.dist-info/METADATA +242 -0
- pymodaq-5.0.1.dist-info/RECORD +122 -0
- {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/WHEEL +1 -1
- {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/entry_points.txt +1 -0
- pymodaq/examples/custom_app.py +0 -258
- pymodaq/examples/custom_viewer.py +0 -112
- pymodaq/examples/parameter_ex.py +0 -138
- pymodaq/examples/preset_MockCamera.xml +0 -1
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.py +0 -142
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.ui +0 -232
- pymodaq/post_treatment/daq_measurement/daq_measurement_main.py +0 -391
- pymodaq/post_treatment/daq_measurement/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -2
- pymodaq/post_treatment/process_to_scalar.py +0 -263
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/algo.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/input.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/random.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/target.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -238
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127453
- pymodaq/resources/QtDesigner_Ressources/__init__.py +0 -0
- pymodaq/resources/QtDesigner_Ressources/credit.rst +0 -7
- pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
- pymodaq/resources/VERSION +0 -2
- pymodaq/resources/config_template.toml +0 -96
- pymodaq/resources/triangulation_data.npy +0 -0
- pymodaq/utils/abstract/__init__.py +0 -48
- pymodaq/utils/db/__init__.py +0 -0
- pymodaq/utils/db/db_logger/__init__.py +0 -0
- pymodaq/utils/factory.py +0 -82
- pymodaq/utils/gui_utils/custom_app.py +0 -133
- pymodaq/utils/gui_utils/dock.py +0 -107
- pymodaq/utils/gui_utils/file_io.py +0 -94
- pymodaq/utils/gui_utils/layout.py +0 -34
- pymodaq/utils/gui_utils/list_picker.py +0 -38
- pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
- pymodaq/utils/gui_utils/widgets/label.py +0 -24
- pymodaq/utils/gui_utils/widgets/push.py +0 -149
- pymodaq/utils/gui_utils/widgets/qled.py +0 -62
- pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
- pymodaq/utils/gui_utils/widgets/table.py +0 -263
- pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
- pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -110
- pymodaq/utils/h5modules/backends.py +0 -1022
- pymodaq/utils/h5modules/browsing.py +0 -627
- pymodaq/utils/h5modules/data_saving.py +0 -1107
- pymodaq/utils/h5modules/exporter.py +0 -119
- pymodaq/utils/h5modules/exporters/__init__.py +0 -0
- pymodaq/utils/h5modules/exporters/base.py +0 -111
- pymodaq/utils/h5modules/exporters/flimj.py +0 -63
- pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
- pymodaq/utils/h5modules/saving.py +0 -866
- pymodaq/utils/h5modules/utils.py +0 -115
- pymodaq/utils/managers/action_manager.py +0 -489
- pymodaq/utils/managers/parameter_manager.py +0 -279
- pymodaq/utils/managers/roi_manager.py +0 -740
- pymodaq/utils/parameter/ioxml.py +0 -545
- pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
- pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
- pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
- pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
- pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
- pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
- pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
- pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
- pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
- pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -166
- pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
- pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
- pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
- pymodaq/utils/plotting/__init__.py +0 -0
- pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
- pymodaq/utils/plotting/data_viewers/base.py +0 -286
- pymodaq/utils/plotting/data_viewers/viewer.py +0 -275
- pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
- pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -826
- pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
- pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
- pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
- pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
- pymodaq/utils/plotting/gant_chart.py +0 -123
- pymodaq/utils/plotting/image_viewer.py +0 -97
- pymodaq/utils/plotting/items/__init__.py +0 -0
- pymodaq/utils/plotting/items/axis_scaled.py +0 -93
- pymodaq/utils/plotting/items/crosshair.py +0 -94
- pymodaq/utils/plotting/items/image.py +0 -388
- pymodaq/utils/plotting/navigator.py +0 -353
- pymodaq/utils/plotting/plotter/plotter.py +0 -94
- pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
- pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
- pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
- pymodaq/utils/plotting/utils/__init__.py +0 -0
- pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
- pymodaq/utils/plotting/utils/filter.py +0 -585
- pymodaq/utils/plotting/utils/lineout.py +0 -226
- pymodaq/utils/plotting/utils/plot_utils.py +0 -579
- pymodaq/utils/plotting/utils/signalND.py +0 -1347
- pymodaq/utils/plotting/widgets.py +0 -76
- pymodaq/utils/qvariant.py +0 -12
- pymodaq/utils/slicing.py +0 -63
- pymodaq/utils/units.py +0 -216
- pymodaq-4.4.7.dist-info/METADATA +0 -163
- pymodaq-4.4.7.dist-info/RECORD +0 -446
- /pymodaq/{post_treatment/daq_analysis → daq_utils}/__init__.py +0 -0
- /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
- /pymodaq/{post_treatment/daq_measurement → extensions/daq_logger/db}/__init__.py +0 -0
- {pymodaq-4.4.7.dist-info → pymodaq-5.0.1.dist-info}/licenses/LICENSE +0 -0
pymodaq/updater.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
import time
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from pymodaq_utils.logger import set_logger, get_module_name
|
|
10
|
+
|
|
11
|
+
logger = set_logger(get_module_name(__file__))
|
|
12
|
+
logger.addHandler(logging.StreamHandler(sys.stdout))
|
|
13
|
+
|
|
14
|
+
def wait_for_parent():
|
|
15
|
+
'''
|
|
16
|
+
A function to wait for its parent to terminate execution.
|
|
17
|
+
|
|
18
|
+
In order to achieve that, this process has to be started with
|
|
19
|
+
stdin replaced by a piped stream from its parent. When the
|
|
20
|
+
parent terminates, stdin will close and either return from read
|
|
21
|
+
or throw an exception. De facto creating a way to wait for its
|
|
22
|
+
parent's termination.
|
|
23
|
+
|
|
24
|
+
It then sleep for 2 seconds, to let the parent process complete
|
|
25
|
+
termination.
|
|
26
|
+
|
|
27
|
+
CAUTION: If the process was not started by piping stdin AND
|
|
28
|
+
the --wait option is set, this function will hang forever.
|
|
29
|
+
|
|
30
|
+
We could use `psutil` or a similar lib to check for parent's process
|
|
31
|
+
existance with its pid.
|
|
32
|
+
'''
|
|
33
|
+
|
|
34
|
+
logger.info("Waiting for parent process to stop.")
|
|
35
|
+
try:
|
|
36
|
+
sys.stdin.read()
|
|
37
|
+
except:
|
|
38
|
+
pass
|
|
39
|
+
logger.debug("Parent process closed stdin")
|
|
40
|
+
time.sleep(2)
|
|
41
|
+
logger.info("Parent process stopped.")
|
|
42
|
+
|
|
43
|
+
def process_args():
|
|
44
|
+
'''
|
|
45
|
+
Declare arguments for updater.py, parse them and returns them in an object.
|
|
46
|
+
The arguments are:
|
|
47
|
+
--file <file> to request a python program to (re)start after update if needed (optional)
|
|
48
|
+
--wait to wait for the starting process to terminate before updating (optional, defaults to False)
|
|
49
|
+
packages the package list to install/update (they should contain the version in a pip accepted format)
|
|
50
|
+
'''
|
|
51
|
+
parser = argparse.ArgumentParser(description='Update pymodaq using pip.')
|
|
52
|
+
parser.add_argument('--file', type=str, help='the pymodaq script to restart after update')
|
|
53
|
+
parser.add_argument("--wait", action="store_true", help="enable waiting for pymodaq to finish mode (default is disabled).")
|
|
54
|
+
parser.add_argument('packages', type=str, nargs='+', help='package list')
|
|
55
|
+
return parser.parse_args()
|
|
56
|
+
|
|
57
|
+
def restart_if_command_launch(args):
|
|
58
|
+
'''
|
|
59
|
+
Try to detect if this process if launched using the declared command (i.e. `pymodaq_updater`)
|
|
60
|
+
or using the script file (`updater.py`). If it uses the command, it restart the process to
|
|
61
|
+
force it to use the script file, thus preventing a locked file during update on windows systems.
|
|
62
|
+
'''
|
|
63
|
+
python_file_path = Path(__file__) # Should be the path to `updater.py`
|
|
64
|
+
started_path = Path(sys.argv[0]) # Either `updater.py` or `pymodaq_updater`
|
|
65
|
+
|
|
66
|
+
# If they're different we'll restart using the script file
|
|
67
|
+
if started_path.absolute() != python_file_path.absolute():
|
|
68
|
+
logger.info("Started as pymodaq_updater, need to restart using python to prevent lock.")
|
|
69
|
+
# We HAVE to wait for this process to stop in the restarted process
|
|
70
|
+
new_args = ['--wait'] + sys.argv[1:]
|
|
71
|
+
if args.wait:
|
|
72
|
+
wait_for_parent()
|
|
73
|
+
|
|
74
|
+
subprocess.Popen([sys.executable, str(python_file_path.absolute())] + new_args, stdin=subprocess.PIPE)
|
|
75
|
+
sys.exit(0)
|
|
76
|
+
|
|
77
|
+
def main():
|
|
78
|
+
args = process_args()
|
|
79
|
+
logger.info(f"Arguments processed: {args}")
|
|
80
|
+
|
|
81
|
+
restart_if_command_launch(args)
|
|
82
|
+
|
|
83
|
+
if args.wait:
|
|
84
|
+
wait_for_parent()
|
|
85
|
+
|
|
86
|
+
packages_str = ', '.join(args.packages)
|
|
87
|
+
logger.info(f'Updating packages: {packages_str}')
|
|
88
|
+
|
|
89
|
+
with subprocess.Popen([sys.executable, '-m', 'pip', 'install'] + args.packages, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as pip:
|
|
90
|
+
for line in pip.stdout:
|
|
91
|
+
# Can't decode as some characters are not valid and make the whole process fail
|
|
92
|
+
logger.info(line[:-1])
|
|
93
|
+
ret_code = pip.wait()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if ret_code == 0:
|
|
97
|
+
logger.info(f'Succesfully updated {packages_str}')
|
|
98
|
+
else:
|
|
99
|
+
logger.error(f'Error while updating {packages_str}, pip returned {ret_code}')
|
|
100
|
+
|
|
101
|
+
if args.file is not None:
|
|
102
|
+
logger.info(f"Restarting {args.file} script after update.")
|
|
103
|
+
subprocess.Popen([sys.executable, args.file])
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
main()
|
|
@@ -1,386 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
"""
|
|
3
|
-
Created on Mon March 03 2021
|
|
4
|
-
author: Sebastien Weber
|
|
5
|
-
"""
|
|
6
|
-
import numpy as np
|
|
1
|
+
from pymodaq_utils.array_manipulation import *
|
|
7
2
|
|
|
3
|
+
from pymodaq_utils.warnings import deprecation_msg
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
out = np.array([tmp])
|
|
12
|
-
sign = stop - start
|
|
13
|
-
if step == 0:
|
|
14
|
-
raise ValueError('step must be strictly positive or negative')
|
|
15
|
-
if step > 0 and sign > 0:
|
|
16
|
-
while tmp <= stop:
|
|
17
|
-
tmp = tmp + (np.random.random() + 0.5) * step
|
|
18
|
-
out = np.append(out, tmp)
|
|
19
|
-
elif step < 0 and sign < 0:
|
|
20
|
-
while tmp >= stop:
|
|
21
|
-
tmp = tmp + (np.random.random() + 0.5) * step
|
|
22
|
-
out = np.append(out, tmp)
|
|
23
|
-
else:
|
|
24
|
-
raise ValueError(f'the step value {step} is not of the same sign as stop - start : {sign}')
|
|
25
|
-
return out[0:-1]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def linspace_this_vect(x, y=None, Npts=None):
|
|
29
|
-
"""
|
|
30
|
-
Given a vector x, it returns a vector xlin where xlin is a
|
|
31
|
-
linearised version of x on the same interval and with the same size.
|
|
32
|
-
if args is provided it is a y vector and the function returns both xlin
|
|
33
|
-
and ylin where ylin is a linear interpolation of y on this new xlin axis
|
|
34
|
-
|
|
35
|
-
Parameters
|
|
36
|
-
----------
|
|
37
|
-
x : (ndarray)
|
|
38
|
-
y : (ndarray) optional
|
|
39
|
-
Npts: (int) size of the linear vector (optional)
|
|
40
|
-
|
|
41
|
-
Returns
|
|
42
|
-
-------
|
|
43
|
-
xlin : vector
|
|
44
|
-
(ylin : vector) optional if args is provided
|
|
45
|
-
|
|
46
|
-
"""
|
|
47
|
-
if not Npts:
|
|
48
|
-
Npts = np.size(x)
|
|
49
|
-
xlin = np.linspace(np.min(x), np.max(x), Npts)
|
|
50
|
-
if y is not None:
|
|
51
|
-
ylin = np.interp(xlin, x, y)
|
|
52
|
-
return xlin, ylin
|
|
53
|
-
else:
|
|
54
|
-
return xlin
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def find_index(x, threshold):
|
|
58
|
-
"""
|
|
59
|
-
find_index finds the index ix such that x(ix) is the closest from threshold
|
|
60
|
-
|
|
61
|
-
Parameters
|
|
62
|
-
----------
|
|
63
|
-
x : vector
|
|
64
|
-
threshold : list of scalar
|
|
65
|
-
|
|
66
|
-
Returns
|
|
67
|
-
-------
|
|
68
|
-
out : list of 2-tuple containing ix,x[ix]
|
|
69
|
-
out=[(ix0,xval0),(ix1,xval1),...]
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
if np.isscalar(threshold):
|
|
73
|
-
threshold = [threshold]
|
|
74
|
-
out = []
|
|
75
|
-
for value in threshold:
|
|
76
|
-
ix = int(np.argmin(np.abs(x - value)))
|
|
77
|
-
out.append((ix, x[ix]))
|
|
78
|
-
return out
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def find_rising_edges(x, threshold):
|
|
82
|
-
"""find_rising_edges finds the index ix such that x(ix) is the closest from threshold and values are increasing
|
|
83
|
-
|
|
84
|
-
Parameters
|
|
85
|
-
----------
|
|
86
|
-
x : vector
|
|
87
|
-
threshold : list of scalar
|
|
88
|
-
|
|
89
|
-
Returns
|
|
90
|
-
-------
|
|
91
|
-
out : list of 2-tuple containing ix,x[ix]
|
|
92
|
-
out=[(ix0,xval0),(ix1,xval1),...]
|
|
93
|
-
|
|
94
|
-
"""
|
|
95
|
-
x_shifted = np.concatenate((x[1:], np.array((np.NaN,))))
|
|
96
|
-
if np.isscalar(threshold):
|
|
97
|
-
threshold = [threshold]
|
|
98
|
-
out = []
|
|
99
|
-
for value in threshold:
|
|
100
|
-
dat = np.bitwise_and(x < value, x_shifted > value)
|
|
101
|
-
ix = [ind for ind, flag in enumerate(dat) if flag]
|
|
102
|
-
out.append((ix, x[ix]))
|
|
103
|
-
return out
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def crop_vector_to_axis(x, V, xlim):
|
|
107
|
-
"""crops a vector V with given x axis vector to a given xlim tuple
|
|
108
|
-
|
|
109
|
-
Parameters
|
|
110
|
-
----------
|
|
111
|
-
x : vector
|
|
112
|
-
V : vector
|
|
113
|
-
xlim: tuple containing (xmin,xmax)
|
|
114
|
-
|
|
115
|
-
Returns
|
|
116
|
-
-------
|
|
117
|
-
x_c : vector
|
|
118
|
-
V_c : vector
|
|
119
|
-
"""
|
|
120
|
-
x1 = find_index(x, xlim[0])[0][0]
|
|
121
|
-
x2 = find_index(x, xlim[1])[0][0]
|
|
122
|
-
if x2 > x1:
|
|
123
|
-
ixx = np.linspace(x1, x2, x2 - x1 + 1, dtype=int);
|
|
124
|
-
else:
|
|
125
|
-
ixx = np.linspace(x2, x1, x1 - x2 + 1, dtype=int);
|
|
126
|
-
|
|
127
|
-
x_c = x[ixx]
|
|
128
|
-
V_c = V[ixx]
|
|
129
|
-
return x_c, V_c
|
|
130
|
-
|
|
131
|
-
def rescale(x, window=[0.0, 1.0]):
|
|
132
|
-
""" Rescales a numpy array to the range specified by ``window``.
|
|
133
|
-
|
|
134
|
-
Default is [0, 1].
|
|
135
|
-
"""
|
|
136
|
-
maxx = np.max(x)
|
|
137
|
-
minx = np.min(x)
|
|
138
|
-
return (x - minx) / (maxx - minx) * (window[1] - window[0]) + window[0]
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def marginals(data, normalize=False, axes=None):
|
|
142
|
-
""" Calculates the marginals of the data array.
|
|
143
|
-
|
|
144
|
-
axes specifies the axes of the marginals, e.g., the axes on which the
|
|
145
|
-
sum is projected.
|
|
146
|
-
|
|
147
|
-
If axis is None a list of all marginals is returned.
|
|
148
|
-
"""
|
|
149
|
-
if axes is None:
|
|
150
|
-
axes = range(data.ndim)
|
|
151
|
-
axes = list(axes)
|
|
152
|
-
full_axes = list(range(data.ndim))
|
|
153
|
-
m = []
|
|
154
|
-
for i in axes:
|
|
155
|
-
# for the marginal sum over all axes except the specified one
|
|
156
|
-
margin_axes = tuple(j for j in full_axes if j != i)
|
|
157
|
-
m.append(np.sum(data, axis=margin_axes))
|
|
158
|
-
if normalize:
|
|
159
|
-
m = [rescale(mx) for mx in m]
|
|
160
|
-
return tuple(m) if len(m) != 1 else m[0]
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def find(x, condition, n=1):
|
|
164
|
-
""" Return the index of the nth element that fulfills the condition.
|
|
165
|
-
"""
|
|
166
|
-
search_n = 1
|
|
167
|
-
for i in range(len(x)):
|
|
168
|
-
if condition(x[i]):
|
|
169
|
-
if search_n == n:
|
|
170
|
-
return i
|
|
171
|
-
search_n += 1
|
|
172
|
-
return -1
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def arglimit(y, threshold=1e-3, padding=0.0, normalize=True):
|
|
176
|
-
""" Returns the first and last index where `y >= threshold * max(abs(y))`.
|
|
177
|
-
"""
|
|
178
|
-
t = np.abs(y)
|
|
179
|
-
if normalize:
|
|
180
|
-
t = t / np.max(t)
|
|
181
|
-
|
|
182
|
-
idx1 = find(t, lambda x: x >= threshold)
|
|
183
|
-
if idx1 == -1:
|
|
184
|
-
idx1 = 0
|
|
185
|
-
idx2 = find(t[::-1], lambda x: x >= threshold)
|
|
186
|
-
if idx2 == -1:
|
|
187
|
-
idx2 = t.shape[0] - 1
|
|
188
|
-
else:
|
|
189
|
-
idx2 = t.shape[0] - 1 - idx2
|
|
190
|
-
|
|
191
|
-
return (idx1, idx2)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
def limit(x, y=None, threshold=1e-3, padding=0.25, extend=True):
|
|
195
|
-
""" Returns the maximum x-range where the y-values are sufficiently large.
|
|
196
|
-
|
|
197
|
-
Parameters
|
|
198
|
-
----------
|
|
199
|
-
x : array_like
|
|
200
|
-
The x values of the graph.
|
|
201
|
-
y : array_like, optional
|
|
202
|
-
The y values of the graph. If `None` the maximum range of `x` is
|
|
203
|
-
used. That is only useful if `padding > 0`.
|
|
204
|
-
threshold : float
|
|
205
|
-
The threshold relative to the maximum of `y` of values that should be
|
|
206
|
-
included in the bracket.
|
|
207
|
-
padding : float
|
|
208
|
-
The relative padding on each side in fractions of the bracket size.
|
|
209
|
-
extend : bool, optional
|
|
210
|
-
Signals if the returned range can be larger than the values in ``x``.
|
|
211
|
-
Default is `True`.
|
|
212
|
-
|
|
213
|
-
Returns
|
|
214
|
-
-------
|
|
215
|
-
xl, xr : float
|
|
216
|
-
Lowest and biggest value of the range.
|
|
217
|
-
|
|
218
|
-
"""
|
|
219
|
-
if y is None:
|
|
220
|
-
x1, x2 = np.min(x), np.max(x)
|
|
221
|
-
if not extend:
|
|
222
|
-
return (x1, x2)
|
|
223
|
-
else:
|
|
224
|
-
idx1, idx2 = arglimit(y, threshold=threshold)
|
|
225
|
-
x1, x2 = sorted([x[idx1], x[idx2]])
|
|
226
|
-
|
|
227
|
-
# calculate the padding
|
|
228
|
-
if padding != 0.0:
|
|
229
|
-
pad = (x2 - x1) * padding
|
|
230
|
-
x1 -= pad
|
|
231
|
-
x2 += pad
|
|
232
|
-
|
|
233
|
-
if not extend:
|
|
234
|
-
x1 = max(x1, np.min(x))
|
|
235
|
-
x2 = min(x2, np.max(x))
|
|
236
|
-
|
|
237
|
-
return (x1, x2)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
def crop_array_to_axis(x, y, M, cropbox):
|
|
241
|
-
"""crops an array M with given cropbox as a tuple (xmin,xmax,ymin,ymax).
|
|
242
|
-
|
|
243
|
-
Parameters
|
|
244
|
-
----------
|
|
245
|
-
x : vector
|
|
246
|
-
y : vector
|
|
247
|
-
M : 2D array
|
|
248
|
-
cropbox: 4 elements tuple containing (xmin,xmax,ymin,ymax)
|
|
249
|
-
|
|
250
|
-
Returns
|
|
251
|
-
-------
|
|
252
|
-
x_c : croped x vector
|
|
253
|
-
y_c : croped y vector
|
|
254
|
-
M_c : croped 2D M array
|
|
255
|
-
|
|
256
|
-
"""
|
|
257
|
-
x1 = find_index(x, cropbox[0])[0][0]
|
|
258
|
-
x2 = find_index(x, cropbox[1])[0][0]
|
|
259
|
-
if x2 > x1:
|
|
260
|
-
ixx = np.linspace(x1, x2, x2 - x1 + 1, dtype=int)
|
|
261
|
-
else:
|
|
262
|
-
ixx = np.linspace(x2, x1, x1 - x2 + 1, dtype=int)
|
|
263
|
-
|
|
264
|
-
y1 = find_index(y, cropbox[2])[0][0]
|
|
265
|
-
y2 = find_index(y, cropbox[3])[0][0]
|
|
266
|
-
if y2 > y1:
|
|
267
|
-
iyy = np.linspace(y1, y2, y2 - y1 + 1, dtype=int)
|
|
268
|
-
else:
|
|
269
|
-
iyy = np.linspace(y2, y1, y1 - y2 + 1, dtype=int)
|
|
270
|
-
|
|
271
|
-
x_c = x[ixx]
|
|
272
|
-
y_c = y[iyy]
|
|
273
|
-
|
|
274
|
-
M_c = M[iyy[0]:iyy[-1] + 1, ixx[0]:ixx[-1] + 1]
|
|
275
|
-
return x_c, y_c, M_c
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
def interp1D(x, M, xlin, axis=1):
|
|
279
|
-
"""
|
|
280
|
-
same as numpy interp function but works on 2D array
|
|
281
|
-
you have to specify the axis over which to do the interpolation
|
|
282
|
-
kwargs refers to the numpy interp kwargs
|
|
283
|
-
returns both xlin and the new 2D array Minterp
|
|
284
|
-
"""
|
|
285
|
-
if axis == 0:
|
|
286
|
-
Minterp = np.zeros((np.size(xlin), np.size(M, axis=1)))
|
|
287
|
-
indexes = np.arange(0, np.size(M, axis=1))
|
|
288
|
-
for ind in indexes:
|
|
289
|
-
# print(ind)
|
|
290
|
-
Minterp[:, ind] = np.interp(xlin, x, M[:, ind])
|
|
291
|
-
else:
|
|
292
|
-
Minterp = np.zeros((np.size(M, axis=0), np.size(xlin)))
|
|
293
|
-
indexes = np.arange(0, np.size(M, axis=0))
|
|
294
|
-
for ind in indexes:
|
|
295
|
-
Minterp[ind, :] = np.interp(xlin, x, M[ind, :])
|
|
296
|
-
return Minterp
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
def linspace_this_image(x, M, axis=1, Npts=None):
|
|
300
|
-
"""
|
|
301
|
-
Given a vector x and a 2D array M, it returns an array vector xlin where xlin is a
|
|
302
|
-
linearised version of x on the same interval and with the same size. it returns as well
|
|
303
|
-
a 2D array Minterp interpolated on the new xlin vector along the specified axis.
|
|
304
|
-
|
|
305
|
-
Parameters
|
|
306
|
-
----------
|
|
307
|
-
x : (vector)
|
|
308
|
-
M : (2D array)
|
|
309
|
-
axis : (int)
|
|
310
|
-
Npts: (int) size of the linear vector (optional)
|
|
311
|
-
|
|
312
|
-
Returns
|
|
313
|
-
-------
|
|
314
|
-
xlin : vector
|
|
315
|
-
Minterp : 2D array
|
|
316
|
-
"""
|
|
317
|
-
xlin = linspace_this_vect(x, Npts=Npts)
|
|
318
|
-
Minterp = interp1D(x, M, xlin, axis=axis)
|
|
319
|
-
|
|
320
|
-
return xlin, Minterp
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
def max_ind(x, axis=None):
|
|
324
|
-
"""returns the max value in a vector or array and its index (in a tuple)
|
|
325
|
-
|
|
326
|
-
Parameters
|
|
327
|
-
----------
|
|
328
|
-
x : vector
|
|
329
|
-
|
|
330
|
-
axis : optional dimension aginst which to normalise
|
|
331
|
-
|
|
332
|
-
Returns
|
|
333
|
-
-------
|
|
334
|
-
ind_max : index of the maximum value
|
|
335
|
-
|
|
336
|
-
max_val : maximum value
|
|
337
|
-
"""
|
|
338
|
-
ind_max = np.argmax(x, axis=axis)
|
|
339
|
-
max_val = np.max(x, axis=axis)
|
|
340
|
-
return ind_max, max_val
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
def min_ind(x, axis=None):
|
|
344
|
-
"""returns the min value in a vector or array and its index (in flattened array)
|
|
345
|
-
|
|
346
|
-
Parameters
|
|
347
|
-
----------
|
|
348
|
-
x : vector
|
|
349
|
-
axis : optional dimension to check the function
|
|
350
|
-
|
|
351
|
-
Returns
|
|
352
|
-
-------
|
|
353
|
-
ind_min : index of the minimum value
|
|
354
|
-
min_val : minimum value
|
|
355
|
-
"""
|
|
356
|
-
ind_min = np.argmin(x, axis=axis)
|
|
357
|
-
min_val = np.min(x, axis=axis)
|
|
358
|
-
return ind_min, min_val
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
if __name__ == '__main__': # pragma: no cover
|
|
362
|
-
from pymodaq.utils import daq_utils as utils
|
|
363
|
-
import matplotlib.pyplot as plt
|
|
364
|
-
|
|
365
|
-
x = random_step(00, 100, 5)
|
|
366
|
-
y = random_step(00, 100, 5)
|
|
367
|
-
g2 = utils.gauss2D(x, 35, 15, y, 55, 20, 1)
|
|
368
|
-
(xlin, g2_interp) = linspace_this_image(x, g2, axis=1, Npts=100)
|
|
369
|
-
(ylin, g2_interp_both) = linspace_this_image(y, g2_interp, axis=0, Npts=100)
|
|
370
|
-
plt.figure('gauss2D')
|
|
371
|
-
plt.subplot(221)
|
|
372
|
-
plt.pcolormesh(x, y, g2)
|
|
373
|
-
plt.subplot(222)
|
|
374
|
-
plt.pcolormesh(xlin, y, g2_interp)
|
|
375
|
-
plt.subplot(223)
|
|
376
|
-
plt.pcolormesh(xlin, ylin, g2_interp_both)
|
|
377
|
-
|
|
378
|
-
plt.show()
|
|
379
|
-
|
|
380
|
-
x_c, y_c, M_c = crop_array_to_axis(x, y, g2, [20, 60, 40, 80])
|
|
381
|
-
plt.figure('cropped')
|
|
382
|
-
plt.subplot(121)
|
|
383
|
-
plt.pcolormesh(x, y, g2)
|
|
384
|
-
plt.subplot(122)
|
|
385
|
-
plt.pcolormesh(x_c, y_c, M_c)
|
|
386
|
-
plt.show()
|
|
5
|
+
deprecation_msg('Importing array_manipulation stuff from pymodaq is deprecated in pymodaq>5.0.0,'
|
|
6
|
+
'please use the pymodaq_utils.array_manipulation module')
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
1
4
|
from qtpy import QtWidgets
|
|
2
5
|
from qtpy.QtCore import Qt, QObject
|
|
3
6
|
|
|
4
|
-
import
|
|
5
|
-
|
|
7
|
+
from pymodaq_utils.config import get_set_local_dir
|
|
8
|
+
|
|
9
|
+
from pymodaq_gui.parameter import ioxml
|
|
10
|
+
from pymodaq_gui.parameter import ParameterTree, Parameter
|
|
11
|
+
from pymodaq_gui.plotting.data_viewers.viewer2D import Viewer2D
|
|
12
|
+
from pymodaq_gui.h5modules.browsing import browse_data
|
|
6
13
|
|
|
7
|
-
import sys
|
|
8
|
-
from pymodaq.utils.plotting.data_viewers.viewer2D import Viewer2D
|
|
9
14
|
from pymodaq.post_treatment.daq_measurement.daq_measurement_main import DAQ_Measurement
|
|
10
|
-
|
|
11
|
-
import os
|
|
12
|
-
from pymodaq.utils.config import get_set_local_dir
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
local_path = get_set_local_dir()
|
|
15
18
|
calib_path = os.path.join(local_path, 'camera_calibrations')
|
|
@@ -135,8 +138,8 @@ class CalibrationCamera(QtWidgets.QWidget, QObject):
|
|
|
135
138
|
]},
|
|
136
139
|
]}, ]
|
|
137
140
|
param_obj = Parameter.create(name='Axes_Settings', type='group', children=params)
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
ioxml.parameter_to_xml_file(param_obj,
|
|
142
|
+
os.path.join(calib_path, os.path.split(self.fname)[1]))
|
|
140
143
|
self.settings.child(('data_saved')).setValue(True)
|
|
141
144
|
self.settings.child(('filepath')).setValue(os.path.join(calib_path, os.path.split(self.fname)[1]))
|
|
142
145
|
|
pymodaq/utils/chrono_timer.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
from qtpy import QtGui, QtWidgets
|
|
2
|
-
from qtpy.QtCore import Qt, QObject, QTimer
|
|
3
|
-
from pyqtgraph.dockarea import Dock
|
|
4
|
-
from pymodaq.utils.gui_utils import DockArea
|
|
5
1
|
import time
|
|
6
2
|
from datetime import timedelta
|
|
7
3
|
import sys
|
|
8
|
-
|
|
4
|
+
|
|
5
|
+
from qtpy import QtGui, QtWidgets
|
|
6
|
+
from qtpy.QtCore import Qt, QObject, QTimer
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from pymodaq_gui.utils.dock import DockArea, Dock
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class PushButtonShortcut(QtWidgets.QPushButton):
|
|
@@ -62,7 +63,7 @@ class ChronoTimer(QObject):
|
|
|
62
63
|
|
|
63
64
|
self.dock_chrono_timer.setAutoFillBackground(True)
|
|
64
65
|
palette = self.dock_chrono_timer.palette()
|
|
65
|
-
palette.setColor(palette.
|
|
66
|
+
palette.setColor(palette.Window, QtGui.QColor(0, 0, 0))
|
|
66
67
|
self.dock_chrono_timer.setPalette(palette)
|
|
67
68
|
|
|
68
69
|
self.time_lcd = QtWidgets.QLCDNumber(8)
|
|
@@ -90,7 +91,7 @@ class ChronoTimer(QObject):
|
|
|
90
91
|
self.controls_layout.addWidget(hor_widget)
|
|
91
92
|
|
|
92
93
|
icon = QtGui.QIcon()
|
|
93
|
-
icon.addPixmap(QtGui.QPixmap("
|
|
94
|
+
icon.addPixmap(QtGui.QPixmap("icons:run2.png"), QtGui.QIcon.Normal,
|
|
94
95
|
QtGui.QIcon.Off)
|
|
95
96
|
self.start_pb = PushButtonShortcut(icon, 'Start',
|
|
96
97
|
shortcut='Home', shortcut_widget=self.area)
|
|
@@ -100,7 +101,7 @@ class ChronoTimer(QObject):
|
|
|
100
101
|
hor_layout.addWidget(self.start_pb)
|
|
101
102
|
|
|
102
103
|
icon = QtGui.QIcon()
|
|
103
|
-
icon.addPixmap(QtGui.QPixmap("
|
|
104
|
+
icon.addPixmap(QtGui.QPixmap("icons:pause.png"), QtGui.QIcon.Normal,
|
|
104
105
|
QtGui.QIcon.Off)
|
|
105
106
|
self.pause_pb = PushButtonShortcut(icon, 'Pause',
|
|
106
107
|
shortcut='Ctrl+p', shortcut_widget=self.area)
|
|
@@ -110,7 +111,7 @@ class ChronoTimer(QObject):
|
|
|
110
111
|
hor_layout.addWidget(self.pause_pb)
|
|
111
112
|
|
|
112
113
|
icon = QtGui.QIcon()
|
|
113
|
-
icon.addPixmap(QtGui.QPixmap("
|
|
114
|
+
icon.addPixmap(QtGui.QPixmap("icons:Refresh2.png"), QtGui.QIcon.Normal,
|
|
114
115
|
QtGui.QIcon.Off)
|
|
115
116
|
self.reset_pb = PushButtonShortcut(icon, 'Reset',
|
|
116
117
|
shortcut='F5', shortcut_widget=self.area)
|
|
@@ -182,7 +183,7 @@ class ChronoTimer(QObject):
|
|
|
182
183
|
# lcd.setPalette(QtGui.QPalette(Qt.red))
|
|
183
184
|
if hasattr(Qt, color):
|
|
184
185
|
palette.setBrush(palette.WindowText, getattr(Qt, color))
|
|
185
|
-
palette.setColor(palette.
|
|
186
|
+
palette.setColor(palette.Window, QtGui.QColor(0, 0, 0))
|
|
186
187
|
lcd.setPalette(palette)
|
|
187
188
|
|
|
188
189
|
|