datalab-platform 0.0.1.dev0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datalab/__init__.py +35 -2
- datalab/adapters_metadata/__init__.py +31 -0
- datalab/adapters_metadata/base_adapter.py +316 -0
- datalab/adapters_metadata/common.py +422 -0
- datalab/adapters_metadata/geometry_adapter.py +98 -0
- datalab/adapters_metadata/table_adapter.py +84 -0
- datalab/adapters_plotpy/__init__.py +54 -0
- datalab/adapters_plotpy/annotations.py +124 -0
- datalab/adapters_plotpy/base.py +110 -0
- datalab/adapters_plotpy/converters.py +86 -0
- datalab/adapters_plotpy/factories.py +80 -0
- datalab/adapters_plotpy/objects/__init__.py +0 -0
- datalab/adapters_plotpy/objects/base.py +197 -0
- datalab/adapters_plotpy/objects/image.py +157 -0
- datalab/adapters_plotpy/objects/scalar.py +565 -0
- datalab/adapters_plotpy/objects/signal.py +264 -0
- datalab/adapters_plotpy/roi/__init__.py +0 -0
- datalab/adapters_plotpy/roi/base.py +146 -0
- datalab/adapters_plotpy/roi/factory.py +93 -0
- datalab/adapters_plotpy/roi/image.py +207 -0
- datalab/adapters_plotpy/roi/signal.py +72 -0
- datalab/app.py +98 -0
- datalab/config.py +817 -0
- datalab/control/__init__.py +0 -0
- datalab/control/baseproxy.py +776 -0
- datalab/control/proxy.py +343 -0
- datalab/control/remote.py +1005 -0
- datalab/data/doc/DataLab_en.pdf +0 -0
- datalab/data/doc/DataLab_fr.pdf +0 -0
- datalab/data/icons/analysis/delete_results.svg +109 -0
- datalab/data/icons/analysis/fw1e2.svg +156 -0
- datalab/data/icons/analysis/fwhm.svg +156 -0
- datalab/data/icons/analysis/histogram.svg +49 -0
- datalab/data/icons/analysis/peak_detect.svg +160 -0
- datalab/data/icons/analysis/plot_results.svg +151 -0
- datalab/data/icons/analysis/show_results.svg +83 -0
- datalab/data/icons/analysis/stats.svg +49 -0
- datalab/data/icons/analysis.svg +120 -0
- datalab/data/icons/apply.svg +3 -0
- datalab/data/icons/check_all.svg +15 -0
- datalab/data/icons/collapse.svg +44 -0
- datalab/data/icons/collapse_selection.svg +63 -0
- datalab/data/icons/console.svg +101 -0
- datalab/data/icons/create/1d-normal.svg +8 -0
- datalab/data/icons/create/1d-poisson.svg +9 -0
- datalab/data/icons/create/1d-uniform.svg +8 -0
- datalab/data/icons/create/1d-zero.svg +57 -0
- datalab/data/icons/create/2d-gaussian.svg +56 -0
- datalab/data/icons/create/2d-normal.svg +38 -0
- datalab/data/icons/create/2d-poisson.svg +38 -0
- datalab/data/icons/create/2d-ramp.svg +90 -0
- datalab/data/icons/create/2d-sinc.svg +62 -0
- datalab/data/icons/create/2d-uniform.svg +38 -0
- datalab/data/icons/create/2d-zero.svg +13 -0
- datalab/data/icons/create/checkerboard.svg +39 -0
- datalab/data/icons/create/cosine.svg +12 -0
- datalab/data/icons/create/exponential.svg +55 -0
- datalab/data/icons/create/gaussian.svg +12 -0
- datalab/data/icons/create/grating.svg +29 -0
- datalab/data/icons/create/linear_chirp.svg +7 -0
- datalab/data/icons/create/logistic.svg +7 -0
- datalab/data/icons/create/lorentzian.svg +12 -0
- datalab/data/icons/create/planck.svg +12 -0
- datalab/data/icons/create/polynomial.svg +7 -0
- datalab/data/icons/create/pulse.svg +12 -0
- datalab/data/icons/create/ring.svg +18 -0
- datalab/data/icons/create/sawtooth.svg +7 -0
- datalab/data/icons/create/siemens.svg +35 -0
- datalab/data/icons/create/sinc.svg +12 -0
- datalab/data/icons/create/sine.svg +7 -0
- datalab/data/icons/create/square.svg +7 -0
- datalab/data/icons/create/square_pulse.svg +7 -0
- datalab/data/icons/create/step.svg +7 -0
- datalab/data/icons/create/step_pulse.svg +12 -0
- datalab/data/icons/create/triangle.svg +7 -0
- datalab/data/icons/create/voigt.svg +12 -0
- datalab/data/icons/edit/annotations.svg +72 -0
- datalab/data/icons/edit/annotations_copy.svg +114 -0
- datalab/data/icons/edit/annotations_delete.svg +83 -0
- datalab/data/icons/edit/annotations_edit.svg +98 -0
- datalab/data/icons/edit/annotations_export.svg +85 -0
- datalab/data/icons/edit/annotations_import.svg +85 -0
- datalab/data/icons/edit/annotations_paste.svg +100 -0
- datalab/data/icons/edit/copy_titles.svg +109 -0
- datalab/data/icons/edit/delete.svg +84 -0
- datalab/data/icons/edit/delete_all.svg +214 -0
- datalab/data/icons/edit/duplicate.svg +64 -0
- datalab/data/icons/edit/goto_source.svg +60 -0
- datalab/data/icons/edit/metadata.svg +60 -0
- datalab/data/icons/edit/metadata_add.svg +80 -0
- datalab/data/icons/edit/metadata_copy.svg +96 -0
- datalab/data/icons/edit/metadata_delete.svg +62 -0
- datalab/data/icons/edit/metadata_export.svg +68 -0
- datalab/data/icons/edit/metadata_import.svg +68 -0
- datalab/data/icons/edit/metadata_paste.svg +79 -0
- datalab/data/icons/edit/move_down.svg +55 -0
- datalab/data/icons/edit/move_up.svg +54 -0
- datalab/data/icons/edit/new_group.svg +76 -0
- datalab/data/icons/edit/recompute.svg +60 -0
- datalab/data/icons/edit/rename.svg +49 -0
- datalab/data/icons/edit.svg +16 -0
- datalab/data/icons/expand.svg +44 -0
- datalab/data/icons/expand_selection.svg +63 -0
- datalab/data/icons/fit/cdf_fit.svg +56 -0
- datalab/data/icons/fit/exponential_fit.svg +55 -0
- datalab/data/icons/fit/gaussian_fit.svg +62 -0
- datalab/data/icons/fit/interactive_fit.svg +101 -0
- datalab/data/icons/fit/linear_fit.svg +57 -0
- datalab/data/icons/fit/lorentzian_fit.svg +209 -0
- datalab/data/icons/fit/multigaussian_fit.svg +85 -0
- datalab/data/icons/fit/multilorentzian_fit.svg +85 -0
- datalab/data/icons/fit/piecewiseexponential_fit.svg +209 -0
- datalab/data/icons/fit/planckian_fit.svg +62 -0
- datalab/data/icons/fit/polynomial_fit.svg +59 -0
- datalab/data/icons/fit/sigmoid_fit.svg +56 -0
- datalab/data/icons/fit/sinusoidal_fit.svg +72 -0
- datalab/data/icons/fit/twohalfgaussian_fit.svg +63 -0
- datalab/data/icons/fit/voigt_fit.svg +57 -0
- datalab/data/icons/group.svg +56 -0
- datalab/data/icons/h5/h5array.svg +59 -0
- datalab/data/icons/h5/h5attrs.svg +75 -0
- datalab/data/icons/h5/h5browser.svg +133 -0
- datalab/data/icons/h5/h5file.svg +69 -0
- datalab/data/icons/h5/h5group.svg +49 -0
- datalab/data/icons/h5/h5scalar.svg +1 -0
- datalab/data/icons/help_pdf.svg +46 -0
- datalab/data/icons/history.svg +7 -0
- datalab/data/icons/image.svg +135 -0
- datalab/data/icons/io/fileopen_directory.svg +60 -0
- datalab/data/icons/io/fileopen_h5.svg +84 -0
- datalab/data/icons/io/fileopen_ima.svg +187 -0
- datalab/data/icons/io/fileopen_py.svg +123 -0
- datalab/data/icons/io/fileopen_sig.svg +138 -0
- datalab/data/icons/io/filesave_h5.svg +97 -0
- datalab/data/icons/io/filesave_ima.svg +200 -0
- datalab/data/icons/io/filesave_py.svg +136 -0
- datalab/data/icons/io/filesave_sig.svg +151 -0
- datalab/data/icons/io/import_text.svg +144 -0
- datalab/data/icons/io/save_to_directory.svg +134 -0
- datalab/data/icons/io.svg +84 -0
- datalab/data/icons/libre-camera-flash-off.svg +1 -0
- datalab/data/icons/libre-camera-flash-on.svg +1 -0
- datalab/data/icons/libre-gui-about.svg +1 -0
- datalab/data/icons/libre-gui-action-delete.svg +1 -0
- datalab/data/icons/libre-gui-add.svg +1 -0
- datalab/data/icons/libre-gui-arrow-down.svg +1 -0
- datalab/data/icons/libre-gui-arrow-left.svg +1 -0
- datalab/data/icons/libre-gui-arrow-right.svg +1 -0
- datalab/data/icons/libre-gui-arrow-up.svg +1 -0
- datalab/data/icons/libre-gui-close.svg +40 -0
- datalab/data/icons/libre-gui-cogs.svg +1 -0
- datalab/data/icons/libre-gui-globe.svg +1 -0
- datalab/data/icons/libre-gui-help.svg +1 -0
- datalab/data/icons/libre-gui-link.svg +1 -0
- datalab/data/icons/libre-gui-menu.svg +1 -0
- datalab/data/icons/libre-gui-pencil.svg +1 -0
- datalab/data/icons/libre-gui-plugin.svg +1 -0
- datalab/data/icons/libre-gui-questions.svg +1 -0
- datalab/data/icons/libre-gui-settings.svg +1 -0
- datalab/data/icons/libre-gui-unlink.svg +1 -0
- datalab/data/icons/libre-tech-ram.svg +1 -0
- datalab/data/icons/libre-toolbox.svg +1 -0
- datalab/data/icons/logs.svg +1 -0
- datalab/data/icons/markers.svg +74 -0
- datalab/data/icons/menu.svg +13 -0
- datalab/data/icons/new_ima.svg +148 -0
- datalab/data/icons/new_sig.svg +123 -0
- datalab/data/icons/operations/abs.svg +116 -0
- datalab/data/icons/operations/arithmetic.svg +123 -0
- datalab/data/icons/operations/average.svg +124 -0
- datalab/data/icons/operations/complex_from_magnitude_phase.svg +116 -0
- datalab/data/icons/operations/complex_from_real_imag.svg +124 -0
- datalab/data/icons/operations/constant.svg +116 -0
- datalab/data/icons/operations/constant_add.svg +109 -0
- datalab/data/icons/operations/constant_divide.svg +109 -0
- datalab/data/icons/operations/constant_multiply.svg +109 -0
- datalab/data/icons/operations/constant_subtract.svg +109 -0
- datalab/data/icons/operations/convert_dtype.svg +117 -0
- datalab/data/icons/operations/convolution.svg +46 -0
- datalab/data/icons/operations/deconvolution.svg +57 -0
- datalab/data/icons/operations/derivative.svg +127 -0
- datalab/data/icons/operations/difference.svg +52 -0
- datalab/data/icons/operations/division.svg +139 -0
- datalab/data/icons/operations/exp.svg +116 -0
- datalab/data/icons/operations/flip_horizontally.svg +69 -0
- datalab/data/icons/operations/flip_vertically.svg +74 -0
- datalab/data/icons/operations/im.svg +124 -0
- datalab/data/icons/operations/integral.svg +50 -0
- datalab/data/icons/operations/inverse.svg +143 -0
- datalab/data/icons/operations/log10.svg +109 -0
- datalab/data/icons/operations/phase.svg +116 -0
- datalab/data/icons/operations/power.svg +118 -0
- datalab/data/icons/operations/product.svg +124 -0
- datalab/data/icons/operations/profile.svg +379 -0
- datalab/data/icons/operations/profile_average.svg +399 -0
- datalab/data/icons/operations/profile_radial.svg +261 -0
- datalab/data/icons/operations/profile_segment.svg +262 -0
- datalab/data/icons/operations/quadratic_difference.svg +84 -0
- datalab/data/icons/operations/re.svg +124 -0
- datalab/data/icons/operations/rotate_left.svg +72 -0
- datalab/data/icons/operations/rotate_right.svg +72 -0
- datalab/data/icons/operations/signals_to_image.svg +314 -0
- datalab/data/icons/operations/sqrt.svg +110 -0
- datalab/data/icons/operations/std.svg +124 -0
- datalab/data/icons/operations/sum.svg +102 -0
- datalab/data/icons/play_demo.svg +9 -0
- datalab/data/icons/processing/axis_transform.svg +62 -0
- datalab/data/icons/processing/bandpass.svg +79 -0
- datalab/data/icons/processing/bandstop.svg +71 -0
- datalab/data/icons/processing/binning.svg +126 -0
- datalab/data/icons/processing/clip.svg +119 -0
- datalab/data/icons/processing/detrending.svg +173 -0
- datalab/data/icons/processing/distribute_on_grid.svg +769 -0
- datalab/data/icons/processing/edge_detection.svg +46 -0
- datalab/data/icons/processing/erase.svg +1 -0
- datalab/data/icons/processing/exposure.svg +143 -0
- datalab/data/icons/processing/fourier.svg +104 -0
- datalab/data/icons/processing/highpass.svg +59 -0
- datalab/data/icons/processing/interpolation.svg +71 -0
- datalab/data/icons/processing/level_adjustment.svg +70 -0
- datalab/data/icons/processing/lowpass.svg +60 -0
- datalab/data/icons/processing/morphology.svg +49 -0
- datalab/data/icons/processing/noise_addition.svg +114 -0
- datalab/data/icons/processing/noise_reduction.svg +38 -0
- datalab/data/icons/processing/normalize.svg +84 -0
- datalab/data/icons/processing/offset_correction.svg +131 -0
- datalab/data/icons/processing/resampling1d.svg +101 -0
- datalab/data/icons/processing/resampling2d.svg +240 -0
- datalab/data/icons/processing/reset_positions.svg +185 -0
- datalab/data/icons/processing/resize.svg +9 -0
- datalab/data/icons/processing/reverse_signal_x.svg +171 -0
- datalab/data/icons/processing/stability.svg +11 -0
- datalab/data/icons/processing/swap_x_y.svg +65 -0
- datalab/data/icons/processing/thresholding.svg +63 -0
- datalab/data/icons/processing/windowing.svg +45 -0
- datalab/data/icons/properties.svg +26 -0
- datalab/data/icons/reset.svg +9 -0
- datalab/data/icons/restore.svg +40 -0
- datalab/data/icons/roi/roi.svg +76 -0
- datalab/data/icons/roi/roi_coordinate.svg +78 -0
- datalab/data/icons/roi/roi_copy.svg +112 -0
- datalab/data/icons/roi/roi_delete.svg +81 -0
- datalab/data/icons/roi/roi_export.svg +87 -0
- datalab/data/icons/roi/roi_graphical.svg +78 -0
- datalab/data/icons/roi/roi_grid.svg +67 -0
- datalab/data/icons/roi/roi_ima.svg +188 -0
- datalab/data/icons/roi/roi_import.svg +87 -0
- datalab/data/icons/roi/roi_new.svg +81 -0
- datalab/data/icons/roi/roi_new_circle.svg +95 -0
- datalab/data/icons/roi/roi_new_polygon.svg +110 -0
- datalab/data/icons/roi/roi_new_rectangle.svg +70 -0
- datalab/data/icons/roi/roi_paste.svg +98 -0
- datalab/data/icons/roi/roi_sig.svg +124 -0
- datalab/data/icons/shapes.svg +134 -0
- datalab/data/icons/signal.svg +103 -0
- datalab/data/icons/table.svg +85 -0
- datalab/data/icons/table_unavailable.svg +102 -0
- datalab/data/icons/to_signal.svg +124 -0
- datalab/data/icons/tour/next.svg +44 -0
- datalab/data/icons/tour/previous.svg +44 -0
- datalab/data/icons/tour/rewind.svg +51 -0
- datalab/data/icons/tour/stop.svg +47 -0
- datalab/data/icons/tour/tour.svg +16 -0
- datalab/data/icons/uncheck_all.svg +78 -0
- datalab/data/icons/view/curve_antialiasing.svg +50 -0
- datalab/data/icons/view/new_window.svg +98 -0
- datalab/data/icons/view/refresh-auto.svg +57 -0
- datalab/data/icons/view/refresh-manual.svg +51 -0
- datalab/data/icons/view/reset_curve_styles.svg +96 -0
- datalab/data/icons/view/show_first.svg +55 -0
- datalab/data/icons/view/show_titles.svg +46 -0
- datalab/data/icons/visualization.svg +51 -0
- datalab/data/logo/DataLab-Banner-150.png +0 -0
- datalab/data/logo/DataLab-Banner-200.png +0 -0
- datalab/data/logo/DataLab-Banner2-100.png +0 -0
- datalab/data/logo/DataLab-Splash.png +0 -0
- datalab/data/logo/DataLab-watermark.png +0 -0
- datalab/data/logo/DataLab.svg +83 -0
- datalab/data/tests/reordering_test.h5 +0 -0
- datalab/data/tutorials/fabry_perot/fabry-perot1.jpg +0 -0
- datalab/data/tutorials/fabry_perot/fabry-perot2.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_13.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_18.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_23.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_30.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_35.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_40.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_45.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_50.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_55.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_60.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_65.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_70.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_75.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_80.jpg +0 -0
- datalab/env.py +542 -0
- datalab/gui/__init__.py +89 -0
- datalab/gui/actionhandler.py +1701 -0
- datalab/gui/docks.py +473 -0
- datalab/gui/h5io.py +150 -0
- datalab/gui/macroeditor.py +310 -0
- datalab/gui/main.py +2081 -0
- datalab/gui/newobject.py +217 -0
- datalab/gui/objectview.py +766 -0
- datalab/gui/panel/__init__.py +48 -0
- datalab/gui/panel/base.py +3254 -0
- datalab/gui/panel/image.py +157 -0
- datalab/gui/panel/macro.py +607 -0
- datalab/gui/panel/signal.py +164 -0
- datalab/gui/plothandler.py +800 -0
- datalab/gui/processor/__init__.py +84 -0
- datalab/gui/processor/base.py +2456 -0
- datalab/gui/processor/catcher.py +75 -0
- datalab/gui/processor/image.py +1214 -0
- datalab/gui/processor/signal.py +755 -0
- datalab/gui/profiledialog.py +333 -0
- datalab/gui/roieditor.py +633 -0
- datalab/gui/roigrideditor.py +208 -0
- datalab/gui/settings.py +612 -0
- datalab/gui/tour.py +908 -0
- datalab/h5/__init__.py +12 -0
- datalab/h5/common.py +314 -0
- datalab/h5/generic.py +580 -0
- datalab/h5/native.py +39 -0
- datalab/h5/utils.py +95 -0
- datalab/objectmodel.py +640 -0
- datalab/plugins/_readme_.txt +9 -0
- datalab/plugins/datalab_imageformats.py +175 -0
- datalab/plugins/datalab_testdata.py +190 -0
- datalab/plugins.py +355 -0
- datalab/tests/__init__.py +199 -0
- datalab/tests/backbone/__init__.py +1 -0
- datalab/tests/backbone/config_unit_test.py +170 -0
- datalab/tests/backbone/config_versioning_unit_test.py +34 -0
- datalab/tests/backbone/dictlistserial_app_test.py +38 -0
- datalab/tests/backbone/errorcatcher_unit_test.py +69 -0
- datalab/tests/backbone/errormsgbox_unit_test.py +50 -0
- datalab/tests/backbone/execenv_unit.py +262 -0
- datalab/tests/backbone/loadtest_gdi.py +147 -0
- datalab/tests/backbone/long_callback.py +96 -0
- datalab/tests/backbone/main_app_test.py +137 -0
- datalab/tests/backbone/memory_leak.py +43 -0
- datalab/tests/backbone/procisolation1_unit.py +128 -0
- datalab/tests/backbone/procisolation2_unit.py +171 -0
- datalab/tests/backbone/procisolation_unit_test.py +22 -0
- datalab/tests/backbone/profiling_app.py +27 -0
- datalab/tests/backbone/strings_unit_test.py +65 -0
- datalab/tests/backbone/title_formatting_unit_test.py +82 -0
- datalab/tests/conftest.py +131 -0
- datalab/tests/features/__init__.py +1 -0
- datalab/tests/features/applauncher/__init__.py +1 -0
- datalab/tests/features/applauncher/launcher1_app_test.py +28 -0
- datalab/tests/features/applauncher/launcher2_app_test.py +30 -0
- datalab/tests/features/common/__init__.py +1 -0
- datalab/tests/features/common/add_metadata_app_test.py +134 -0
- datalab/tests/features/common/add_metadata_unit_test.py +267 -0
- datalab/tests/features/common/annotations_management_unit_test.py +152 -0
- datalab/tests/features/common/auto_analysis_recompute_unit_test.py +240 -0
- datalab/tests/features/common/createobject_unit_test.py +50 -0
- datalab/tests/features/common/geometry_results_app_test.py +135 -0
- datalab/tests/features/common/interactive_processing_test.py +1109 -0
- datalab/tests/features/common/io_app_test.py +75 -0
- datalab/tests/features/common/large_results_app_test.py +187 -0
- datalab/tests/features/common/metadata_all_patterns_test.py +103 -0
- datalab/tests/features/common/metadata_app_test.py +139 -0
- datalab/tests/features/common/metadata_io_unit_test.py +60 -0
- datalab/tests/features/common/misc_app_test.py +236 -0
- datalab/tests/features/common/multiple_geometry_results_unit_test.py +122 -0
- datalab/tests/features/common/multiple_table_results_unit_test.py +64 -0
- datalab/tests/features/common/operation_modes_app_test.py +392 -0
- datalab/tests/features/common/plot_results_app_test.py +278 -0
- datalab/tests/features/common/reorder_app_test.py +75 -0
- datalab/tests/features/common/result_deletion_unit_test.py +96 -0
- datalab/tests/features/common/result_merged_label_unit_test.py +154 -0
- datalab/tests/features/common/result_shape_settings_unit_test.py +223 -0
- datalab/tests/features/common/roi_plotitem_unit_test.py +64 -0
- datalab/tests/features/common/roieditor_unit_test.py +102 -0
- datalab/tests/features/common/save_to_dir_app_test.py +163 -0
- datalab/tests/features/common/save_to_dir_unit_test.py +474 -0
- datalab/tests/features/common/stat_app_test.py +40 -0
- datalab/tests/features/common/stats_tools_unit_test.py +77 -0
- datalab/tests/features/common/table_results_app_test.py +52 -0
- datalab/tests/features/common/textimport_unit_test.py +131 -0
- datalab/tests/features/common/uuid_preservation_test.py +281 -0
- datalab/tests/features/common/worker_unit_test.py +402 -0
- datalab/tests/features/control/__init__.py +1 -0
- datalab/tests/features/control/connect_dialog.py +28 -0
- datalab/tests/features/control/embedded1_unit_test.py +304 -0
- datalab/tests/features/control/embedded2_unit_test.py +52 -0
- datalab/tests/features/control/remoteclient_app_test.py +219 -0
- datalab/tests/features/control/remoteclient_unit.py +75 -0
- datalab/tests/features/control/simpleclient_unit_test.py +321 -0
- datalab/tests/features/hdf5/__init__.py +1 -0
- datalab/tests/features/hdf5/h5browser1_unit_test.py +31 -0
- datalab/tests/features/hdf5/h5browser2_unit.py +55 -0
- datalab/tests/features/hdf5/h5browser_app_test.py +77 -0
- datalab/tests/features/hdf5/h5import_app_test.py +25 -0
- datalab/tests/features/hdf5/h5importer_app_test.py +34 -0
- datalab/tests/features/image/__init__.py +1 -0
- datalab/tests/features/image/annotations_app_test.py +28 -0
- datalab/tests/features/image/annotations_unit_test.py +80 -0
- datalab/tests/features/image/average_app_test.py +46 -0
- datalab/tests/features/image/background_dialog_test.py +70 -0
- datalab/tests/features/image/blobs_app_test.py +50 -0
- datalab/tests/features/image/contour_app_test.py +42 -0
- datalab/tests/features/image/contour_fabryperot_app_test.py +51 -0
- datalab/tests/features/image/denoise_app_test.py +31 -0
- datalab/tests/features/image/distribute_on_grid_app_test.py +95 -0
- datalab/tests/features/image/edges_app_test.py +31 -0
- datalab/tests/features/image/erase_app_test.py +21 -0
- datalab/tests/features/image/fft2d_app_test.py +27 -0
- datalab/tests/features/image/flatfield_app_test.py +40 -0
- datalab/tests/features/image/geometry_transform_unit_test.py +396 -0
- datalab/tests/features/image/imagetools_app_test.py +51 -0
- datalab/tests/features/image/imagetools_unit_test.py +27 -0
- datalab/tests/features/image/load_app_test.py +73 -0
- datalab/tests/features/image/morph_app_test.py +32 -0
- datalab/tests/features/image/offsetcorrection_app_test.py +30 -0
- datalab/tests/features/image/peak2d_app_test.py +53 -0
- datalab/tests/features/image/profile_app_test.py +73 -0
- datalab/tests/features/image/profile_dialog_test.py +56 -0
- datalab/tests/features/image/roi_app_test.py +98 -0
- datalab/tests/features/image/roi_circ_app_test.py +62 -0
- datalab/tests/features/image/roi_manipulation_app_test.py +268 -0
- datalab/tests/features/image/roigrid_unit_test.py +60 -0
- datalab/tests/features/image/side_by_side_app_test.py +52 -0
- datalab/tests/features/macro/__init__.py +1 -0
- datalab/tests/features/macro/macro_app_test.py +28 -0
- datalab/tests/features/macro/macroeditor_unit_test.py +102 -0
- datalab/tests/features/signal/__init__.py +1 -0
- datalab/tests/features/signal/baseline_dialog_test.py +53 -0
- datalab/tests/features/signal/deltax_dialog_unit_test.py +34 -0
- datalab/tests/features/signal/fft1d_app_test.py +26 -0
- datalab/tests/features/signal/filter_app_test.py +44 -0
- datalab/tests/features/signal/fitdialog_unit_test.py +50 -0
- datalab/tests/features/signal/interpolation_app_test.py +110 -0
- datalab/tests/features/signal/loadbigsignal_app_test.py +80 -0
- datalab/tests/features/signal/multiple_rois_unit_test.py +132 -0
- datalab/tests/features/signal/pulse_features_app_test.py +118 -0
- datalab/tests/features/signal/pulse_features_roi_app_test.py +55 -0
- datalab/tests/features/signal/roi_app_test.py +78 -0
- datalab/tests/features/signal/roi_manipulation_app_test.py +261 -0
- datalab/tests/features/signal/select_xy_cursor_unit_test.py +46 -0
- datalab/tests/features/signal/signalpeakdetection_dialog_test.py +33 -0
- datalab/tests/features/signal/signals_to_image_app_test.py +98 -0
- datalab/tests/features/signal/xarray_compat_app_test.py +128 -0
- datalab/tests/features/tour_unit_test.py +22 -0
- datalab/tests/features/utilities/__init__.py +1 -0
- datalab/tests/features/utilities/installconf_unit_test.py +21 -0
- datalab/tests/features/utilities/logview_app_test.py +21 -0
- datalab/tests/features/utilities/logview_error.py +24 -0
- datalab/tests/features/utilities/logview_unit_test.py +21 -0
- datalab/tests/features/utilities/memstatus_app_test.py +42 -0
- datalab/tests/features/utilities/settings_unit_test.py +88 -0
- datalab/tests/scenarios/__init__.py +1 -0
- datalab/tests/scenarios/beautiful_app.py +121 -0
- datalab/tests/scenarios/common.py +463 -0
- datalab/tests/scenarios/demo.py +212 -0
- datalab/tests/scenarios/example_app_test.py +47 -0
- datalab/tests/scenarios/scenario_h5_app_test.py +75 -0
- datalab/tests/scenarios/scenario_ima1_app_test.py +34 -0
- datalab/tests/scenarios/scenario_ima2_app_test.py +34 -0
- datalab/tests/scenarios/scenario_mac_app_test.py +58 -0
- datalab/tests/scenarios/scenario_sig1_app_test.py +36 -0
- datalab/tests/scenarios/scenario_sig2_app_test.py +35 -0
- datalab/utils/__init__.py +1 -0
- datalab/utils/conf.py +304 -0
- datalab/utils/dephash.py +105 -0
- datalab/utils/qthelpers.py +633 -0
- datalab/utils/strings.py +34 -0
- datalab/utils/tests.py +0 -0
- datalab/widgets/__init__.py +1 -0
- datalab/widgets/connection.py +138 -0
- datalab/widgets/filedialog.py +91 -0
- datalab/widgets/fileviewer.py +84 -0
- datalab/widgets/fitdialog.py +788 -0
- datalab/widgets/h5browser.py +1048 -0
- datalab/widgets/imagebackground.py +111 -0
- datalab/widgets/instconfviewer.py +175 -0
- datalab/widgets/logviewer.py +80 -0
- datalab/widgets/signalbaseline.py +90 -0
- datalab/widgets/signalcursor.py +208 -0
- datalab/widgets/signaldeltax.py +151 -0
- datalab/widgets/signalpeak.py +199 -0
- datalab/widgets/status.py +249 -0
- datalab/widgets/textimport.py +786 -0
- datalab/widgets/warningerror.py +223 -0
- datalab/widgets/wizard.py +286 -0
- datalab_platform-1.0.0.dist-info/METADATA +121 -0
- datalab_platform-1.0.0.dist-info/RECORD +494 -0
- datalab_platform-0.0.1.dev0.dist-info/METADATA +0 -67
- datalab_platform-0.0.1.dev0.dist-info/RECORD +0 -7
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/WHEEL +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/entry_points.txt +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Annotation Adapter for PlotPy Integration
|
|
5
|
+
-----------------------------------------
|
|
6
|
+
|
|
7
|
+
This module bridges Sigima's format-agnostic annotation storage with PlotPy's
|
|
8
|
+
plot item system. It handles bidirectional conversion between:
|
|
9
|
+
- Sigima: list[dict] (JSON-serializable)
|
|
10
|
+
- PlotPy: list[AnnotatedShape] (plot items)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
from guidata.io import JSONReader, JSONWriter
|
|
19
|
+
from plotpy.io import load_items, save_items
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from plotpy.items import AnnotatedShape
|
|
23
|
+
from sigima.objects.base import BaseObj
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class PlotPyAnnotationAdapter:
|
|
27
|
+
"""Adapter for converting between Sigima annotations and PlotPy items.
|
|
28
|
+
|
|
29
|
+
This class provides the bridge between Sigima's generic annotation storage
|
|
30
|
+
(list of dicts) and PlotPy's specific plot item format.
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
>>> from sigima.objects.signal.creation import create_signal
|
|
34
|
+
>>> obj = create_signal("Test")
|
|
35
|
+
>>> adapter = PlotPyAnnotationAdapter(obj)
|
|
36
|
+
>>>
|
|
37
|
+
>>> # Add PlotPy items
|
|
38
|
+
>>> from plotpy.items import AnnotatedRectangle
|
|
39
|
+
>>> rect = AnnotatedRectangle(0, 0, 10, 10)
|
|
40
|
+
>>> adapter.add_items([rect])
|
|
41
|
+
>>>
|
|
42
|
+
>>> # Retrieve as PlotPy items
|
|
43
|
+
>>> items = adapter.get_items()
|
|
44
|
+
>>> len(items)
|
|
45
|
+
1
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self, obj: BaseObj):
|
|
49
|
+
"""Initialize adapter with an object.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
obj: Signal or image object with annotation support
|
|
53
|
+
"""
|
|
54
|
+
self.obj = obj
|
|
55
|
+
|
|
56
|
+
def get_items(self) -> list[AnnotatedShape]:
|
|
57
|
+
"""Get annotations as PlotPy items.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
List of PlotPy annotation items
|
|
61
|
+
|
|
62
|
+
Notes:
|
|
63
|
+
This method deserializes the JSON data stored in the object using
|
|
64
|
+
PlotPy's load_items() function.
|
|
65
|
+
"""
|
|
66
|
+
annotations = self.obj.get_annotations()
|
|
67
|
+
if not annotations:
|
|
68
|
+
return []
|
|
69
|
+
|
|
70
|
+
items = []
|
|
71
|
+
for ann_dict in annotations:
|
|
72
|
+
# Each annotation dict should contain PlotPy's JSON serialization
|
|
73
|
+
if "plotpy_json" in ann_dict:
|
|
74
|
+
try:
|
|
75
|
+
json_str = ann_dict["plotpy_json"]
|
|
76
|
+
for item in load_items(JSONReader(json_str)):
|
|
77
|
+
items.append(item)
|
|
78
|
+
except (json.JSONDecodeError, ValueError, KeyError):
|
|
79
|
+
# Skip invalid items
|
|
80
|
+
continue
|
|
81
|
+
|
|
82
|
+
return items
|
|
83
|
+
|
|
84
|
+
def set_items(self, items: list[AnnotatedShape]) -> None:
|
|
85
|
+
"""Set annotations from PlotPy items.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
items: List of PlotPy annotation items
|
|
89
|
+
|
|
90
|
+
Notes:
|
|
91
|
+
This method serializes PlotPy items to JSON using PlotPy's
|
|
92
|
+
save_items() function and stores them in the Sigima format.
|
|
93
|
+
"""
|
|
94
|
+
if not items:
|
|
95
|
+
self.obj.clear_annotations()
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
# Convert PlotPy items to our annotation format
|
|
99
|
+
annotations = []
|
|
100
|
+
for item in items:
|
|
101
|
+
writer = JSONWriter(None)
|
|
102
|
+
save_items(writer, [item])
|
|
103
|
+
ann_dict = {
|
|
104
|
+
"type": "plotpy_item",
|
|
105
|
+
"item_class": item.__class__.__name__,
|
|
106
|
+
"plotpy_json": writer.get_json(),
|
|
107
|
+
}
|
|
108
|
+
annotations.append(ann_dict)
|
|
109
|
+
|
|
110
|
+
self.obj.set_annotations(annotations)
|
|
111
|
+
|
|
112
|
+
def add_items(self, items: list[AnnotatedShape]) -> None:
|
|
113
|
+
"""Add PlotPy items to existing annotations.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
items: List of PlotPy annotation items to add
|
|
117
|
+
"""
|
|
118
|
+
current_items = self.get_items()
|
|
119
|
+
current_items.extend(items)
|
|
120
|
+
self.set_items(current_items)
|
|
121
|
+
|
|
122
|
+
def clear(self) -> None:
|
|
123
|
+
"""Clear all annotations."""
|
|
124
|
+
self.obj.clear_annotations()
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Base Module
|
|
5
|
+
--------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
from guidata.io import JSONReader, JSONWriter
|
|
16
|
+
from plotpy.io import load_items, save_items
|
|
17
|
+
from plotpy.items import (
|
|
18
|
+
AbstractLabelItem,
|
|
19
|
+
AnnotatedSegment,
|
|
20
|
+
AnnotatedShape,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from plotpy.items import AbstractShape
|
|
25
|
+
from plotpy.styles import AnnotationParam
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def config_annotated_shape(
|
|
29
|
+
item: AnnotatedShape,
|
|
30
|
+
fmt: str,
|
|
31
|
+
lbl: bool,
|
|
32
|
+
section: str | None = None,
|
|
33
|
+
option: str | None = None,
|
|
34
|
+
show_computations: bool | None = None,
|
|
35
|
+
):
|
|
36
|
+
"""Configurate annotated shape
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
item: Annotated shape item
|
|
40
|
+
fmt: Format string
|
|
41
|
+
lbl: Show label
|
|
42
|
+
section: Shape style section (e.g. "plot")
|
|
43
|
+
option: Shape style option (e.g. "shape/drag")
|
|
44
|
+
show_computations: Show computations
|
|
45
|
+
"""
|
|
46
|
+
param: AnnotationParam = item.annotationparam
|
|
47
|
+
param.format = fmt
|
|
48
|
+
param.show_label = lbl
|
|
49
|
+
if show_computations is not None:
|
|
50
|
+
param.show_computations = show_computations
|
|
51
|
+
|
|
52
|
+
if isinstance(item, AnnotatedSegment):
|
|
53
|
+
item.label.labelparam.anchor = "T"
|
|
54
|
+
item.label.labelparam.update_item(item.label)
|
|
55
|
+
|
|
56
|
+
param.update_item(item)
|
|
57
|
+
if section is not None and option is not None:
|
|
58
|
+
item.set_style(section, option)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# TODO: [P3] Move this function as a method of plot items in PlotPy
|
|
62
|
+
def set_plot_item_editable(
|
|
63
|
+
item: AbstractShape | AbstractLabelItem | AnnotatedShape, state
|
|
64
|
+
):
|
|
65
|
+
"""Set plot item editable state
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
item: Plot item
|
|
69
|
+
state: State
|
|
70
|
+
"""
|
|
71
|
+
item.set_movable(state)
|
|
72
|
+
item.set_resizable(state and not isinstance(item, AbstractLabelItem))
|
|
73
|
+
item.set_rotatable(state and not isinstance(item, AbstractLabelItem))
|
|
74
|
+
item.set_readonly(not state)
|
|
75
|
+
item.set_selectable(state)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def items_to_json(items: list) -> str | None:
|
|
79
|
+
"""Convert plot items to JSON string
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
items: list of plot items
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
JSON string or None if items is empty
|
|
86
|
+
"""
|
|
87
|
+
if items:
|
|
88
|
+
writer = JSONWriter(None)
|
|
89
|
+
save_items(writer, items)
|
|
90
|
+
return writer.get_json(indent=4)
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def json_to_items(json_str: str | None) -> list:
|
|
95
|
+
"""Convert JSON string to plot items
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
json_str: JSON string or None
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
List of plot items
|
|
102
|
+
"""
|
|
103
|
+
items = []
|
|
104
|
+
if json_str:
|
|
105
|
+
try:
|
|
106
|
+
for item in load_items(JSONReader(json_str)):
|
|
107
|
+
items.append(item)
|
|
108
|
+
except json.decoder.JSONDecodeError:
|
|
109
|
+
pass
|
|
110
|
+
return items
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Converters
|
|
5
|
+
-------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import TYPE_CHECKING
|
|
13
|
+
|
|
14
|
+
from plotpy.items import (
|
|
15
|
+
AnnotatedCircle,
|
|
16
|
+
AnnotatedPolygon,
|
|
17
|
+
AnnotatedRectangle,
|
|
18
|
+
AnnotatedXRange,
|
|
19
|
+
)
|
|
20
|
+
from sigima.objects import (
|
|
21
|
+
CircularROI,
|
|
22
|
+
PolygonalROI,
|
|
23
|
+
RectangularROI,
|
|
24
|
+
SegmentROI,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from datalab.adapters_plotpy.factories import create_adapter_from_object
|
|
28
|
+
from datalab.adapters_plotpy.roi.image import (
|
|
29
|
+
PolygonalROIPlotPyAdapter,
|
|
30
|
+
RectangularROIPlotPyAdapter,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
from sigima.objects import ImageObj, SignalObj
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def plotitem_to_singleroi(
|
|
38
|
+
plot_item: AnnotatedXRange
|
|
39
|
+
| AnnotatedRectangle
|
|
40
|
+
| AnnotatedCircle
|
|
41
|
+
| AnnotatedPolygon,
|
|
42
|
+
) -> SegmentROI | RectangularROI | CircularROI | PolygonalROI:
|
|
43
|
+
"""Create a single ROI from the given PlotPy item to integrate with DataLab
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
plot_item: The PlotPy item for which to create a single ROI
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
A single ROI instance
|
|
50
|
+
"""
|
|
51
|
+
# pylint: disable=import-outside-toplevel
|
|
52
|
+
from datalab.adapters_plotpy.roi.image import (
|
|
53
|
+
CircularROIPlotPyAdapter,
|
|
54
|
+
)
|
|
55
|
+
from datalab.adapters_plotpy.roi.signal import (
|
|
56
|
+
SegmentROIPlotPyAdapter,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if isinstance(plot_item, AnnotatedXRange):
|
|
60
|
+
adapter = SegmentROIPlotPyAdapter
|
|
61
|
+
elif isinstance(plot_item, AnnotatedRectangle):
|
|
62
|
+
adapter = RectangularROIPlotPyAdapter
|
|
63
|
+
elif isinstance(plot_item, AnnotatedCircle):
|
|
64
|
+
adapter = CircularROIPlotPyAdapter
|
|
65
|
+
elif isinstance(plot_item, AnnotatedPolygon):
|
|
66
|
+
adapter = PolygonalROIPlotPyAdapter
|
|
67
|
+
else:
|
|
68
|
+
raise TypeError(f"Unsupported PlotPy item type: {type(plot_item)}")
|
|
69
|
+
return adapter.from_plot_item(plot_item)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def singleroi_to_plotitem(
|
|
73
|
+
roi: SegmentROI | RectangularROI | CircularROI | PolygonalROI,
|
|
74
|
+
obj: SignalObj | ImageObj,
|
|
75
|
+
) -> AnnotatedXRange | AnnotatedRectangle | AnnotatedCircle | AnnotatedPolygon:
|
|
76
|
+
"""Create a PlotPy item from the given single ROI to integrate with DataLab
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
roi: The single ROI for which to create a PlotPy item
|
|
80
|
+
obj: The object (signal or image) associated with the ROI
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
A PlotPy item instance
|
|
84
|
+
"""
|
|
85
|
+
adapter = create_adapter_from_object(roi)
|
|
86
|
+
return adapter.to_plot_item(obj)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Factories
|
|
5
|
+
------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def create_adapter_from_object(object_to_adapt):
|
|
14
|
+
"""Create an adapter for the given object to integrate with PlotPy
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
object_to_adapt: The object to adapt (signal, image, ROI, or scalar result)
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
An adapter instance
|
|
21
|
+
"""
|
|
22
|
+
# pylint: disable=import-outside-toplevel
|
|
23
|
+
# Import adapters as needed to avoid circular imports
|
|
24
|
+
from sigima.objects import (
|
|
25
|
+
CircularROI,
|
|
26
|
+
ImageObj,
|
|
27
|
+
ImageROI,
|
|
28
|
+
PolygonalROI,
|
|
29
|
+
RectangularROI,
|
|
30
|
+
SegmentROI,
|
|
31
|
+
SignalObj,
|
|
32
|
+
SignalROI,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
from datalab.adapters_metadata import GeometryAdapter, TableAdapter
|
|
36
|
+
|
|
37
|
+
if isinstance(object_to_adapt, GeometryAdapter):
|
|
38
|
+
from datalab.adapters_plotpy.objects.scalar import GeometryPlotPyAdapter
|
|
39
|
+
|
|
40
|
+
adapter = GeometryPlotPyAdapter(object_to_adapt)
|
|
41
|
+
elif isinstance(object_to_adapt, TableAdapter):
|
|
42
|
+
from datalab.adapters_plotpy.objects.scalar import TablePlotPyAdapter
|
|
43
|
+
|
|
44
|
+
adapter = TablePlotPyAdapter(object_to_adapt)
|
|
45
|
+
|
|
46
|
+
elif isinstance(object_to_adapt, SignalObj):
|
|
47
|
+
from datalab.adapters_plotpy.objects.signal import SignalObjPlotPyAdapter
|
|
48
|
+
|
|
49
|
+
adapter = SignalObjPlotPyAdapter(object_to_adapt)
|
|
50
|
+
elif isinstance(object_to_adapt, SignalROI):
|
|
51
|
+
from datalab.adapters_plotpy.roi.signal import SignalROIPlotPyAdapter
|
|
52
|
+
|
|
53
|
+
adapter = SignalROIPlotPyAdapter(object_to_adapt)
|
|
54
|
+
elif isinstance(object_to_adapt, SegmentROI):
|
|
55
|
+
from datalab.adapters_plotpy.roi.signal import SegmentROIPlotPyAdapter
|
|
56
|
+
|
|
57
|
+
adapter = SegmentROIPlotPyAdapter(object_to_adapt)
|
|
58
|
+
elif isinstance(object_to_adapt, ImageObj):
|
|
59
|
+
from datalab.adapters_plotpy.objects.image import ImageObjPlotPyAdapter
|
|
60
|
+
|
|
61
|
+
adapter = ImageObjPlotPyAdapter(object_to_adapt)
|
|
62
|
+
elif isinstance(object_to_adapt, RectangularROI):
|
|
63
|
+
from datalab.adapters_plotpy.roi.image import RectangularROIPlotPyAdapter
|
|
64
|
+
|
|
65
|
+
adapter = RectangularROIPlotPyAdapter(object_to_adapt)
|
|
66
|
+
elif isinstance(object_to_adapt, CircularROI):
|
|
67
|
+
from datalab.adapters_plotpy.roi.image import CircularROIPlotPyAdapter
|
|
68
|
+
|
|
69
|
+
adapter = CircularROIPlotPyAdapter(object_to_adapt)
|
|
70
|
+
elif isinstance(object_to_adapt, PolygonalROI):
|
|
71
|
+
from datalab.adapters_plotpy.roi.image import PolygonalROIPlotPyAdapter
|
|
72
|
+
|
|
73
|
+
adapter = PolygonalROIPlotPyAdapter(object_to_adapt)
|
|
74
|
+
elif isinstance(object_to_adapt, ImageROI):
|
|
75
|
+
from datalab.adapters_plotpy.roi.image import ImageROIPlotPyAdapter
|
|
76
|
+
|
|
77
|
+
adapter = ImageROIPlotPyAdapter(object_to_adapt)
|
|
78
|
+
else:
|
|
79
|
+
raise TypeError(f"Unsupported object type: {type(object_to_adapt)}")
|
|
80
|
+
return adapter
|
|
File without changes
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Base Object Module
|
|
5
|
+
---------------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import abc
|
|
11
|
+
from typing import (
|
|
12
|
+
TYPE_CHECKING,
|
|
13
|
+
Any,
|
|
14
|
+
Generic,
|
|
15
|
+
TypeVar,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from guidata.dataset import update_dataset
|
|
19
|
+
from plotpy.items import (
|
|
20
|
+
AnnotatedShape,
|
|
21
|
+
)
|
|
22
|
+
from sigima.objects.base import (
|
|
23
|
+
ROI_KEY,
|
|
24
|
+
TypeObj,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from datalab.adapters_metadata import GeometryAdapter
|
|
28
|
+
from datalab.adapters_plotpy.annotations import PlotPyAnnotationAdapter
|
|
29
|
+
from datalab.adapters_plotpy.base import (
|
|
30
|
+
config_annotated_shape,
|
|
31
|
+
set_plot_item_editable,
|
|
32
|
+
)
|
|
33
|
+
from datalab.adapters_plotpy.objects.scalar import GeometryPlotPyAdapter
|
|
34
|
+
from datalab.config import Conf
|
|
35
|
+
|
|
36
|
+
if TYPE_CHECKING:
|
|
37
|
+
from plotpy.items import CurveItem, MaskedXYImageItem
|
|
38
|
+
|
|
39
|
+
TypePlotItem = TypeVar("TypePlotItem", bound="CurveItem | MaskedXYImageItem")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class BaseObjPlotPyAdapter(Generic[TypeObj, TypePlotItem]):
|
|
43
|
+
"""Object (signal/image) plot item adapter class"""
|
|
44
|
+
|
|
45
|
+
DEFAULT_FMT = "s" # This is overriden in children classes
|
|
46
|
+
CONF_FMT = Conf.view.sig_format # This is overriden in children classes
|
|
47
|
+
|
|
48
|
+
def __init__(self, obj: TypeObj) -> None:
|
|
49
|
+
"""Initialize the adapter with the object.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
obj: object (signal/image)
|
|
53
|
+
"""
|
|
54
|
+
self.obj = obj
|
|
55
|
+
self.__default_options = {
|
|
56
|
+
"format": "%" + self.CONF_FMT.get(self.DEFAULT_FMT),
|
|
57
|
+
"showlabel": Conf.view.show_label.get(False),
|
|
58
|
+
}
|
|
59
|
+
self.annotation_adapter = PlotPyAnnotationAdapter(obj)
|
|
60
|
+
|
|
61
|
+
def get_obj_option(self, name: str) -> Any:
|
|
62
|
+
"""Get object option value.
|
|
63
|
+
Args:
|
|
64
|
+
name: option name
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Option value
|
|
68
|
+
"""
|
|
69
|
+
default = self.__default_options[name]
|
|
70
|
+
return self.obj.get_metadata_option(name, default)
|
|
71
|
+
|
|
72
|
+
@abc.abstractmethod
|
|
73
|
+
def make_item(self, update_from: TypePlotItem | None = None) -> TypePlotItem:
|
|
74
|
+
"""Make plot item from data.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
update_from: update
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Plot item
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
@abc.abstractmethod
|
|
84
|
+
def update_item(self, item: TypePlotItem, data_changed: bool = True) -> None:
|
|
85
|
+
"""Update plot item from data.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
item: plot item
|
|
89
|
+
data_changed: if True, data has changed
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def add_annotations_from_items(self, items: list) -> None:
|
|
93
|
+
"""Add object annotations (annotation plot items).
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
items: annotation plot items
|
|
97
|
+
"""
|
|
98
|
+
# Use the new annotation adapter
|
|
99
|
+
self.annotation_adapter.add_items(items)
|
|
100
|
+
|
|
101
|
+
def set_annotations_from_items(self, items: list) -> None:
|
|
102
|
+
"""Set object annotations (annotation plot items), replacing any existing ones.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
items: annotation plot items
|
|
106
|
+
"""
|
|
107
|
+
# Use the new annotation adapter
|
|
108
|
+
self.annotation_adapter.set_items(items)
|
|
109
|
+
|
|
110
|
+
@abc.abstractmethod
|
|
111
|
+
def add_label_with_title(self, title: str | None = None) -> None:
|
|
112
|
+
"""Add label with title annotation
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
title: title (if None, use object title)
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def iterate_shape_items(self, editable: bool = False):
|
|
119
|
+
"""Iterate over shape items encoded in metadata (if any).
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
editable: if True, annotations are editable
|
|
123
|
+
|
|
124
|
+
Yields:
|
|
125
|
+
Plot item
|
|
126
|
+
"""
|
|
127
|
+
fmt = self.get_obj_option("format")
|
|
128
|
+
lbl = self.get_obj_option("showlabel")
|
|
129
|
+
for key, _value in self.obj.metadata.items():
|
|
130
|
+
if key == ROI_KEY:
|
|
131
|
+
roi = self.obj.roi
|
|
132
|
+
if roi is not None:
|
|
133
|
+
# Delayed import to avoid circular dependency
|
|
134
|
+
# pylint: disable=import-outside-toplevel
|
|
135
|
+
from datalab.adapters_plotpy.roi.factory import create_roi_adapter
|
|
136
|
+
|
|
137
|
+
adapter = create_roi_adapter(roi)
|
|
138
|
+
yield from adapter.iterate_roi_items(
|
|
139
|
+
self.obj, fmt=fmt, lbl=lbl, editable=False
|
|
140
|
+
)
|
|
141
|
+
# Process geometry results from metadata (using GeometryAdapter)
|
|
142
|
+
elif GeometryAdapter.match(key, _value):
|
|
143
|
+
try:
|
|
144
|
+
geomadapter = GeometryAdapter.from_metadata_entry(self.obj, key)
|
|
145
|
+
plot_adapter = GeometryPlotPyAdapter(geomadapter)
|
|
146
|
+
yield from plot_adapter.iterate_shape_items(
|
|
147
|
+
fmt, lbl, self.obj.PREFIX
|
|
148
|
+
)
|
|
149
|
+
except (ValueError, TypeError):
|
|
150
|
+
# Skip invalid entries
|
|
151
|
+
pass
|
|
152
|
+
# Use the new annotation adapter to get items
|
|
153
|
+
if self.obj.has_annotations():
|
|
154
|
+
for item in self.annotation_adapter.get_items():
|
|
155
|
+
if isinstance(item, AnnotatedShape):
|
|
156
|
+
config_annotated_shape(item, fmt, lbl)
|
|
157
|
+
set_plot_item_editable(item, editable)
|
|
158
|
+
yield item
|
|
159
|
+
|
|
160
|
+
def update_plot_item_parameters(self, item: TypePlotItem) -> None:
|
|
161
|
+
"""Update plot item parameters from object data/metadata
|
|
162
|
+
|
|
163
|
+
Takes into account a subset of plot item parameters. Those parameters may
|
|
164
|
+
have been overriden by object metadata entries or other object data. The goal
|
|
165
|
+
is to update the plot item accordingly.
|
|
166
|
+
|
|
167
|
+
This is *almost* the inverse operation of `update_metadata_from_plot_item`.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
item: plot item
|
|
171
|
+
"""
|
|
172
|
+
def_dict = Conf.view.get_def_dict(self.__class__.__name__[:3].lower())
|
|
173
|
+
self.obj.set_metadata_options_defaults(def_dict, overwrite=False)
|
|
174
|
+
|
|
175
|
+
# Subclasses have to override this method to update plot item parameters,
|
|
176
|
+
# then call this implementation of the method to update plot item.
|
|
177
|
+
update_dataset(item.param, self.obj.get_metadata_options())
|
|
178
|
+
item.param.update_item(item)
|
|
179
|
+
if item.selected:
|
|
180
|
+
item.select()
|
|
181
|
+
|
|
182
|
+
def update_metadata_from_plot_item(self, item: TypePlotItem) -> None:
|
|
183
|
+
"""Update metadata from plot item.
|
|
184
|
+
|
|
185
|
+
Takes into account a subset of plot item parameters. Those parameters may
|
|
186
|
+
have been modified by the user through the plot item GUI. The goal is to
|
|
187
|
+
update the metadata accordingly.
|
|
188
|
+
|
|
189
|
+
This is *almost* the inverse operation of `update_plot_item_parameters`.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
item: plot item
|
|
193
|
+
"""
|
|
194
|
+
def_dict = Conf.view.get_def_dict(self.__class__.__name__[:3].lower())
|
|
195
|
+
for key in def_dict:
|
|
196
|
+
if hasattr(item.param, key): # In case the PlotPy version is not up-to-date
|
|
197
|
+
self.obj.set_metadata_option(key, getattr(item.param, key))
|