datalab-platform 0.0.1.dev0__py3-none-any.whl → 1.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.
- 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.1.dist-info/METADATA +121 -0
- datalab_platform-1.0.1.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.1.dist-info}/WHEEL +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.1.dist-info}/entry_points.txt +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.1.dist-info}/licenses/LICENSE +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Scenarios common functions
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
8
|
+
# guitest: skip
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
import sigima.enums
|
|
14
|
+
import sigima.objects
|
|
15
|
+
import sigima.params
|
|
16
|
+
from sigima.tests.data import (
|
|
17
|
+
create_noisy_signal,
|
|
18
|
+
create_paracetamol_signal,
|
|
19
|
+
create_peak_image,
|
|
20
|
+
create_sincos_image,
|
|
21
|
+
iterate_image_creation,
|
|
22
|
+
iterate_signal_creation,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
from datalab.config import _
|
|
26
|
+
from datalab.gui.main import DLMainWindow
|
|
27
|
+
from datalab.gui.panel.image import ImagePanel
|
|
28
|
+
from datalab.gui.panel.signal import SignalPanel
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def __compute_1_to_1_operations(panel: SignalPanel | ImagePanel, number: int) -> None:
|
|
32
|
+
"""Test `compute_1_to_1` type operations on a signal or image
|
|
33
|
+
|
|
34
|
+
Requires that one signal or image has been added at index."""
|
|
35
|
+
assert len(panel) >= number - 1
|
|
36
|
+
panel.objview.select_objects((number,))
|
|
37
|
+
panel.processor.run_feature("gaussian_filter", sigima.params.GaussianParam())
|
|
38
|
+
panel.processor.run_feature("moving_average", sigima.params.MovingAverageParam())
|
|
39
|
+
panel.processor.run_feature("moving_median", sigima.params.MovingMedianParam())
|
|
40
|
+
panel.processor.run_feature("wiener")
|
|
41
|
+
panel.processor.run_feature("fft")
|
|
42
|
+
panel.processor.run_feature("ifft")
|
|
43
|
+
panel.processor.run_feature("absolute")
|
|
44
|
+
panel.processor.run_feature("magnitude_spectrum")
|
|
45
|
+
panel.processor.run_feature("phase_spectrum")
|
|
46
|
+
panel.processor.run_feature("psd")
|
|
47
|
+
panel.remove_object()
|
|
48
|
+
panel.processor.run_feature("real")
|
|
49
|
+
panel.remove_object()
|
|
50
|
+
panel.processor.run_feature("imag")
|
|
51
|
+
panel.remove_object()
|
|
52
|
+
panel.processor.run_feature(
|
|
53
|
+
"astype",
|
|
54
|
+
sigima.params.DataTypeIParam.create(dtype_str="float64"),
|
|
55
|
+
)
|
|
56
|
+
panel.processor.run_feature("log10")
|
|
57
|
+
panel.processor.run_feature("exp")
|
|
58
|
+
panel.processor.run_feature("transpose")
|
|
59
|
+
panel.processor.run_feature("transpose")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def compute_common_operations(panel: SignalPanel | ImagePanel) -> None:
|
|
63
|
+
"""Test operations common to signal/image
|
|
64
|
+
|
|
65
|
+
Requires that two (and only two) signals/images are created/added to panel
|
|
66
|
+
|
|
67
|
+
First signal/image is supposed to be always the same (reference)
|
|
68
|
+
Second signal/image is the tested object
|
|
69
|
+
"""
|
|
70
|
+
assert len(panel) == 2
|
|
71
|
+
|
|
72
|
+
panel.objview.select_objects((2,))
|
|
73
|
+
panel.processor.run_feature("difference", panel[1]) # difference with obj #1
|
|
74
|
+
panel.remove_object()
|
|
75
|
+
panel.objview.select_objects((2,))
|
|
76
|
+
panel.processor.run_feature("quadratic_difference", panel[2])
|
|
77
|
+
panel.delete_metadata()
|
|
78
|
+
|
|
79
|
+
const_oper_param = sigima.params.ConstantParam.create(value=2.0)
|
|
80
|
+
for const_oper in (
|
|
81
|
+
"addition_constant",
|
|
82
|
+
"difference_constant",
|
|
83
|
+
"product_constant",
|
|
84
|
+
"division_constant",
|
|
85
|
+
):
|
|
86
|
+
panel.objview.select_objects((3,))
|
|
87
|
+
panel.processor.run_feature(const_oper, const_oper_param)
|
|
88
|
+
|
|
89
|
+
panel.objview.select_objects((3,))
|
|
90
|
+
panel.remove_object()
|
|
91
|
+
|
|
92
|
+
panel.objview.select_objects((1, 2))
|
|
93
|
+
panel.processor.run_feature("addition")
|
|
94
|
+
panel.objview.select_objects((1, 2))
|
|
95
|
+
panel.processor.run_feature("addition")
|
|
96
|
+
panel.objview.select_objects((1, 2))
|
|
97
|
+
panel.processor.run_feature("product")
|
|
98
|
+
|
|
99
|
+
param = sigima.params.ConstantParam.create(value=2.0)
|
|
100
|
+
panel.processor.run_feature("addition_constant", param)
|
|
101
|
+
panel.processor.run_feature("difference_constant", param)
|
|
102
|
+
panel.processor.run_feature("product_constant", param)
|
|
103
|
+
panel.processor.run_feature("division_constant", param)
|
|
104
|
+
|
|
105
|
+
obj = panel.objmodel.get_groups()[0][-1]
|
|
106
|
+
param = sigima.params.ClipParam() # Clipping before division...
|
|
107
|
+
param.upper = (obj.data.max() - obj.data.min()) * 0.8 + obj.data.min()
|
|
108
|
+
panel.processor.run_feature("clip", param)
|
|
109
|
+
|
|
110
|
+
param = sigima.params.NormalizeParam()
|
|
111
|
+
for method in sigima.enums.NormalizationMethod:
|
|
112
|
+
param.method = method
|
|
113
|
+
panel.processor.run_feature("normalize", param)
|
|
114
|
+
|
|
115
|
+
panel.objview.select_objects((3, 7))
|
|
116
|
+
panel.processor.run_feature("division")
|
|
117
|
+
for feature_name in ("average", "standard_deviation"):
|
|
118
|
+
panel.objview.select_objects((1, 2, 3))
|
|
119
|
+
panel.processor.run_feature(feature_name)
|
|
120
|
+
|
|
121
|
+
panel.add_label_with_title()
|
|
122
|
+
|
|
123
|
+
__compute_1_to_1_operations(panel, 2)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def run_signal_computations(
|
|
127
|
+
win: DLMainWindow, data_size: int = 500, all_types: bool = True
|
|
128
|
+
) -> None:
|
|
129
|
+
"""Testing signal features"""
|
|
130
|
+
panel = win.signalpanel
|
|
131
|
+
win.set_current_panel("signal")
|
|
132
|
+
|
|
133
|
+
if all_types:
|
|
134
|
+
for signal in iterate_signal_creation(data_size, non_zero=True):
|
|
135
|
+
panel.add_object(create_paracetamol_signal(data_size))
|
|
136
|
+
panel.add_object(signal)
|
|
137
|
+
compute_common_operations(panel)
|
|
138
|
+
panel.remove_all_objects()
|
|
139
|
+
|
|
140
|
+
sig1 = create_paracetamol_signal(data_size)
|
|
141
|
+
win.add_object(sig1)
|
|
142
|
+
|
|
143
|
+
# Add new signal based on s0
|
|
144
|
+
panel.objview.set_current_object(sig1)
|
|
145
|
+
param = sigima.objects.UniformDistribution1DParam.create(
|
|
146
|
+
title=_("Random function"), vmin=0, vmax=sig1.y.max() * 0.2
|
|
147
|
+
)
|
|
148
|
+
noiseobj1 = panel.new_object(param, edit=False)
|
|
149
|
+
|
|
150
|
+
compute_common_operations(panel)
|
|
151
|
+
|
|
152
|
+
# Signal specific operations
|
|
153
|
+
panel.processor.run_feature("sqrt")
|
|
154
|
+
panel.processor.run_feature("power", sigima.params.PowerParam.create(power=2))
|
|
155
|
+
panel.processor.run_feature("reverse_x")
|
|
156
|
+
panel.processor.run_feature("reverse_x")
|
|
157
|
+
|
|
158
|
+
# Test filter methods
|
|
159
|
+
for filter_func_name, paramclass in (
|
|
160
|
+
("lowpass", sigima.params.LowPassFilterParam),
|
|
161
|
+
("highpass", sigima.params.HighPassFilterParam),
|
|
162
|
+
("bandpass", sigima.params.BandPassFilterParam),
|
|
163
|
+
("bandstop", sigima.params.BandStopFilterParam),
|
|
164
|
+
):
|
|
165
|
+
for method in sigima.enums.FrequencyFilterMethod:
|
|
166
|
+
panel.objview.set_current_object(sig1)
|
|
167
|
+
param = paramclass.create(method=method)
|
|
168
|
+
param.update_from_obj(sig1) # Use default cut-off frequencies
|
|
169
|
+
panel.processor.run_feature(filter_func_name, param)
|
|
170
|
+
|
|
171
|
+
# Test windowing methods
|
|
172
|
+
noiseobj2 = noiseobj1.copy()
|
|
173
|
+
win.add_object(noiseobj2)
|
|
174
|
+
param = sigima.params.WindowingParam()
|
|
175
|
+
for method in sigima.enums.WindowingMethod:
|
|
176
|
+
panel.objview.set_current_object(noiseobj2)
|
|
177
|
+
param.method = method
|
|
178
|
+
panel.processor.run_feature("apply_window", param)
|
|
179
|
+
|
|
180
|
+
win.add_object(sig1.copy())
|
|
181
|
+
|
|
182
|
+
param = sigima.params.XYCalibrateParam.create(a=1.2, b=0.1)
|
|
183
|
+
panel.processor.run_feature("calibration", param)
|
|
184
|
+
|
|
185
|
+
panel.processor.run_feature("derivative")
|
|
186
|
+
panel.processor.run_feature("integral")
|
|
187
|
+
|
|
188
|
+
param = sigima.params.PeakDetectionParam()
|
|
189
|
+
panel.processor.compute_peak_detection(param)
|
|
190
|
+
|
|
191
|
+
panel.processor.compute_multigaussianfit()
|
|
192
|
+
|
|
193
|
+
panel.objview.select_objects([-3])
|
|
194
|
+
sig = panel.objview.get_sel_objects()[0]
|
|
195
|
+
i1 = data_size // 10
|
|
196
|
+
i2 = len(sig.y) - i1
|
|
197
|
+
roi = sigima.objects.create_signal_roi([i1, i2], indices=True)
|
|
198
|
+
panel.processor.compute_roi_extraction(roi)
|
|
199
|
+
|
|
200
|
+
sig = create_noisy_signal(
|
|
201
|
+
sigima.objects.NormalDistribution1DParam.create(sigma=5.0)
|
|
202
|
+
)
|
|
203
|
+
panel.add_object(sig)
|
|
204
|
+
for _name, fitfunc in panel.processor.FIT_FUNCTIONS:
|
|
205
|
+
panel.objview.set_current_object(sig)
|
|
206
|
+
panel.processor.run_feature(fitfunc)
|
|
207
|
+
|
|
208
|
+
# Test evaluate_fit: evaluate a fit on another signal's x-axis
|
|
209
|
+
# First, perform a linear fit on sig
|
|
210
|
+
panel.objview.set_current_object(sig)
|
|
211
|
+
panel.processor.run_feature("linear_fit")
|
|
212
|
+
fitted_signal = panel.objview.get_current_object()
|
|
213
|
+
|
|
214
|
+
# Create a signal with different x-axis
|
|
215
|
+
x_new = np.linspace(sig.x.min() - 10, sig.x.max() + 10, 150)
|
|
216
|
+
y_new = np.zeros_like(x_new)
|
|
217
|
+
sig_new_x = sigima.objects.create_signal(
|
|
218
|
+
"New X values for fit evaluation", x_new, y_new
|
|
219
|
+
)
|
|
220
|
+
panel.add_object(sig_new_x)
|
|
221
|
+
|
|
222
|
+
# Evaluate the fit on the new signal's x-axis
|
|
223
|
+
panel.objview.set_current_object(fitted_signal)
|
|
224
|
+
panel.processor.run_feature("evaluate_fit", sig_new_x)
|
|
225
|
+
|
|
226
|
+
param = sigima.objects.GaussParam.create(title=_("Gaussian"))
|
|
227
|
+
sig = sigima.objects.create_signal_from_param(param)
|
|
228
|
+
panel.add_object(sig)
|
|
229
|
+
|
|
230
|
+
param = sigima.params.FWHMParam()
|
|
231
|
+
for method_value, _method_name in param.methods:
|
|
232
|
+
param.method = method_value
|
|
233
|
+
panel.processor.run_feature("fwhm", param)
|
|
234
|
+
panel.processor.run_feature("fw1e2")
|
|
235
|
+
|
|
236
|
+
# Create a new signal which X values are a subset of sig1
|
|
237
|
+
x = np.linspace(sig1.x.min(), sig1.x.max(), data_size // 2)[: data_size // 4]
|
|
238
|
+
y = x * 0.0
|
|
239
|
+
sig2 = sigima.objects.create_signal("X values for interpolation", x, y)
|
|
240
|
+
panel.add_object(sig2)
|
|
241
|
+
|
|
242
|
+
# Test interpolation
|
|
243
|
+
# pylint: disable=protected-access
|
|
244
|
+
for method in sigima.enums.Interpolation1DMethod:
|
|
245
|
+
for fill_value in (None, 0.0):
|
|
246
|
+
panel.objview.set_current_object(sig1)
|
|
247
|
+
param = sigima.params.InterpolationParam.create(
|
|
248
|
+
method=method, fill_value=fill_value
|
|
249
|
+
)
|
|
250
|
+
panel.processor.run_feature("interpolate", sig2, param)
|
|
251
|
+
|
|
252
|
+
# Test resampling
|
|
253
|
+
xmin, xmax = x[0], x[-1]
|
|
254
|
+
for mode, dx, nbpts in (("dx", 0.1, 10), ("nbpts", 0.0, 100)):
|
|
255
|
+
panel.objview.set_current_object(sig1)
|
|
256
|
+
param = sigima.params.Resampling1DParam.create(
|
|
257
|
+
xmin=xmin, xmax=xmax, mode=mode, dx=dx, nbpts=nbpts
|
|
258
|
+
)
|
|
259
|
+
panel.processor.run_feature("resampling", param)
|
|
260
|
+
|
|
261
|
+
# Test convolution
|
|
262
|
+
panel.objview.set_current_object(sig1)
|
|
263
|
+
panel.processor.run_feature("derivative")
|
|
264
|
+
panel.processor.run_feature("convolution", sig1)
|
|
265
|
+
|
|
266
|
+
# Test detrending
|
|
267
|
+
panel.objview.set_current_object(sig1)
|
|
268
|
+
# pylint: disable=protected-access
|
|
269
|
+
for method_choice_tuple in sigima.params.DetrendingParam.methods:
|
|
270
|
+
param = sigima.params.DetrendingParam.create(method=method_choice_tuple[0])
|
|
271
|
+
panel.processor.run_feature("detrending", param)
|
|
272
|
+
|
|
273
|
+
# Test histogram
|
|
274
|
+
panel.objview.set_current_object(sig1)
|
|
275
|
+
param = sigima.params.HistogramParam.create(bins=100)
|
|
276
|
+
panel.processor.run_feature("histogram", param)
|
|
277
|
+
|
|
278
|
+
# Test bandwidth and dynamic parameters
|
|
279
|
+
panel.processor.run_feature("bandwidth_3db")
|
|
280
|
+
panel.processor.run_feature("dynamic_parameters")
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def run_image_computations(
|
|
284
|
+
win: DLMainWindow, data_size: int = 150, all_types: bool = True
|
|
285
|
+
) -> None:
|
|
286
|
+
"""Test image features"""
|
|
287
|
+
win.set_current_panel("image")
|
|
288
|
+
panel = win.imagepanel
|
|
289
|
+
|
|
290
|
+
newparam = sigima.objects.NewImageParam.create(height=data_size, width=data_size)
|
|
291
|
+
|
|
292
|
+
if all_types:
|
|
293
|
+
for image in iterate_image_creation(data_size, non_zero=True):
|
|
294
|
+
panel.add_object(create_sincos_image(newparam))
|
|
295
|
+
panel.add_object(image)
|
|
296
|
+
compute_common_operations(panel)
|
|
297
|
+
panel.remove_all_objects()
|
|
298
|
+
|
|
299
|
+
ima1 = create_sincos_image(newparam)
|
|
300
|
+
panel.add_object(ima1)
|
|
301
|
+
|
|
302
|
+
# Add new image based on i0
|
|
303
|
+
panel.objview.set_current_object(ima1)
|
|
304
|
+
unifparam = sigima.objects.UniformDistribution2DParam()
|
|
305
|
+
unifparam.set_from_datatype(ima1.data.dtype)
|
|
306
|
+
unifparam.vmax = int(ima1.data.max() * 0.2)
|
|
307
|
+
panel.new_object(unifparam, edit=False)
|
|
308
|
+
|
|
309
|
+
compute_common_operations(panel)
|
|
310
|
+
|
|
311
|
+
# Test resampling
|
|
312
|
+
w, h = ima1.data.shape[1], ima1.data.shape[0]
|
|
313
|
+
for method, mode, dx, dy, width_param, height_param in (
|
|
314
|
+
(sigima.enums.Interpolation2DMethod.NEAREST, "dxy", 0.5, 0.5, 10, 10),
|
|
315
|
+
(sigima.enums.Interpolation2DMethod.LINEAR, "shape", 0.0, 0.0, w // 2, h // 2),
|
|
316
|
+
(sigima.enums.Interpolation2DMethod.CUBIC, "shape", 0.0, 0.0, w * 2, h // 2),
|
|
317
|
+
):
|
|
318
|
+
panel.objview.set_current_object(ima1)
|
|
319
|
+
param = sigima.params.Resampling2DParam.create(
|
|
320
|
+
method=method,
|
|
321
|
+
mode=mode,
|
|
322
|
+
dx=dx,
|
|
323
|
+
dy=dy,
|
|
324
|
+
width=width_param,
|
|
325
|
+
height=height_param,
|
|
326
|
+
xmin=ima1.x0,
|
|
327
|
+
xmax=ima1.x0 + ima1.width,
|
|
328
|
+
ymin=ima1.y0,
|
|
329
|
+
ymax=ima1.y0 + ima1.height,
|
|
330
|
+
)
|
|
331
|
+
panel.processor.run_feature("resampling", param)
|
|
332
|
+
|
|
333
|
+
# Test denoising methods
|
|
334
|
+
param = sigima.params.XYZCalibrateParam.create(axis="z", a1=1.2, a0=0.1)
|
|
335
|
+
panel.processor.run_feature("calibration", param)
|
|
336
|
+
param = sigima.params.DenoiseTVParam()
|
|
337
|
+
panel.processor.run_feature("denoise_tv", param)
|
|
338
|
+
param = sigima.params.DenoiseBilateralParam()
|
|
339
|
+
panel.processor.run_feature("denoise_bilateral", param)
|
|
340
|
+
param = sigima.params.DenoiseWaveletParam()
|
|
341
|
+
panel.processor.run_feature("denoise_wavelet", param)
|
|
342
|
+
|
|
343
|
+
# Test exposure methods
|
|
344
|
+
ima2 = create_sincos_image(newparam)
|
|
345
|
+
panel.add_object(ima2)
|
|
346
|
+
panel.processor.run_feature(
|
|
347
|
+
"absolute"
|
|
348
|
+
) # Avoid neg. values for skimage correction methods
|
|
349
|
+
param = sigima.params.AdjustGammaParam.create(gamma=0.5)
|
|
350
|
+
panel.processor.run_feature("adjust_gamma", param)
|
|
351
|
+
param = sigima.params.AdjustLogParam.create(gain=0.5)
|
|
352
|
+
panel.processor.run_feature("adjust_log", param)
|
|
353
|
+
param = sigima.params.AdjustSigmoidParam.create(gain=0.5)
|
|
354
|
+
panel.processor.run_feature("adjust_sigmoid", param)
|
|
355
|
+
param = sigima.params.EqualizeHistParam()
|
|
356
|
+
panel.processor.run_feature("equalize_hist", param)
|
|
357
|
+
param = sigima.params.EqualizeAdaptHistParam()
|
|
358
|
+
panel.processor.run_feature("equalize_adapthist", param)
|
|
359
|
+
param = sigima.params.RescaleIntensityParam()
|
|
360
|
+
panel.processor.run_feature("rescale_intensity", param)
|
|
361
|
+
|
|
362
|
+
# Test morphology methods
|
|
363
|
+
param = sigima.params.MorphologyParam.create(radius=10)
|
|
364
|
+
panel.processor.run_feature("denoise_tophat", param)
|
|
365
|
+
panel.processor.run_feature("white_tophat", param)
|
|
366
|
+
panel.processor.run_feature("black_tophat", param)
|
|
367
|
+
param.radius = 1
|
|
368
|
+
panel.processor.run_feature("erosion", param)
|
|
369
|
+
panel.processor.run_feature("dilation", param)
|
|
370
|
+
panel.processor.run_feature("opening", param)
|
|
371
|
+
panel.processor.run_feature("closing", param)
|
|
372
|
+
|
|
373
|
+
param = sigima.params.ButterworthParam.create(order=2, cut_off=0.5)
|
|
374
|
+
panel.processor.run_feature("butterworth", param)
|
|
375
|
+
|
|
376
|
+
param = sigima.params.CannyParam()
|
|
377
|
+
panel.processor.run_feature("canny", param)
|
|
378
|
+
|
|
379
|
+
# Test threshold methods
|
|
380
|
+
ima2 = create_sincos_image(newparam)
|
|
381
|
+
panel.add_object(ima2)
|
|
382
|
+
param = sigima.params.ThresholdParam()
|
|
383
|
+
for method_value, _method_name in param.methods:
|
|
384
|
+
panel.objview.set_current_object(ima2)
|
|
385
|
+
param = sigima.params.ThresholdParam.create(method=method_value)
|
|
386
|
+
if method_value == "manual":
|
|
387
|
+
param.value = (ima2.data.max() - ima2.data.min()) * 0.5 + ima2.data.min()
|
|
388
|
+
panel.processor.run_feature("threshold", param)
|
|
389
|
+
for func_name in (
|
|
390
|
+
"threshold_isodata",
|
|
391
|
+
"threshold_li",
|
|
392
|
+
"threshold_mean",
|
|
393
|
+
"threshold_minimum",
|
|
394
|
+
"threshold_otsu",
|
|
395
|
+
"threshold_triangle",
|
|
396
|
+
"threshold_yen",
|
|
397
|
+
):
|
|
398
|
+
panel.objview.set_current_object(ima2)
|
|
399
|
+
panel.processor.run_feature(func_name)
|
|
400
|
+
|
|
401
|
+
# Test edge detection methods
|
|
402
|
+
ima2 = create_sincos_image(newparam)
|
|
403
|
+
panel.add_object(ima2)
|
|
404
|
+
for func_name in (
|
|
405
|
+
"roberts",
|
|
406
|
+
"prewitt",
|
|
407
|
+
"prewitt_h",
|
|
408
|
+
"prewitt_v",
|
|
409
|
+
"sobel",
|
|
410
|
+
"sobel_h",
|
|
411
|
+
"sobel_v",
|
|
412
|
+
"scharr",
|
|
413
|
+
"scharr_h",
|
|
414
|
+
"scharr_v",
|
|
415
|
+
"farid",
|
|
416
|
+
"farid_h",
|
|
417
|
+
"farid_v",
|
|
418
|
+
"laplace",
|
|
419
|
+
):
|
|
420
|
+
panel.processor.run_feature(func_name)
|
|
421
|
+
|
|
422
|
+
param = sigima.params.Log10ZPlusNParam.create(n=1)
|
|
423
|
+
panel.processor.run_feature("log10_z_plus_n", param)
|
|
424
|
+
|
|
425
|
+
panel.processor.run_feature("rotate90")
|
|
426
|
+
panel.processor.run_feature("rotate270")
|
|
427
|
+
panel.processor.run_feature("fliph")
|
|
428
|
+
panel.processor.run_feature("flipv")
|
|
429
|
+
|
|
430
|
+
param = sigima.params.RotateParam.create(angle=5.0)
|
|
431
|
+
for boundary in sigima.enums.BorderMode:
|
|
432
|
+
if boundary is sigima.enums.BorderMode.MIRROR:
|
|
433
|
+
continue
|
|
434
|
+
param.mode = boundary
|
|
435
|
+
panel.processor.run_feature("rotate", param)
|
|
436
|
+
|
|
437
|
+
param = sigima.params.ResizeParam.create(zoom=1.3)
|
|
438
|
+
panel.processor.run_feature("resize", param)
|
|
439
|
+
|
|
440
|
+
n = data_size // 10
|
|
441
|
+
roi = sigima.objects.create_image_roi(
|
|
442
|
+
"rectangle", [n, n, data_size - 2 * n, data_size - 2 * n]
|
|
443
|
+
)
|
|
444
|
+
panel.processor.compute_roi_extraction(roi)
|
|
445
|
+
|
|
446
|
+
panel.processor.run_feature("centroid")
|
|
447
|
+
panel.processor.run_feature("enclosing_circle")
|
|
448
|
+
|
|
449
|
+
ima = create_peak_image(newparam)
|
|
450
|
+
panel.add_object(ima)
|
|
451
|
+
param = sigima.params.Peak2DDetectionParam.create(create_rois=True)
|
|
452
|
+
panel.processor.compute_peak_detection(param)
|
|
453
|
+
|
|
454
|
+
param = sigima.params.ContourShapeParam()
|
|
455
|
+
panel.processor.run_feature("contour_shape", param)
|
|
456
|
+
|
|
457
|
+
param = sigima.params.BinningParam.create(sx=2, sy=2, operation="average")
|
|
458
|
+
panel.processor.run_feature("binning", param)
|
|
459
|
+
|
|
460
|
+
# Test histogram
|
|
461
|
+
panel.objview.set_current_object(ima)
|
|
462
|
+
param = sigima.params.HistogramParam.create(bins=100)
|
|
463
|
+
panel.processor.run_feature("histogram", param)
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DataLab Demo
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
8
|
+
# pylint: disable=duplicate-code
|
|
9
|
+
# guitest: show,skip
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
import sigima.objects
|
|
16
|
+
import sigima.params
|
|
17
|
+
import sigima.proc.image as sipi
|
|
18
|
+
from guidata.qthelpers import qt_wait
|
|
19
|
+
from qtpy import QtWidgets as QW
|
|
20
|
+
from sigima.enums import BorderMode
|
|
21
|
+
from sigima.tests.data import (
|
|
22
|
+
create_multigaussian_image,
|
|
23
|
+
create_paracetamol_signal,
|
|
24
|
+
create_peak_image,
|
|
25
|
+
create_sincos_image,
|
|
26
|
+
get_test_image,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
from datalab.config import _, reset
|
|
30
|
+
from datalab.env import execenv
|
|
31
|
+
from datalab.tests import datalab_test_app_context
|
|
32
|
+
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
from datalab.gui.main import DLMainWindow
|
|
35
|
+
|
|
36
|
+
DELAY1, DELAY2, DELAY3 = 1, 2, 3
|
|
37
|
+
# DELAY1, DELAY2, DELAY3 = 0, 0, 0
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_signal_features(win: DLMainWindow, data_size: int = 500) -> None:
|
|
41
|
+
"""Testing signal features"""
|
|
42
|
+
panel = win.signalpanel
|
|
43
|
+
win.set_current_panel("signal")
|
|
44
|
+
|
|
45
|
+
qt_wait(DELAY2)
|
|
46
|
+
|
|
47
|
+
sig1 = create_paracetamol_signal(data_size)
|
|
48
|
+
win.add_object(sig1)
|
|
49
|
+
|
|
50
|
+
qt_wait(DELAY1)
|
|
51
|
+
|
|
52
|
+
panel.objview.set_current_object(sig1)
|
|
53
|
+
param = sigima.objects.UniformDistribution1DParam.create(
|
|
54
|
+
title=_("Random function"), vmin=0, vmax=sig1.y.max() * 0.2
|
|
55
|
+
)
|
|
56
|
+
sig2 = sigima.objects.create_signal_from_param(param)
|
|
57
|
+
win.add_object(sig2)
|
|
58
|
+
|
|
59
|
+
# compute_common_operations(panel)
|
|
60
|
+
panel.objview.select_objects((1, 2))
|
|
61
|
+
qt_wait(DELAY1)
|
|
62
|
+
panel.processor.run_feature("addition")
|
|
63
|
+
qt_wait(DELAY1)
|
|
64
|
+
|
|
65
|
+
panel.processor.run_feature("normalize")
|
|
66
|
+
panel.processor.run_feature("derivative")
|
|
67
|
+
panel.processor.run_feature("integral")
|
|
68
|
+
|
|
69
|
+
panel.objview.set_current_object(sig1)
|
|
70
|
+
qt_wait(DELAY1)
|
|
71
|
+
panel.processor.run_feature("detrending")
|
|
72
|
+
sig3 = panel.objview.get_current_object()
|
|
73
|
+
|
|
74
|
+
param = sigima.params.PeakDetectionParam()
|
|
75
|
+
panel.processor.run_feature("peak_detection", param)
|
|
76
|
+
sig4 = panel.objview.get_current_object()
|
|
77
|
+
panel.objview.select_objects([sig3, sig4])
|
|
78
|
+
|
|
79
|
+
qt_wait(DELAY2)
|
|
80
|
+
|
|
81
|
+
panel.objview.set_current_object(sig3)
|
|
82
|
+
panel.processor.compute_multigaussianfit()
|
|
83
|
+
|
|
84
|
+
sig = sigima.objects.create_signal_from_param(sigima.objects.StepPulseParam())
|
|
85
|
+
panel.add_object(sig)
|
|
86
|
+
|
|
87
|
+
panel.processor.run_feature("extract_pulse_features")
|
|
88
|
+
|
|
89
|
+
qt_wait(DELAY2)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_image_features(win: DLMainWindow, data_size: int = 512) -> None:
|
|
93
|
+
"""Testing signal features"""
|
|
94
|
+
win.set_current_panel("image")
|
|
95
|
+
panel = win.imagepanel
|
|
96
|
+
|
|
97
|
+
panel.add_object(get_test_image("flower.npy"))
|
|
98
|
+
ima1 = panel.objview.get_current_object()
|
|
99
|
+
|
|
100
|
+
qt_wait(DELAY2)
|
|
101
|
+
|
|
102
|
+
panel.objview.set_current_object(ima1)
|
|
103
|
+
|
|
104
|
+
param = sigima.objects.UniformDistribution2DParam.create(
|
|
105
|
+
width=data_size, height=data_size
|
|
106
|
+
)
|
|
107
|
+
param.set_from_datatype(ima1.data.dtype)
|
|
108
|
+
param.vmax = int(ima1.data.max() * 0.2)
|
|
109
|
+
ima2 = sigima.objects.create_image_from_param(param)
|
|
110
|
+
panel.add_object(ima2)
|
|
111
|
+
|
|
112
|
+
panel.objview.select_objects((1, 2))
|
|
113
|
+
panel.processor.run_feature("addition")
|
|
114
|
+
qt_wait(DELAY2)
|
|
115
|
+
# compute_common_operations(panel)
|
|
116
|
+
|
|
117
|
+
panel.processor.run_feature("histogram")
|
|
118
|
+
qt_wait(DELAY2)
|
|
119
|
+
|
|
120
|
+
param = sigima.objects.NewImageParam.create(width=data_size, height=data_size)
|
|
121
|
+
ima1 = create_sincos_image(param)
|
|
122
|
+
panel.add_object(ima1)
|
|
123
|
+
|
|
124
|
+
qt_wait(DELAY3)
|
|
125
|
+
|
|
126
|
+
panel.processor.run_feature("rotate90")
|
|
127
|
+
panel.processor.run_feature("rotate270")
|
|
128
|
+
panel.processor.run_feature("fliph")
|
|
129
|
+
panel.processor.run_feature("flipv")
|
|
130
|
+
|
|
131
|
+
rotparam = sipi.RotateParam.create(angle=5.0)
|
|
132
|
+
for boundary in BorderMode:
|
|
133
|
+
if boundary is BorderMode.MIRROR:
|
|
134
|
+
continue
|
|
135
|
+
rotparam.mode = boundary
|
|
136
|
+
panel.processor.run_feature("rotate", rotparam)
|
|
137
|
+
|
|
138
|
+
param.title = _("Multi-Gaussian")
|
|
139
|
+
ima1 = create_multigaussian_image(param)
|
|
140
|
+
s = data_size
|
|
141
|
+
roi = sigima.objects.create_image_roi(
|
|
142
|
+
"rectangle", [s // 2, s // 2, s - 25 - s // 2, s - s // 2]
|
|
143
|
+
)
|
|
144
|
+
roi.add_roi(sigima.objects.create_image_roi("circle", [s // 3, s // 2, s // 4]))
|
|
145
|
+
ima1.roi = roi
|
|
146
|
+
panel.add_object(ima1)
|
|
147
|
+
|
|
148
|
+
qt_wait(DELAY2)
|
|
149
|
+
|
|
150
|
+
panel.processor.run_feature("centroid")
|
|
151
|
+
|
|
152
|
+
qt_wait(DELAY1)
|
|
153
|
+
|
|
154
|
+
panel.processor.run_feature("enclosing_circle")
|
|
155
|
+
|
|
156
|
+
qt_wait(DELAY2)
|
|
157
|
+
|
|
158
|
+
param.title = _("2D Peaks with noise background")
|
|
159
|
+
ima = create_peak_image(param)
|
|
160
|
+
panel.add_object(ima)
|
|
161
|
+
param = sigima.params.Peak2DDetectionParam.create(create_rois=True)
|
|
162
|
+
panel.processor.run_feature("peak_detection", param)
|
|
163
|
+
|
|
164
|
+
qt_wait(DELAY2)
|
|
165
|
+
|
|
166
|
+
param = sigima.params.ContourShapeParam()
|
|
167
|
+
panel.processor.run_feature("contour_shape", param)
|
|
168
|
+
|
|
169
|
+
qt_wait(DELAY2)
|
|
170
|
+
|
|
171
|
+
n = data_size // 10
|
|
172
|
+
roi = sigima.objects.create_image_roi(
|
|
173
|
+
"rectangle", [n, n, data_size - 2 * n, data_size - 2 * n]
|
|
174
|
+
)
|
|
175
|
+
panel.processor.compute_roi_extraction(roi)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def play_demo(win: DLMainWindow) -> None:
|
|
179
|
+
"""Play demo
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
win: DLMainWindow instance
|
|
183
|
+
"""
|
|
184
|
+
ret = QW.QMessageBox.information(
|
|
185
|
+
win,
|
|
186
|
+
_("Demo"),
|
|
187
|
+
_(
|
|
188
|
+
"Click OK to start the demo.<br><br><u>Note:</u><br>"
|
|
189
|
+
"- Demo will cover a <i>selection</i> of DataLab features "
|
|
190
|
+
"(for a complete list of features, please refer to the documentation).<br>"
|
|
191
|
+
"- It won't require any user interaction."
|
|
192
|
+
),
|
|
193
|
+
QW.QMessageBox.Ok | QW.QMessageBox.Cancel,
|
|
194
|
+
)
|
|
195
|
+
if ret == QW.QMessageBox.Ok:
|
|
196
|
+
execenv.enable_demo_mode(int(DELAY1 * 1000))
|
|
197
|
+
test_signal_features(win)
|
|
198
|
+
test_image_features(win)
|
|
199
|
+
qt_wait(DELAY3)
|
|
200
|
+
execenv.disable_demo_mode()
|
|
201
|
+
QW.QMessageBox.information(win, _("Demo"), _("Click OK to end demo."))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def run():
|
|
205
|
+
"""Run demo"""
|
|
206
|
+
reset() # Reset configuration (remove configuration file and initialize it)
|
|
207
|
+
with datalab_test_app_context(console=False) as win:
|
|
208
|
+
play_demo(win)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
if __name__ == "__main__":
|
|
212
|
+
run()
|