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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created the 02/03/2023
|
|
4
|
-
|
|
5
|
-
@author: Nicolas Tappy
|
|
6
|
-
"""
|
|
7
|
-
# Standard imports
|
|
8
|
-
from abc import ABCMeta, abstractmethod
|
|
9
|
-
from typing import Callable
|
|
10
|
-
|
|
11
|
-
# 3rd party imports
|
|
12
|
-
import numpy as np
|
|
13
|
-
|
|
14
|
-
# project imports
|
|
15
|
-
from pymodaq.utils.h5modules.backends import H5Backend, Node
|
|
16
|
-
from pymodaq.utils.logger import set_logger, get_module_name
|
|
17
|
-
|
|
18
|
-
logger = set_logger(get_module_name(__file__))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class H5Exporter(metaclass=ABCMeta):
|
|
22
|
-
"""Base class for an exporter. """
|
|
23
|
-
|
|
24
|
-
# This is to define an abstract class attribute
|
|
25
|
-
@classmethod
|
|
26
|
-
@property
|
|
27
|
-
@abstractmethod
|
|
28
|
-
def FORMAT_DESCRIPTION(cls):
|
|
29
|
-
"""str: file format description as a short text. eg: text file"""
|
|
30
|
-
raise NotImplementedError
|
|
31
|
-
|
|
32
|
-
@classmethod
|
|
33
|
-
@property
|
|
34
|
-
@abstractmethod
|
|
35
|
-
def FORMAT_EXTENSION(cls):
|
|
36
|
-
"""str: File format extension. eg: txt"""
|
|
37
|
-
raise NotImplementedError
|
|
38
|
-
|
|
39
|
-
def __init__(self):
|
|
40
|
-
"""Abstract Exporter Constructor"""
|
|
41
|
-
pass
|
|
42
|
-
|
|
43
|
-
@abstractmethod
|
|
44
|
-
def export_data(self, node: Node, filename: str) -> None:
|
|
45
|
-
"""Abstract method to save a .h5 node to a file"""
|
|
46
|
-
pass
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class ExporterFactory:
|
|
50
|
-
"""The factory class for creating executors"""
|
|
51
|
-
|
|
52
|
-
exporters_registry = {}
|
|
53
|
-
file_filters = {}
|
|
54
|
-
|
|
55
|
-
@classmethod
|
|
56
|
-
def register_exporter(cls) -> Callable:
|
|
57
|
-
"""Class decorator method to register exporter class to the internal registry. Must be used as
|
|
58
|
-
decorator above the definition of an H5Exporter class. H5Exporter must implement specific class
|
|
59
|
-
attributes and methods, see definition: h5node_exporter.H5Exporter
|
|
60
|
-
See h5node_exporter.H5txtExporter and h5node_exporter.H5txtExporter for usage examples.
|
|
61
|
-
returns:
|
|
62
|
-
the exporter class
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
def inner_wrapper(wrapped_class) -> Callable:
|
|
66
|
-
extension = wrapped_class.FORMAT_EXTENSION
|
|
67
|
-
format_desc = wrapped_class.FORMAT_DESCRIPTION
|
|
68
|
-
|
|
69
|
-
if extension not in cls.exporters_registry:
|
|
70
|
-
cls.exporters_registry[extension] = {}
|
|
71
|
-
if filter not in cls.exporters_registry[extension]:
|
|
72
|
-
cls.exporters_registry[extension][format_desc] = wrapped_class
|
|
73
|
-
|
|
74
|
-
# Return wrapped_class
|
|
75
|
-
return wrapped_class
|
|
76
|
-
|
|
77
|
-
# Return decorated function
|
|
78
|
-
return inner_wrapper
|
|
79
|
-
|
|
80
|
-
@classmethod
|
|
81
|
-
def create_exporter(cls, extension: str, filter: str) -> H5Exporter:
|
|
82
|
-
"""Factory command to create the exporter object.
|
|
83
|
-
This method gets the appropriate executor class from the registry
|
|
84
|
-
and instantiates it.
|
|
85
|
-
Parameters
|
|
86
|
-
----------
|
|
87
|
-
extension: str
|
|
88
|
-
the extension of the file that will be exported
|
|
89
|
-
filter: str
|
|
90
|
-
the filter string
|
|
91
|
-
Returns
|
|
92
|
-
-------
|
|
93
|
-
an instance of the executor created
|
|
94
|
-
"""
|
|
95
|
-
if extension not in cls.exporters_registry:
|
|
96
|
-
raise ValueError(f".{extension} is not a supported file format.")
|
|
97
|
-
elif filter not in cls.exporters_registry[extension]:
|
|
98
|
-
raise ValueError(f".{filter} is not a supported file description.")
|
|
99
|
-
|
|
100
|
-
return cls.exporters_registry[extension][filter]()
|
|
101
|
-
|
|
102
|
-
@classmethod
|
|
103
|
-
def get_file_filters(cls):
|
|
104
|
-
"""Create the file filters string"""
|
|
105
|
-
tmp_list = []
|
|
106
|
-
for extension in cls.exporters_registry:
|
|
107
|
-
for format_desc in cls.exporters_registry[extension]:
|
|
108
|
-
tmp_list.append(f"{format_desc} (*.{extension})")
|
|
109
|
-
return ";;".join(tmp_list)
|
|
110
|
-
|
|
111
|
-
@staticmethod
|
|
112
|
-
def get_format_from_filter(filter: str):
|
|
113
|
-
"""Returns the string format description removing the extension part"""
|
|
114
|
-
return filter.split(' (*')[0]
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
File without changes
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created the 02/03/2023
|
|
4
|
-
|
|
5
|
-
@author: Sebastien Weber
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import numpy as np
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# project imports
|
|
12
|
-
from pymodaq.utils.h5modules.backends import Node
|
|
13
|
-
from pymodaq.utils.h5modules.exporter import ExporterFactory, H5Exporter
|
|
14
|
-
from pymodaq.utils.h5modules.backends import H5Backend
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@ExporterFactory.register_exporter()
|
|
18
|
-
class H5h5Exporter(H5Exporter):
|
|
19
|
-
""" Exporter object for saving nodes as single h5 files"""
|
|
20
|
-
|
|
21
|
-
FORMAT_DESCRIPTION = "Single node h5 file"
|
|
22
|
-
FORMAT_EXTENSION = "h5"
|
|
23
|
-
|
|
24
|
-
def export_data(self, node: Node, filename: str) -> None:
|
|
25
|
-
"""Export an h5 node"""
|
|
26
|
-
# This should allow to get the base file object
|
|
27
|
-
if node.backend == 'tables':
|
|
28
|
-
basefile = node.node._v_file
|
|
29
|
-
basefile.copy_file(dstfilename=str(filename), overwrite=False)
|
|
30
|
-
else:
|
|
31
|
-
import h5py
|
|
32
|
-
with h5py.File(filename, 'w') as f_dest:
|
|
33
|
-
node.node.h5file.copy(self.h5file, f_dest)
|
|
34
|
-
|
|
35
|
-
# basefile = node.get_file()
|
|
36
|
-
# basefile.copy_file(dstfilename=str(filename), overwrite=False)
|
|
37
|
-
|
|
38
|
-
new_file = H5Backend(backend="tables")
|
|
39
|
-
new_file.open_file(str(filename), 'a')
|
|
40
|
-
|
|
41
|
-
new_file.h5file.move_node(new_file.get_node_path(node), newparent='/')
|
|
42
|
-
new_file.h5file.remove_node('/RawData', recursive=True)
|
|
43
|
-
new_file.flush()
|
|
44
|
-
|
|
45
|
-
new_file.get_set_group('/', 'RawData')
|
|
46
|
-
new_file.h5file.move_node(f'/{node.name}',
|
|
47
|
-
newparent='/RawData')
|
|
48
|
-
|
|
49
|
-
new_file.close_file()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@ExporterFactory.register_exporter()
|
|
53
|
-
class H5txtExporter(H5Exporter):
|
|
54
|
-
""" Exporter object for saving nodes as txt files"""
|
|
55
|
-
|
|
56
|
-
FORMAT_DESCRIPTION = "Text files"
|
|
57
|
-
FORMAT_EXTENSION = "txt"
|
|
58
|
-
|
|
59
|
-
def export_data(self, node: Node, filename: str) -> None:
|
|
60
|
-
"""Export the node as a .txt file format"""
|
|
61
|
-
if 'ARRAY' in node.attrs['CLASS']:
|
|
62
|
-
data = node.read()
|
|
63
|
-
if not isinstance(data, np.ndarray):
|
|
64
|
-
# in case one has a list of same objects (array of strings for instance, logger or other)
|
|
65
|
-
data = np.array(data)
|
|
66
|
-
np.savetxt(filename, data, '%s', '\t')
|
|
67
|
-
else:
|
|
68
|
-
np.savetxt(filename, data, '%.6e', '\t')
|
|
69
|
-
elif 'GROUP' in node.attrs['CLASS']:
|
|
70
|
-
data_tot = []
|
|
71
|
-
header = []
|
|
72
|
-
dtypes = []
|
|
73
|
-
fmts = []
|
|
74
|
-
for subnode_name, subnode in node.children().items():
|
|
75
|
-
if 'ARRAY' in subnode.attrs['CLASS']:
|
|
76
|
-
if len(subnode.attrs['shape']) == 1:
|
|
77
|
-
data = subnode.read()
|
|
78
|
-
if not isinstance(data, np.ndarray):
|
|
79
|
-
# in case one has a list of same objects (array of strings for instance, logger or other)
|
|
80
|
-
data = np.array(data)
|
|
81
|
-
data_tot.append(data)
|
|
82
|
-
dtypes.append((subnode_name, data.dtype))
|
|
83
|
-
header.append(subnode_name)
|
|
84
|
-
if data.dtype.char == 'U':
|
|
85
|
-
fmt = '%s' # for strings
|
|
86
|
-
elif data.dtype.char == 'l':
|
|
87
|
-
fmt = '%d' # for integers
|
|
88
|
-
else:
|
|
89
|
-
fmt = '%.6f' # for decimal numbers
|
|
90
|
-
fmts.append(fmt)
|
|
91
|
-
|
|
92
|
-
data_trans = np.array(list(zip(*data_tot)), dtype=dtypes)
|
|
93
|
-
np.savetxt(filename, data_trans, fmts, '\t', header='#' + '\t'.join(header))
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@ExporterFactory.register_exporter()
|
|
97
|
-
class H5npyExporter(H5Exporter):
|
|
98
|
-
""" Exporter object for saving nodes as npy files"""
|
|
99
|
-
|
|
100
|
-
FORMAT_DESCRIPTION = "Binary NumPy format"
|
|
101
|
-
FORMAT_EXTENSION = "npy"
|
|
102
|
-
|
|
103
|
-
def export_data(self, node: Node, filename: str) -> None:
|
|
104
|
-
"""Export the node as a numpy binary file format"""
|
|
105
|
-
# String __contain__ method will evaluate to True for CARRAY,EARRAY,VLARRAY,stringARRAY
|
|
106
|
-
if 'ARRAY' in node.attrs['CLASS']:
|
|
107
|
-
data = node.read()
|
|
108
|
-
if not isinstance(data, np.ndarray):
|
|
109
|
-
data = np.array(data)
|
|
110
|
-
|
|
111
|
-
np.save(filename, data)
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created the 02/03/2023
|
|
4
|
-
|
|
5
|
-
@author: Sebastien Weber
|
|
6
|
-
"""
|
|
7
|
-
import numpy as np
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# project imports
|
|
11
|
-
from pymodaq.utils.h5modules.backends import Node
|
|
12
|
-
from pymodaq.utils.h5modules.exporter import ExporterFactory, H5Exporter
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@ExporterFactory.register_exporter()
|
|
16
|
-
class H5asciiExporter(H5Exporter):
|
|
17
|
-
""" Exporter object for saving nodes as txt files"""
|
|
18
|
-
|
|
19
|
-
FORMAT_DESCRIPTION = "Ascii flimj file"
|
|
20
|
-
FORMAT_EXTENSION = "ascii"
|
|
21
|
-
|
|
22
|
-
def export_data(self, node: Node, filename: str) -> None:
|
|
23
|
-
if 'ARRAY' in node.attrs['CLASS']:
|
|
24
|
-
data = node.read()
|
|
25
|
-
if not isinstance(data, np.ndarray):
|
|
26
|
-
# in case one has a list of same objects (array of strings for instance, logger or other)
|
|
27
|
-
data = np.array(data)
|
|
28
|
-
np.savetxt(filename,
|
|
29
|
-
data.T if len(data.shape) > 1 else [data],
|
|
30
|
-
'%s', '\t')
|
|
31
|
-
else:
|
|
32
|
-
np.savetxt(filename,
|
|
33
|
-
data.T if len(data.shape) > 1 else [data],
|
|
34
|
-
'%.6e', '\t')
|
|
35
|
-
|
|
36
|
-
elif 'GROUP' in node.attrs['CLASS']:
|
|
37
|
-
data_tot = []
|
|
38
|
-
header = []
|
|
39
|
-
dtypes = []
|
|
40
|
-
fmts = []
|
|
41
|
-
for subnode_name, subnode in node.children().items():
|
|
42
|
-
if 'ARRAY' in subnode.attrs['CLASS']:
|
|
43
|
-
if len(subnode.attrs['shape']) == 1:
|
|
44
|
-
data = subnode.read()
|
|
45
|
-
if not isinstance(data, np.ndarray):
|
|
46
|
-
# in case one has a list of same objects (array of strings for instance, logger or other)
|
|
47
|
-
data = np.array(data)
|
|
48
|
-
data_tot.append(data)
|
|
49
|
-
dtypes.append((subnode_name, data.dtype))
|
|
50
|
-
header.append(subnode_name)
|
|
51
|
-
if data.dtype.char == 'U':
|
|
52
|
-
fmt = '%s' # for strings
|
|
53
|
-
elif data.dtype.char == 'l':
|
|
54
|
-
fmt = '%d' # for integers
|
|
55
|
-
else:
|
|
56
|
-
fmt = '%.6f' # for decimal numbers
|
|
57
|
-
fmts.append(fmt)
|
|
58
|
-
|
|
59
|
-
data_trans = np.array(list(zip(*data_tot)), dtype=dtypes)
|
|
60
|
-
|
|
61
|
-
np.savetxt(filename, data_trans, fmts, '\t', header='#' + '\t'.join(header))
|
|
62
|
-
|
|
63
|
-
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created the 02/03/2023
|
|
4
|
-
|
|
5
|
-
@author: Nicolas Tappy
|
|
6
|
-
"""
|
|
7
|
-
# Standard imports
|
|
8
|
-
|
|
9
|
-
# 3rd party imports
|
|
10
|
-
try:
|
|
11
|
-
import numpy as np
|
|
12
|
-
import hyperspy.api_nogui as hs
|
|
13
|
-
|
|
14
|
-
# project imports
|
|
15
|
-
from pymodaq.utils.h5modules.backends import Node
|
|
16
|
-
from pymodaq.utils.h5modules.utils import get_h5_data_from_node, extract_axis, verify_axis_data_uniformity
|
|
17
|
-
from pymodaq.utils.h5modules.exporter import ExporterFactory, H5Exporter
|
|
18
|
-
from pymodaq.utils.logger import set_logger, get_module_name
|
|
19
|
-
from pymodaq.utils.h5modules.data_saving import DataLoader
|
|
20
|
-
|
|
21
|
-
# This is needed to log
|
|
22
|
-
logger = set_logger(get_module_name(__file__))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@ExporterFactory.register_exporter()
|
|
26
|
-
class H5hspyExporter(H5Exporter):
|
|
27
|
-
""" Exporter object for saving nodes as hspy files"""
|
|
28
|
-
|
|
29
|
-
FORMAT_DESCRIPTION = "Hyperspy file format"
|
|
30
|
-
FORMAT_EXTENSION = "hspy"
|
|
31
|
-
|
|
32
|
-
def export_data(self, node: Node, filename) -> None:
|
|
33
|
-
"""Exporting a .h5 node as a hyperspy object"""
|
|
34
|
-
|
|
35
|
-
# first verify if the node type is compatible with export. Only data nodes are.
|
|
36
|
-
############## compatible with v4 done by Seb
|
|
37
|
-
nodetype = node.attrs['data_type']
|
|
38
|
-
if 'data' in nodetype.lower():
|
|
39
|
-
# If yes we can use this function (the same for plotting in h5browser) to extract information
|
|
40
|
-
|
|
41
|
-
data_loader = DataLoader(node.to_h5_backend())
|
|
42
|
-
|
|
43
|
-
#use the method in data_saving below to load properly data from nodes. The data object is a DataWithAxes
|
|
44
|
-
#of dimensionality DataND
|
|
45
|
-
#you can get all axes (nav and signals) from data.axes
|
|
46
|
-
#each axis as an index corresponding to the data shape
|
|
47
|
-
# data.nav_index is a tuple containing the index of the nav axes
|
|
48
|
-
|
|
49
|
-
data = data_loader.load_data(node, with_bkg=False)
|
|
50
|
-
axes = data.axes #all axes
|
|
51
|
-
nav_axes = data.get_nav_axes_with_data() #only navigation one
|
|
52
|
-
|
|
53
|
-
#deprecated
|
|
54
|
-
# data, axes, nav_axes, is_spread = get_h5_data_from_node(node)
|
|
55
|
-
is_spread = node.attrs['distribution'] != 'uniform'
|
|
56
|
-
|
|
57
|
-
data_array = data.data.reshape(data.shape, order='F')
|
|
58
|
-
logger.debug(f"extracted data of shape {data.shape}")
|
|
59
|
-
logger.debug(f"extracted axes: {axes}")
|
|
60
|
-
#################################### TODO below to be done by Nicolas :-) and should be tested!!
|
|
61
|
-
|
|
62
|
-
# get_h5_data_from_node will return sometimes empty axes that we must yeet.
|
|
63
|
-
axes_keys_to_remove = []
|
|
64
|
-
for key, ax in axes.items():
|
|
65
|
-
if ax['data'] is None:
|
|
66
|
-
logger.warning(f'Dropping axis {key} due to empty data')
|
|
67
|
-
axes_keys_to_remove.append(key)
|
|
68
|
-
for key in axes_keys_to_remove:
|
|
69
|
-
del axes[key]
|
|
70
|
-
|
|
71
|
-
else:
|
|
72
|
-
# Else just raise an error.
|
|
73
|
-
raise NotImplementedError(f"hspy export not supported for nodes of type {nodetype}'. "
|
|
74
|
-
f"Export from the data node instead.")
|
|
75
|
-
|
|
76
|
-
# Verify that this is not an adaptive scan. If it is we throw and say it is not supported.
|
|
77
|
-
if is_spread:
|
|
78
|
-
raise NotImplementedError(f"hspy export not supported for adaptive scan data.")
|
|
79
|
-
|
|
80
|
-
# Then we build the hyperspy axes objects.
|
|
81
|
-
hyperspy_axes = []
|
|
82
|
-
for key, ax in axes.items():
|
|
83
|
-
logger.info(f"Extracting axis {ax['label']}.")
|
|
84
|
-
unique_ax = extract_axis(ax)
|
|
85
|
-
try:
|
|
86
|
-
indexv = data.shape.index(len(unique_ax))
|
|
87
|
-
logger.info(f"{ax['label']}, size {len(unique_ax)}, data index: {indexv}")
|
|
88
|
-
except ValueError:
|
|
89
|
-
raise ValueError(f"Signal axis of length {len(unique_ax)} does not match any "
|
|
90
|
-
f"dimension in data of shape {data.shape} ")
|
|
91
|
-
is_nav = key.startswith('nav')
|
|
92
|
-
hyperspy_axes.append(self.build_hyperspy_axis(unique_ax, data_idx=indexv, label=ax['label'],
|
|
93
|
-
unit=ax['units'], navigate=is_nav))
|
|
94
|
-
|
|
95
|
-
ordered_axes = sorted(hyperspy_axes, key=lambda d: d['index_in_array'])
|
|
96
|
-
for ax in ordered_axes:
|
|
97
|
-
del ax['index_in_array']
|
|
98
|
-
# Then we build the hyperspy object. First we must know its dimensionality
|
|
99
|
-
# from the number of signal axes.
|
|
100
|
-
dim = len(axes) - len(nav_axes)
|
|
101
|
-
if dim == 1:
|
|
102
|
-
# Then signal1D
|
|
103
|
-
sig = hs.signals.Signal1D(data=data, original_metadata={}, axes=ordered_axes)
|
|
104
|
-
elif dim == 2:
|
|
105
|
-
# Then signal2D
|
|
106
|
-
sig = hs.signals.Signal2D(data=data, original_metadata={}, axes=ordered_axes)
|
|
107
|
-
else:
|
|
108
|
-
# Then basesignal
|
|
109
|
-
sig = hs.signals.BaseSignal(data=data, original_metadata={}, axes=ordered_axes)
|
|
110
|
-
|
|
111
|
-
# Finally save
|
|
112
|
-
sig.save(filename)
|
|
113
|
-
|
|
114
|
-
def build_hyperspy_axis(self, ax_data: np.ndarray, data_idx: int,
|
|
115
|
-
label: str, unit: str, navigate: bool) -> dict:
|
|
116
|
-
"""Build an axis based on the input data. Choose between a UniformDataAxis or
|
|
117
|
-
DataAxis object based on a quick linearity check of the input data."""
|
|
118
|
-
offset, scale = verify_axis_data_uniformity(ax_data)
|
|
119
|
-
if offset is not None:
|
|
120
|
-
axis_dict = {'_type': 'UniformDataAxis',
|
|
121
|
-
'index_in_array': data_idx,
|
|
122
|
-
'name': label,
|
|
123
|
-
'units': unit,
|
|
124
|
-
'navigate': navigate,
|
|
125
|
-
'size': len(ax_data),
|
|
126
|
-
'scale': scale,
|
|
127
|
-
'offset': offset}
|
|
128
|
-
else:
|
|
129
|
-
axis_dict = {'_type': 'DataAxis',
|
|
130
|
-
'index_in_array': data_idx,
|
|
131
|
-
'name': label,
|
|
132
|
-
'units': unit,
|
|
133
|
-
'navigate': navigate,
|
|
134
|
-
'size': len(ax_data),
|
|
135
|
-
'axis': ax_data}
|
|
136
|
-
|
|
137
|
-
return axis_dict
|
|
138
|
-
|
|
139
|
-
def build_hyperspy_original_metadata(self, node: Node):
|
|
140
|
-
"""Build original metadata dictionary"""
|
|
141
|
-
pass
|
|
142
|
-
except:
|
|
143
|
-
pass
|