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,171 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Process isolation unit test
|
|
5
|
+
---------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
9
|
+
# guitest: skip
|
|
10
|
+
|
|
11
|
+
import time
|
|
12
|
+
from multiprocessing import Pool
|
|
13
|
+
|
|
14
|
+
import numpy as np
|
|
15
|
+
import scipy.signal as sps
|
|
16
|
+
from guidata.configtools import get_icon
|
|
17
|
+
from guidata.qthelpers import qt_app_context
|
|
18
|
+
from plotpy.plot import PlotOptions, PlotWidget
|
|
19
|
+
from qtpy import QtCore as QC
|
|
20
|
+
from qtpy import QtWidgets as QW
|
|
21
|
+
from sigima.objects import NewImageParam
|
|
22
|
+
from sigima.tests.data import create_2d_random, create_noisy_gaussian_image
|
|
23
|
+
|
|
24
|
+
from datalab.adapters_plotpy import create_adapter_from_object
|
|
25
|
+
from datalab.env import execenv
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class MainWindow(QW.QMainWindow):
|
|
29
|
+
"""Multiprocessing test main window"""
|
|
30
|
+
|
|
31
|
+
SIG_COMPUTATION_FINISHED = QC.Signal()
|
|
32
|
+
|
|
33
|
+
def __init__(self):
|
|
34
|
+
super().__init__()
|
|
35
|
+
|
|
36
|
+
self.setWindowTitle("DataLab Multiprocessing test")
|
|
37
|
+
self.setWindowIcon(get_icon("datalab.svg"))
|
|
38
|
+
|
|
39
|
+
# Setting up the layout and widgets
|
|
40
|
+
self.imagewidget = PlotWidget(options=PlotOptions(type="image"))
|
|
41
|
+
self.setCentralWidget(self.imagewidget)
|
|
42
|
+
self.layout = QW.QVBoxLayout(self.imagewidget)
|
|
43
|
+
|
|
44
|
+
self.start_button = QW.QPushButton("Start Computation", self)
|
|
45
|
+
self.start_button.clicked.connect(self.start_computation)
|
|
46
|
+
self.layout.addWidget(self.start_button)
|
|
47
|
+
|
|
48
|
+
self.cancel_button = QW.QPushButton("Cancel Computation", self)
|
|
49
|
+
self.cancel_button.clicked.connect(self.cancel_computation)
|
|
50
|
+
self.layout.addWidget(self.cancel_button)
|
|
51
|
+
|
|
52
|
+
# Create a test image and add it to the plot
|
|
53
|
+
param = NewImageParam.create(height=1000, width=1000)
|
|
54
|
+
image = create_noisy_gaussian_image(param, add_annotations=True)
|
|
55
|
+
self.imageitem = create_adapter_from_object(image).make_item()
|
|
56
|
+
self.imagewidget.plot.add_item(self.imageitem)
|
|
57
|
+
|
|
58
|
+
self.array = image.data
|
|
59
|
+
self.result = None
|
|
60
|
+
self.timer = QC.QTimer()
|
|
61
|
+
self.timer.setInterval(10) # Check every 100 ms
|
|
62
|
+
self.timer.timeout.connect(self.check_process)
|
|
63
|
+
self.start_time = None
|
|
64
|
+
|
|
65
|
+
self.SIG_COMPUTATION_FINISHED.connect(self.update_plot)
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def long_running_task(array: np.ndarray) -> None:
|
|
69
|
+
"""
|
|
70
|
+
A long running task that computes a median filter on the input array and puts
|
|
71
|
+
the result in the queue. The done_event is set when the computation is finished.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
array (numpy.ndarray): The input data to compute the filter on.
|
|
75
|
+
"""
|
|
76
|
+
start_time = time.time()
|
|
77
|
+
result = sps.medfilt(array, 1) + create_2d_random(array.shape[0], array.dtype)
|
|
78
|
+
execenv.print(f"Computation done: delta={time.time() - start_time:.3f} s")
|
|
79
|
+
return result
|
|
80
|
+
|
|
81
|
+
def print_time(self, title: str) -> None:
|
|
82
|
+
"""
|
|
83
|
+
Prints the time since the last call to this method and resets the start_time.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
title (str): The title to print before the time.
|
|
87
|
+
"""
|
|
88
|
+
execenv.print(f"{title}: {time.time() - self.start_time:.3f} s")
|
|
89
|
+
self.start_time = time.time()
|
|
90
|
+
|
|
91
|
+
def start_computation(self) -> None:
|
|
92
|
+
"""
|
|
93
|
+
Starts the computation in a separate process and starts the timer.
|
|
94
|
+
"""
|
|
95
|
+
global POOL # pylint: disable=global-statement,global-variable-not-assigned
|
|
96
|
+
if self.result and not self.result.ready():
|
|
97
|
+
self.print_time("Computation already running!")
|
|
98
|
+
return
|
|
99
|
+
self.start_time = time.time()
|
|
100
|
+
self.result = POOL.apply_async(self.long_running_task, (self.array,))
|
|
101
|
+
self.timer.start()
|
|
102
|
+
self.print_time("Computation started")
|
|
103
|
+
|
|
104
|
+
def cancel_computation(self) -> None:
|
|
105
|
+
"""
|
|
106
|
+
Cancels the computation by terminating the process and stopping the timer.
|
|
107
|
+
"""
|
|
108
|
+
global POOL # pylint: disable=global-statement
|
|
109
|
+
# Terminate the process and stop the timer
|
|
110
|
+
POOL.terminate()
|
|
111
|
+
POOL.join()
|
|
112
|
+
self.timer.stop()
|
|
113
|
+
execenv.print("Computation cancelled!")
|
|
114
|
+
# Recreate the pool for the next computation
|
|
115
|
+
POOL = Pool(processes=1) # pylint: disable=not-callable,consider-using-with
|
|
116
|
+
|
|
117
|
+
def check_process(self) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Checks if the computation is finished. If it is, stops the timer and calls
|
|
120
|
+
the method to handle the computation finishing.
|
|
121
|
+
"""
|
|
122
|
+
if self.result.ready():
|
|
123
|
+
self.print_time("Computation finished")
|
|
124
|
+
self.timer.stop()
|
|
125
|
+
self.on_computation_finished()
|
|
126
|
+
|
|
127
|
+
def on_computation_finished(self) -> None:
|
|
128
|
+
"""
|
|
129
|
+
Retrieves the result from the queue
|
|
130
|
+
and emits the SIG_COMPUTATION_FINISHED signal.
|
|
131
|
+
"""
|
|
132
|
+
self.array = self.result.get()
|
|
133
|
+
self.SIG_COMPUTATION_FINISHED.emit()
|
|
134
|
+
self.print_time("Computation result retrieved")
|
|
135
|
+
|
|
136
|
+
def update_plot(self) -> None:
|
|
137
|
+
"""
|
|
138
|
+
Updates the plot with the result of the computation.
|
|
139
|
+
"""
|
|
140
|
+
self.imageitem.set_data(self.array)
|
|
141
|
+
self.imagewidget.plot.replot()
|
|
142
|
+
self.print_time("Plot updated")
|
|
143
|
+
|
|
144
|
+
def closeEvent(self, event) -> None:
|
|
145
|
+
"""
|
|
146
|
+
Overrides the closeEvent to stop the timer
|
|
147
|
+
and terminate the process when the window is closed.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
event: The close event.
|
|
151
|
+
"""
|
|
152
|
+
self.timer.stop()
|
|
153
|
+
super().closeEvent(event)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def test_multiprocessing2() -> None:
|
|
157
|
+
"""
|
|
158
|
+
Creates a PyQt application context, shows the main window,
|
|
159
|
+
and starts the event loop.
|
|
160
|
+
"""
|
|
161
|
+
global POOL # pylint: disable=global-statement,global-variable-not-assigned
|
|
162
|
+
with qt_app_context(exec_loop=True):
|
|
163
|
+
window = MainWindow()
|
|
164
|
+
window.show()
|
|
165
|
+
POOL.terminate()
|
|
166
|
+
POOL.join()
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
if __name__ == "__main__":
|
|
170
|
+
POOL = Pool(processes=1) # pylint: disable=not-callable,consider-using-with
|
|
171
|
+
test_multiprocessing2()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Process isolation unit test
|
|
5
|
+
---------------------------
|
|
6
|
+
|
|
7
|
+
Just test if it's possible to run the process isolation test from another module. This
|
|
8
|
+
may be an issue with the Pool object being global.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# guitest: show
|
|
12
|
+
|
|
13
|
+
from datalab.tests.backbone import procisolation1_unit
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_procisolation():
|
|
17
|
+
"""Test process isolation"""
|
|
18
|
+
procisolation1_unit.test_multiprocessing1()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
test_procisolation()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Profiling
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# guitest: skip
|
|
8
|
+
|
|
9
|
+
from datalab.env import execenv
|
|
10
|
+
from datalab.tests import datalab_test_app_context
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_profiling():
|
|
14
|
+
"""Profiling test"""
|
|
15
|
+
with execenv.context(unattended=True):
|
|
16
|
+
with datalab_test_app_context() as win:
|
|
17
|
+
win.open_h5_files(
|
|
18
|
+
[
|
|
19
|
+
"C:/Dev/Projets/X-GRID_data/Projets_Oasis/XGRID5/"
|
|
20
|
+
"VS000001-blobs_doh_profiling.h5"
|
|
21
|
+
],
|
|
22
|
+
import_all=True,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if __name__ == "__main__":
|
|
27
|
+
test_profiling()
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
String utilities unit tests for DataLab
|
|
5
|
+
|
|
6
|
+
Testing the string utility functions in datalab.utils.strings module,
|
|
7
|
+
particularly the save_html_diff function which is useful for debugging
|
|
8
|
+
and comparing text differences.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import tempfile
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from unittest.mock import patch
|
|
17
|
+
|
|
18
|
+
import pytest
|
|
19
|
+
|
|
20
|
+
from datalab.utils.strings import save_html_diff
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.fixture
|
|
24
|
+
def temp_html_file():
|
|
25
|
+
"""Fixture providing a temporary file path for HTML diff output."""
|
|
26
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
27
|
+
yield os.path.join(tmpdir, "test_diff.html")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_save_html_diff_basic(temp_html_file): # pylint: disable=W0621
|
|
31
|
+
"""Test that save_html_diff creates a valid HTML file with diff content."""
|
|
32
|
+
text1 = "Line 1\nLine 2\nLine 3"
|
|
33
|
+
text2 = "Line 1\nModified Line 2\nLine 3"
|
|
34
|
+
|
|
35
|
+
with patch("webbrowser.open"):
|
|
36
|
+
save_html_diff(text1, text2, "Before", "After", temp_html_file)
|
|
37
|
+
|
|
38
|
+
# Verify file creation and basic structure
|
|
39
|
+
assert Path(temp_html_file).exists()
|
|
40
|
+
content = Path(temp_html_file).read_text(encoding="utf-8")
|
|
41
|
+
assert "<!DOCTYPE html" in content or "<html" in content
|
|
42
|
+
assert "Before" in content
|
|
43
|
+
assert "After" in content
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_save_html_diff_edge_cases(temp_html_file): # pylint: disable=W0621
|
|
47
|
+
"""Test save_html_diff with edge cases: empty strings and Unicode."""
|
|
48
|
+
# Test with empty string
|
|
49
|
+
with patch("webbrowser.open"):
|
|
50
|
+
save_html_diff("", "New content", "Empty", "Added", temp_html_file)
|
|
51
|
+
|
|
52
|
+
assert Path(temp_html_file).exists()
|
|
53
|
+
|
|
54
|
+
# Test with Unicode
|
|
55
|
+
with patch("webbrowser.open"):
|
|
56
|
+
save_html_diff(
|
|
57
|
+
"Hello 世界", "Bonjour monde", "中文", "Français", temp_html_file
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
content = Path(temp_html_file).read_text(encoding="utf-8")
|
|
61
|
+
assert "中文" in content or "Fran" in content # Descriptions should be present
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
pytest.main([__file__, "-v"])
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DataLab-specific title formatting configuration tests
|
|
5
|
+
|
|
6
|
+
This module verifies that DataLab correctly configures the Sigima title formatting
|
|
7
|
+
system. The actual functionality of the title formatting system is comprehensively
|
|
8
|
+
tested in Sigima's test suite (sigima.tests.common.title_formatting_unit_test).
|
|
9
|
+
|
|
10
|
+
This test suite only verifies:
|
|
11
|
+
- DataLab uses PlaceholderTitleFormatter by default (required for DataLab)
|
|
12
|
+
- DataLab-specific complex parameter patterns work correctly
|
|
13
|
+
|
|
14
|
+
For comprehensive tests of the title formatting system itself, see:
|
|
15
|
+
sigima/tests/common/title_formatting_unit_test.py
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import pytest
|
|
21
|
+
from sigima import create_signal
|
|
22
|
+
from sigima.proc.base import dst_1_to_1
|
|
23
|
+
from sigima.proc.title_formatting import (
|
|
24
|
+
PlaceholderTitleFormatter,
|
|
25
|
+
get_default_title_formatter,
|
|
26
|
+
set_default_title_formatter,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestDataLabTitleFormattingConfiguration:
|
|
31
|
+
"""Test suite verifying DataLab's title formatting configuration.
|
|
32
|
+
|
|
33
|
+
Note: Comprehensive tests of the title formatting system itself are in
|
|
34
|
+
sigima/tests/common/title_formatting_unit_test.py. These tests only verify
|
|
35
|
+
DataLab-specific configuration and usage patterns.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def test_datalab_uses_placeholder_formatter_by_default(self):
|
|
39
|
+
"""Verify DataLab is configured with PlaceholderTitleFormatter by default.
|
|
40
|
+
|
|
41
|
+
This is critical for DataLab's workflow, as placeholder titles like
|
|
42
|
+
"wiener({0})" are later resolved by DataLab's patch_title_with_ids()
|
|
43
|
+
function to create titles like "wiener(s001)".
|
|
44
|
+
"""
|
|
45
|
+
current_formatter = get_default_title_formatter()
|
|
46
|
+
assert isinstance(current_formatter, PlaceholderTitleFormatter), (
|
|
47
|
+
"DataLab must use PlaceholderTitleFormatter for proper title resolution"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def test_complex_datalab_parameter_patterns(self):
|
|
51
|
+
"""Test complex parameter strings typical in DataLab.
|
|
52
|
+
|
|
53
|
+
DataLab often uses complex, multi-valued parameter strings in operation
|
|
54
|
+
titles. This test verifies these patterns work correctly.
|
|
55
|
+
"""
|
|
56
|
+
original_formatter = get_default_title_formatter()
|
|
57
|
+
try:
|
|
58
|
+
set_default_title_formatter(PlaceholderTitleFormatter())
|
|
59
|
+
|
|
60
|
+
signal = create_signal("Test", x=[1, 2, 3], y=[4, 5, 6])
|
|
61
|
+
|
|
62
|
+
# Test DataLab's typical complex parameter patterns
|
|
63
|
+
complex_params = [
|
|
64
|
+
"sigma=1.5,mode=constant",
|
|
65
|
+
"window=hamming,nperseg=256,noverlap=128",
|
|
66
|
+
"method=butterworth,order=4,critical_freq=0.1",
|
|
67
|
+
"roi=[10,20,30,40],background=auto",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
for params in complex_params:
|
|
71
|
+
result = dst_1_to_1(signal, "filter", params)
|
|
72
|
+
expected = f"filter({{0}})|{params}"
|
|
73
|
+
assert result.title == expected, (
|
|
74
|
+
f"Complex parameter '{params}' not preserved in title"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
finally:
|
|
78
|
+
set_default_title_formatter(original_formatter)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
pytest.main([__file__])
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DataLab pytest configuration
|
|
5
|
+
----------------------------
|
|
6
|
+
|
|
7
|
+
This file contains the configuration for running pytest in DataLab. It is
|
|
8
|
+
executed before running any tests.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import os.path as osp
|
|
13
|
+
|
|
14
|
+
import guidata
|
|
15
|
+
import h5py
|
|
16
|
+
import numpy
|
|
17
|
+
import plotpy
|
|
18
|
+
import pytest
|
|
19
|
+
import qtpy
|
|
20
|
+
import qwt
|
|
21
|
+
import scipy
|
|
22
|
+
import sigima
|
|
23
|
+
import skimage
|
|
24
|
+
from guidata.config import ValidationMode, set_validation_mode
|
|
25
|
+
from guidata.utils.gitreport import format_git_info_for_pytest, get_git_info_for_modules
|
|
26
|
+
from sigima.tests import helpers
|
|
27
|
+
|
|
28
|
+
import datalab
|
|
29
|
+
from datalab.env import execenv
|
|
30
|
+
from datalab.plugins import PluginRegistry, get_available_plugins
|
|
31
|
+
|
|
32
|
+
# Set validation mode to STRICT for all tests
|
|
33
|
+
set_validation_mode(ValidationMode.STRICT)
|
|
34
|
+
|
|
35
|
+
# Turn on unattended mode for executing tests without user interaction
|
|
36
|
+
execenv.unattended = True
|
|
37
|
+
execenv.verbose = "quiet"
|
|
38
|
+
|
|
39
|
+
INITIAL_CWD = os.getcwd()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def pytest_addoption(parser):
|
|
43
|
+
"""Add custom command line options to pytest."""
|
|
44
|
+
parser.addoption(
|
|
45
|
+
"--show-windows",
|
|
46
|
+
action="store_true",
|
|
47
|
+
default=False,
|
|
48
|
+
help="Display Qt windows during tests (disables QT_QPA_PLATFORM=offscreen)",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def pytest_report_header(config): # pylint: disable=unused-argument
|
|
53
|
+
"""Add additional information to the pytest report header."""
|
|
54
|
+
nfstr = ", ".join(
|
|
55
|
+
f"{plugin.info.name} {plugin.info.version}"
|
|
56
|
+
for plugin in get_available_plugins()
|
|
57
|
+
)
|
|
58
|
+
qtbindings_version = qtpy.PYSIDE_VERSION
|
|
59
|
+
if qtbindings_version is None:
|
|
60
|
+
qtbindings_version = qtpy.PYQT_VERSION
|
|
61
|
+
infolist = [
|
|
62
|
+
f"DataLab {datalab.__version__} [Plugins: {nfstr if nfstr else 'None'}]",
|
|
63
|
+
f" sigima {sigima.__version__},",
|
|
64
|
+
f" guidata {guidata.__version__}, PlotPy {plotpy.__version__}",
|
|
65
|
+
f" PythonQwt {qwt.__version__}, "
|
|
66
|
+
f"{qtpy.API_NAME} {qtbindings_version} [Qt version: {qtpy.QT_VERSION}]",
|
|
67
|
+
f" NumPy {numpy.__version__}, SciPy {scipy.__version__}, "
|
|
68
|
+
f"h5py {h5py.__version__}, scikit-image {skimage.__version__}",
|
|
69
|
+
]
|
|
70
|
+
try:
|
|
71
|
+
import cv2 # pylint: disable=import-outside-toplevel
|
|
72
|
+
|
|
73
|
+
infolist[-1] += f", OpenCV {cv2.__version__}"
|
|
74
|
+
except ImportError:
|
|
75
|
+
pass
|
|
76
|
+
envlist = []
|
|
77
|
+
for vname in ("DATALAB_DATA", "PYTHONPATH", "DEBUG", "QT_API", "QT_QPA_PLATFORM"):
|
|
78
|
+
value = os.environ.get(vname, "")
|
|
79
|
+
if value:
|
|
80
|
+
if vname == "PYTHONPATH":
|
|
81
|
+
pathlist = value.split(os.pathsep)
|
|
82
|
+
envlist.append(f" {vname}:")
|
|
83
|
+
envlist.extend(f" {p}" for p in pathlist if p)
|
|
84
|
+
else:
|
|
85
|
+
envlist.append(f" {vname}: {value}")
|
|
86
|
+
if envlist:
|
|
87
|
+
infolist.append("Environment variables:")
|
|
88
|
+
infolist.extend(envlist)
|
|
89
|
+
infolist.append("Test paths:")
|
|
90
|
+
for test_path in helpers.get_test_paths():
|
|
91
|
+
test_path = osp.abspath(test_path)
|
|
92
|
+
infolist.append(f" {test_path}")
|
|
93
|
+
|
|
94
|
+
# Git information for all modules using the new gitreport module
|
|
95
|
+
modules_config = [
|
|
96
|
+
("DataLab", datalab, "."), # DataLab uses current directory
|
|
97
|
+
("guidata", guidata, None),
|
|
98
|
+
("PlotPy", plotpy, None),
|
|
99
|
+
("Sigima", sigima, None),
|
|
100
|
+
]
|
|
101
|
+
git_repos = get_git_info_for_modules(modules_config)
|
|
102
|
+
git_info_lines = format_git_info_for_pytest(git_repos, "DataLab")
|
|
103
|
+
if git_info_lines:
|
|
104
|
+
infolist.extend(git_info_lines)
|
|
105
|
+
|
|
106
|
+
return infolist
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def pytest_configure(config):
|
|
110
|
+
"""Add custom markers to pytest."""
|
|
111
|
+
if config.option.durations is None:
|
|
112
|
+
config.option.durations = 20 # Default to showing 20 slowest tests
|
|
113
|
+
config.addinivalue_line(
|
|
114
|
+
"markers",
|
|
115
|
+
"validation: mark a test as a validation test (ground truth or analytical)",
|
|
116
|
+
)
|
|
117
|
+
if not config.getoption("--show-windows"):
|
|
118
|
+
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@pytest.fixture(autouse=True)
|
|
122
|
+
def reset_cwd(request): # pylint: disable=unused-argument
|
|
123
|
+
"""Reset the current working directory to the initial one after each test."""
|
|
124
|
+
yield
|
|
125
|
+
os.chdir(INITIAL_CWD)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@pytest.hookimpl(tryfirst=True)
|
|
129
|
+
def pytest_runtest_teardown(item, nextitem): # pylint: disable=unused-argument
|
|
130
|
+
"""Run teardown after each test."""
|
|
131
|
+
PluginRegistry.unregister_all_plugins()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Basic application launcher test 1
|
|
5
|
+
|
|
6
|
+
Running application a few times in a row with different entry parameters.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# guitest: show
|
|
10
|
+
|
|
11
|
+
from datalab import app
|
|
12
|
+
from datalab.env import execenv
|
|
13
|
+
from datalab.utils.qthelpers import datalab_app_context
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_launcher1(screenshots: bool = False):
|
|
17
|
+
"""Testing DataLab app launcher"""
|
|
18
|
+
with datalab_app_context(exec_loop=not screenshots):
|
|
19
|
+
execenv.print("Opening DataLab with no argument")
|
|
20
|
+
win = app.create()
|
|
21
|
+
if screenshots:
|
|
22
|
+
win.statusBar().hide()
|
|
23
|
+
win.take_screenshot("s_app_at_startup")
|
|
24
|
+
win.close()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__":
|
|
28
|
+
test_launcher1()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Basic application launcher test 2
|
|
5
|
+
|
|
6
|
+
Create signal and image objects (with circles, rectangles, segments and markers),
|
|
7
|
+
then open DataLab to show them.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
11
|
+
# guitest: show
|
|
12
|
+
|
|
13
|
+
from sigima.objects import NewImageParam
|
|
14
|
+
from sigima.tests import data as test_data
|
|
15
|
+
|
|
16
|
+
from datalab.app import run
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_launcher2():
|
|
20
|
+
"""Simple test"""
|
|
21
|
+
sig1 = test_data.create_paracetamol_signal()
|
|
22
|
+
sig2 = test_data.create_noisy_signal()
|
|
23
|
+
param = NewImageParam.create(height=2000, width=2000)
|
|
24
|
+
ima1 = test_data.create_sincos_image(param)
|
|
25
|
+
ima2 = test_data.create_noisy_gaussian_image(param, add_annotations=True)
|
|
26
|
+
run(objects=(sig1, sig2, ima1, ima2), size=(1200, 550))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
test_launcher2()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#
|