scitex 2.10.3__py3-none-any.whl → 2.13.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.
- scitex/__init__.py +1 -4
- scitex/__main__.py +24 -5
- scitex/__version__.py +1 -1
- scitex/_install_guide.py +14 -2
- scitex/_optional_deps.py +33 -0
- scitex/ai/classification/reporters/_ClassificationReporter.py +1 -1
- scitex/ai/classification/timeseries/_TimeSeriesBlockingSplit.py +2 -2
- scitex/ai/classification/timeseries/_TimeSeriesCalendarSplit.py +2 -2
- scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit.py +2 -2
- scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit_v01-not-using-n_splits.py +2 -2
- scitex/ai/classification/timeseries/_TimeSeriesStratifiedSplit.py +2 -2
- scitex/ai/classification/timeseries/_normalize_timestamp.py +1 -1
- scitex/ai/metrics/_calc_seizure_prediction_metrics.py +1 -1
- scitex/ai/plt/_plot_feature_importance.py +1 -1
- scitex/ai/plt/_plot_learning_curve.py +1 -1
- scitex/ai/plt/_plot_optuna_study.py +1 -1
- scitex/ai/plt/_plot_pre_rec_curve.py +1 -1
- scitex/ai/plt/_plot_roc_curve.py +1 -1
- scitex/ai/plt/_stx_conf_mat.py +1 -1
- scitex/ai/training/_LearningCurveLogger.py +1 -1
- scitex/audio/mcp_server.py +38 -8
- scitex/bridge/_figrecipe.py +1 -1
- scitex/bridge/_helpers.py +1 -1
- scitex/bridge/_plt_vis.py +1 -1
- scitex/bridge/_stats_plt.py +1 -1
- scitex/bridge/_stats_vis.py +2 -2
- scitex/browser/automation/CookieHandler.py +1 -1
- scitex/browser/core/BrowserMixin.py +1 -1
- scitex/browser/core/ChromeProfileManager.py +1 -1
- scitex/browser/debugging/_browser_logger.py +1 -1
- scitex/browser/debugging/_highlight_element.py +1 -1
- scitex/browser/debugging/_show_grid.py +1 -1
- scitex/browser/interaction/click_center.py +1 -1
- scitex/browser/interaction/click_with_fallbacks.py +1 -1
- scitex/browser/interaction/close_popups.py +1 -1
- scitex/browser/interaction/fill_with_fallbacks.py +1 -1
- scitex/browser/pdf/click_download_for_chrome_pdf_viewer.py +1 -1
- scitex/browser/pdf/detect_chrome_pdf_viewer.py +1 -1
- scitex/browser/stealth/HumanBehavior.py +1 -1
- scitex/browser/stealth/StealthManager.py +1 -1
- scitex/{fig → canvas}/__init__.py +84 -96
- scitex/canvas/_mcp_handlers.py +372 -0
- scitex/canvas/_mcp_tool_schemas.py +219 -0
- scitex/{fig → canvas}/backend/_parser.py +1 -1
- scitex/{fig → canvas}/canvas.py +13 -14
- scitex/{fts/_fig/_editor → canvas/editor}/_defaults.py +2 -2
- scitex/{fig → canvas}/editor/edit/__init__.py +11 -14
- scitex/{fig → canvas}/editor/edit/bundle_resolver.py +56 -48
- scitex/{fig → canvas}/editor/edit/editor_launcher.py +79 -26
- scitex/{fts/_fig/_editor/_cui/_panel_loader.py → canvas/editor/edit/panel_loader.py} +8 -8
- scitex/{fts/_fig/_editor/_gui/_flask_editor → canvas/editor/flask_editor}/_bbox.py +2 -1
- scitex/{fts/_fig/_editor/_gui/_flask_editor → canvas/editor/flask_editor}/_core.py +84 -84
- scitex/{fts/_fig/_editor/_gui/_flask_editor → canvas/editor/flask_editor}/_renderer.py +7 -6
- scitex/{fts/_fig/_editor/_gui/_flask_editor → canvas/editor/flask_editor}/static/css/features/canvas.css +2 -2
- scitex/{fig → canvas}/editor/flask_editor/static/css/features/panel-grid.css +1 -1
- scitex/{fig → canvas}/editor/flask_editor/static/js/core/api.js +3 -4
- scitex/{fig → canvas}/editor/flask_editor/static/js/editor/preview.js +5 -5
- scitex/{fig → canvas}/editor/flask_editor/templates/_html.py +3 -3
- scitex/{fig → canvas}/editor/flask_editor/templates/_scripts.py +10 -10
- scitex/{fig → canvas}/editor/flask_editor/templates/_styles.py +3 -3
- scitex/{fig → canvas}/io/__init__.py +32 -38
- scitex/{fig → canvas}/io/_bundle.py +217 -154
- scitex/{fig → canvas}/io/_canvas.py +1 -1
- scitex/{fig → canvas}/io/_data.py +1 -1
- scitex/{fig → canvas}/io/_export.py +1 -1
- scitex/{fig → canvas}/io/_load.py +1 -1
- scitex/{fig → canvas}/io/_panel.py +1 -1
- scitex/{fig → canvas}/io/_save.py +1 -1
- scitex/canvas/mcp_server.py +151 -0
- scitex/{fig → canvas}/model/__init__.py +1 -1
- scitex/{fig → canvas}/model/_annotations.py +1 -1
- scitex/{fig → canvas}/model/_axes.py +1 -1
- scitex/{fig → canvas}/model/_figure.py +1 -1
- scitex/{fig → canvas}/model/_guides.py +1 -1
- scitex/{fig → canvas}/model/_plot.py +1 -1
- scitex/{fig → canvas}/model/_styles.py +1 -1
- scitex/{fig → canvas}/utils/__init__.py +1 -1
- scitex/capture/mcp_server.py +41 -12
- scitex/cli/audio.py +233 -0
- scitex/cli/capture.py +307 -0
- scitex/cli/convert.py +10 -6
- scitex/cli/main.py +27 -4
- scitex/cli/repro.py +233 -0
- scitex/cli/resource.py +240 -0
- scitex/cli/stats.py +325 -0
- scitex/cli/template.py +236 -0
- scitex/cli/tex.py +286 -0
- scitex/cli/web.py +11 -12
- scitex/dev/__init__.py +3 -0
- scitex/dev/_pyproject.py +405 -0
- scitex/dev/plt/__init__.py +2 -2
- scitex/dev/plt/mpl/get_dir_ax.py +1 -1
- scitex/dev/plt/mpl/get_signatures.py +1 -1
- scitex/dev/plt/mpl/get_signatures_details.py +1 -1
- scitex/diagram/README.md +7 -7
- scitex/diagram/_mcp_handlers.py +400 -0
- scitex/diagram/_mcp_tool_schemas.py +157 -0
- scitex/diagram/mcp_server.py +151 -0
- scitex/dsp/_demo_sig.py +51 -5
- scitex/dsp/_mne.py +13 -2
- scitex/dsp/_modulation_index.py +15 -3
- scitex/dsp/_pac.py +23 -5
- scitex/dsp/_psd.py +16 -4
- scitex/dsp/_resample.py +24 -4
- scitex/dsp/_transform.py +16 -3
- scitex/dsp/add_noise.py +15 -1
- scitex/dsp/norm.py +17 -2
- scitex/dsp/reference.py +17 -1
- scitex/dsp/utils/_differential_bandpass_filters.py +20 -2
- scitex/dsp/utils/_zero_pad.py +18 -4
- scitex/dt/_normalize_timestamp.py +1 -1
- scitex/git/_session.py +1 -1
- scitex/io/__init__.py +7 -19
- scitex/io/_load.py +15 -19
- scitex/io/_load_modules/_canvas.py +2 -2
- scitex/io/_load_modules/_con.py +17 -6
- scitex/io/_load_modules/_eeg.py +28 -13
- scitex/io/_load_modules/_optuna.py +21 -63
- scitex/io/_load_modules/_torch.py +11 -3
- scitex/io/_save.py +11 -16
- scitex/io/_save_modules/__init__.py +6 -10
- scitex/io/_save_modules/_canvas.py +3 -3
- scitex/io/_save_modules/_optuna_study_as_csv_and_pngs.py +13 -2
- scitex/io/_save_modules/_plot_bundle.py +112 -0
- scitex/io/_save_modules/{_pltz_stx.py → _plot_scitex.py} +7 -7
- scitex/io/_save_modules/_stx_bundle.py +16 -16
- scitex/io/_save_modules/_torch.py +11 -3
- scitex/io/bundle/README.md +89 -80
- scitex/{fts/_bundle/_FTS.py → io/bundle/_Bundle.py} +197 -95
- scitex/io/bundle/__init__.py +67 -35
- scitex/{fts/_bundle → io/bundle}/_children.py +32 -40
- scitex/io/bundle/_core.py +184 -97
- scitex/{fts/_bundle/_dataclasses/_Node.py → io/bundle/_dataclasses/_Spec.py} +29 -23
- scitex/{fts/_bundle/_dataclasses/_NodeRefs.py → io/bundle/_dataclasses/_SpecRefs.py} +6 -6
- scitex/{fts/_bundle → io/bundle}/_dataclasses/__init__.py +4 -4
- scitex/{fts/_bundle → io/bundle}/_loader.py +19 -19
- scitex/io/bundle/_manifest.py +99 -0
- scitex/{fts/_bundle → io/bundle}/_mpl_helpers.py +119 -28
- scitex/io/bundle/_nested.py +113 -100
- scitex/{fts/_bundle → io/bundle}/_saver.py +13 -14
- scitex/{fts/_bundle → io/bundle}/_storage.py +3 -3
- scitex/io/bundle/_types.py +41 -16
- scitex/{fts/_bundle → io/bundle}/_validation.py +20 -18
- scitex/io/bundle/_zip.py +21 -31
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_backend/_parser.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_models/_Annotations.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_models/_Axes.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_models/_Figure.py +1 -1
- scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_Guides.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_models/_Plot.py +1 -1
- scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_Styles.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_plot/_utils/_plot_layout.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/__init__.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_editor/_app.py +1 -1
- scitex/{fts/_tables → io/bundle/kinds/_table}/_latex/_export.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_figure_exporter.py +1 -1
- scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_table_exporter.py +1 -1
- scitex/io/bundle/schemas/__init__.py +30 -0
- scitex/mcp_server.py +159 -0
- scitex/parallel/_run.py +5 -4
- scitex/path/_find.py +60 -83
- scitex/path/_get_module_path.py +23 -21
- scitex/path/_get_spath.py +6 -27
- scitex/path/_getsize.py +23 -9
- scitex/path/_increment_version.py +31 -38
- scitex/path/_mk_spath.py +26 -29
- scitex/path/_path.py +5 -12
- scitex/path/_split.py +27 -15
- scitex/path/_this_path.py +23 -9
- scitex/plt/_mcp_handlers.py +361 -0
- scitex/plt/_mcp_tool_schemas.py +169 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/__init__.py +2 -1
- scitex/plt/_subplots/_AxisWrapperMixins/__init__.py +2 -2
- scitex/plt/gallery/_generate.py +76 -50
- scitex/plt/io/__init__.py +17 -19
- scitex/plt/io/_bundle.py +99 -52
- scitex/plt/io/_layered_bundle.py +303 -168
- scitex/plt/mcp_server.py +205 -0
- scitex/plt/utils/_csv_column_naming.py +250 -118
- scitex/repro/README_RandomStateManager.md +3 -3
- scitex/repro/_RandomStateManager.py +14 -14
- scitex/repro/_gen_ID.py +1 -1
- scitex/repro/_gen_timestamp.py +1 -1
- scitex/repro/_hash_array.py +4 -4
- scitex/schema/__init__.py +69 -73
- scitex/schema/_canvas.py +1 -1
- scitex/schema/_stats.py +2 -2
- scitex/scholar/__main__.py +24 -2
- scitex/scholar/_mcp_handlers.py +685 -0
- scitex/scholar/_mcp_tool_schemas.py +339 -0
- scitex/scholar/docs/template.py +1 -1
- scitex/scholar/examples/07_storage_integration.py +1 -1
- scitex/scholar/impact_factor/jcr/ImpactFactorJCREngine.py +1 -1
- scitex/scholar/impact_factor/jcr/build_database.py +1 -1
- scitex/scholar/mcp_server.py +315 -0
- scitex/scholar/pdf_download/ScholarPDFDownloader.py +1 -1
- scitex/scholar/pipelines/ScholarPipelineBibTeX.py +1 -1
- scitex/scholar/pipelines/ScholarPipelineParallel.py +1 -1
- scitex/scholar/pipelines/ScholarPipelineSingle.py +1 -1
- scitex/scholar/storage/PaperIO.py +1 -1
- scitex/session/README.md +4 -4
- scitex/session/__init__.py +1 -1
- scitex/session/_decorator.py +9 -9
- scitex/session/_lifecycle.py +5 -5
- scitex/session/template.py +1 -1
- scitex/stats/__init__.py +30 -33
- scitex/stats/__main__.py +281 -0
- scitex/stats/_mcp_handlers.py +1191 -0
- scitex/stats/_mcp_tool_schemas.py +384 -0
- scitex/stats/_schema.py +1 -1
- scitex/stats/correct/_correct_bonferroni.py +1 -1
- scitex/stats/correct/_correct_fdr.py +1 -1
- scitex/stats/correct/_correct_fdr_.py +1 -1
- scitex/stats/correct/_correct_holm.py +1 -1
- scitex/stats/correct/_correct_sidak.py +1 -1
- scitex/stats/effect_sizes/_cliffs_delta.py +1 -1
- scitex/stats/effect_sizes/_cohens_d.py +1 -1
- scitex/stats/effect_sizes/_epsilon_squared.py +1 -1
- scitex/stats/effect_sizes/_eta_squared.py +1 -1
- scitex/stats/effect_sizes/_prob_superiority.py +1 -1
- scitex/stats/io/__init__.py +10 -11
- scitex/stats/io/_bundle.py +16 -16
- scitex/stats/mcp_server.py +405 -0
- scitex/stats/posthoc/_dunnett.py +1 -1
- scitex/stats/posthoc/_games_howell.py +1 -1
- scitex/stats/posthoc/_tukey_hsd.py +1 -1
- scitex/stats/power/_power.py +1 -1
- scitex/stats/utils/_effect_size.py +1 -1
- scitex/stats/utils/_formatters.py +1 -1
- scitex/stats/utils/_power.py +1 -1
- scitex/template/_mcp_handlers.py +259 -0
- scitex/template/_mcp_tool_schemas.py +112 -0
- scitex/template/mcp_server.py +186 -0
- scitex/utils/_verify_scitex_format.py +2 -2
- scitex/utils/template.py +1 -1
- scitex/web/__init__.py +12 -11
- scitex/web/_scraping.py +26 -265
- scitex/web/download_images.py +316 -0
- scitex/writer/Writer.py +1 -1
- scitex/writer/_clone_writer_project.py +1 -1
- scitex/writer/_validate_tree_structures.py +1 -1
- scitex/writer/dataclasses/config/_WriterConfig.py +1 -1
- scitex/writer/dataclasses/contents/_ManuscriptContents.py +1 -1
- scitex/writer/dataclasses/core/_Document.py +1 -1
- scitex/writer/dataclasses/core/_DocumentSection.py +1 -1
- scitex/writer/dataclasses/results/_CompilationResult.py +1 -1
- scitex/writer/dataclasses/results/_LaTeXIssue.py +1 -1
- scitex/writer/utils/.legacy_git_retry.py +7 -5
- scitex/writer/utils/_parse_latex_logs.py +1 -1
- scitex-2.13.0.dist-info/METADATA +1231 -0
- {scitex-2.10.3.dist-info → scitex-2.13.0.dist-info}/RECORD +376 -470
- scitex-2.13.0.dist-info/entry_points.txt +11 -0
- scitex/fig/editor/_defaults.py +0 -300
- scitex/fig/editor/edit/panel_loader.py +0 -232
- scitex/fig/editor/flask_editor/_bbox.py +0 -1299
- scitex/fig/editor/flask_editor/_core.py +0 -1429
- scitex/fig/editor/flask_editor/_renderer.py +0 -813
- scitex/fig/editor/flask_editor/static/css/features/canvas.css +0 -176
- scitex/fts/README.md +0 -262
- scitex/fts/TODO.md +0 -66
- scitex/fts/__init__.py +0 -90
- scitex/fts/_bundle/README_IN_BUNDLE.md +0 -102
- scitex/fts/_bundle/__init__.py +0 -38
- scitex/fts/_bundle/_utils/__init__.py +0 -55
- scitex/fts/_bundle/_utils/_const.py +0 -26
- scitex/fts/_bundle/_utils/_errors.py +0 -73
- scitex/fts/_bundle/_utils/_generate.py +0 -21
- scitex/fts/_bundle/_utils/_types.py +0 -76
- scitex/fts/_bundle/_zipbundle.py +0 -165
- scitex/fts/_fig/__init__.py +0 -22
- scitex/fts/_fig/_backend/_parser.py +0 -188
- scitex/fts/_fig/_editor/__init__.py +0 -14
- scitex/fts/_fig/_editor/_cui/__init__.py +0 -33
- scitex/fts/_fig/_editor/_cui/_backend_detector.py +0 -39
- scitex/fts/_fig/_editor/_cui/_bundle_resolver.py +0 -366
- scitex/fts/_fig/_editor/_cui/_editor_launcher.py +0 -175
- scitex/fts/_fig/_editor/_cui/_manual_handler.py +0 -52
- scitex/fts/_fig/_editor/_cui/_path_resolver.py +0 -66
- scitex/fts/_fig/_editor/_gui/__init__.py +0 -11
- scitex/fts/_fig/_editor/_gui/_flask_editor/__init__.py +0 -20
- scitex/fts/_fig/_editor/_gui/_flask_editor/_plotter.py +0 -664
- scitex/fts/_fig/_editor/_gui/_flask_editor/_utils.py +0 -79
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/base/reset.css +0 -41
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/base/typography.css +0 -16
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/base/variables.css +0 -85
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/buttons.css +0 -217
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/context-menu.css +0 -93
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/dropdown.css +0 -57
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/forms.css +0 -112
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/modal.css +0 -59
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/components/sections.css +0 -212
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/element-inspector.css +0 -190
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/loading.css +0 -59
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/overlay.css +0 -45
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/panel-grid.css +0 -95
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/selection.css +0 -101
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/features/statistics.css +0 -138
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/index.css +0 -31
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/layout/container.css +0 -7
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/layout/controls.css +0 -56
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/css/layout/preview.css +0 -78
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/alignment/axis.js +0 -314
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/alignment/basic.js +0 -107
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/alignment/distribute.js +0 -54
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/canvas/canvas.js +0 -172
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/canvas/dragging.js +0 -258
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/canvas/resize.js +0 -48
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/canvas/selection.js +0 -71
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/core/api.js +0 -288
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/core/state.js +0 -143
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/core/utils.js +0 -245
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/dev/element-inspector.js +0 -992
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/editor/bbox.js +0 -339
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/editor/element-drag.js +0 -286
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/editor/overlay.js +0 -371
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/editor/preview.js +0 -293
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/main.js +0 -426
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/shortcuts/context-menu.js +0 -152
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/shortcuts/keyboard.js +0 -265
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/ui/controls.js +0 -184
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/ui/download.js +0 -57
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/ui/help.js +0 -100
- scitex/fts/_fig/_editor/_gui/_flask_editor/static/js/ui/theme.js +0 -34
- scitex/fts/_fig/_editor/_gui/_flask_editor/templates/__init__.py +0 -124
- scitex/fts/_fig/_editor/_gui/_flask_editor/templates/_html.py +0 -851
- scitex/fts/_fig/_editor/_gui/_flask_editor/templates/_scripts.py +0 -4932
- scitex/fts/_fig/_editor/_gui/_flask_editor/templates/_styles.py +0 -1657
- scitex/fts/_fig/_editor/_gui/_flask_editor.py +0 -36
- scitex/fts/_fig/_models/_Annotations.py +0 -115
- scitex/fts/_fig/_models/_Axes.py +0 -152
- scitex/fts/_fig/_models/_Figure.py +0 -138
- scitex/fts/_fig/_models/_Plot.py +0 -123
- scitex/fts/_fig/_utils/_plot_layout.py +0 -397
- scitex/fts/_kinds/_figure/_composite.py +0 -345
- scitex/fts/_kinds/_plot/_backend/__init__.py +0 -53
- scitex/fts/_kinds/_plot/_backend/_export.py +0 -165
- scitex/fts/_kinds/_plot/_backend/_render.py +0 -538
- scitex/fts/_kinds/_plot/_dataclasses/_ChannelEncoding.py +0 -46
- scitex/fts/_kinds/_plot/_dataclasses/_Encoding.py +0 -82
- scitex/fts/_kinds/_plot/_dataclasses/_Theme.py +0 -441
- scitex/fts/_kinds/_plot/_dataclasses/_TraceEncoding.py +0 -52
- scitex/fts/_kinds/_plot/_dataclasses/__init__.py +0 -47
- scitex/fts/_kinds/_plot/_models/_Guides.py +0 -104
- scitex/fts/_kinds/_plot/_models/_Styles.py +0 -245
- scitex/fts/_kinds/_plot/_models/__init__.py +0 -80
- scitex/fts/_kinds/_plot/_models/_plot_types/__init__.py +0 -156
- scitex/fts/_kinds/_plot/_models/_plot_types/_bar.py +0 -43
- scitex/fts/_kinds/_plot/_models/_plot_types/_box.py +0 -38
- scitex/fts/_kinds/_plot/_models/_plot_types/_distribution.py +0 -36
- scitex/fts/_kinds/_plot/_models/_plot_types/_errorbar.py +0 -60
- scitex/fts/_kinds/_plot/_models/_plot_types/_histogram.py +0 -30
- scitex/fts/_kinds/_plot/_models/_plot_types/_image.py +0 -61
- scitex/fts/_kinds/_plot/_models/_plot_types/_line.py +0 -57
- scitex/fts/_kinds/_plot/_models/_plot_types/_scatter.py +0 -30
- scitex/fts/_kinds/_plot/_models/_plot_types/_seaborn.py +0 -121
- scitex/fts/_kinds/_plot/_models/_plot_types/_violin.py +0 -36
- scitex/fts/_kinds/_plot/_utils/__init__.py +0 -129
- scitex/fts/_kinds/_plot/_utils/_auto_layout.py +0 -127
- scitex/fts/_kinds/_plot/_utils/_calc_bounds.py +0 -111
- scitex/fts/_kinds/_plot/_utils/_const_sizes.py +0 -48
- scitex/fts/_kinds/_plot/_utils/_convert_coords.py +0 -77
- scitex/fts/_kinds/_plot/_utils/_get_template.py +0 -178
- scitex/fts/_kinds/_plot/_utils/_normalize.py +0 -73
- scitex/fts/_kinds/_plot/_utils/_validate.py +0 -197
- scitex/fts/_kinds/_table/_latex/_export.py +0 -279
- scitex/fts/_stats/__init__.py +0 -48
- scitex/fts/_stats/_dataclasses/_Stats.py +0 -423
- scitex/fts/_stats/_dataclasses/__init__.py +0 -48
- scitex/fts/_tables/__init__.py +0 -65
- scitex/fts/_tables/_latex/__init__.py +0 -93
- scitex/fts/_tables/_latex/_editor/__init__.py +0 -11
- scitex/fts/_tables/_latex/_editor/_app.py +0 -725
- scitex/fts/_tables/_latex/_figure_exporter.py +0 -153
- scitex/fts/_tables/_latex/_stats_formatter.py +0 -274
- scitex/fts/_tables/_latex/_table_exporter.py +0 -362
- scitex/fts/_tables/_latex/_utils.py +0 -369
- scitex/fts/_tables/_latex/_validator.py +0 -445
- scitex/io/_save_modules/_pltz_bundle.py +0 -356
- scitex-2.10.3.dist-info/METADATA +0 -952
- scitex-2.10.3.dist-info/entry_points.txt +0 -2
- /scitex/{fig → canvas}/README.md +0 -0
- /scitex/{fig → canvas}/backend/__init__.py +0 -0
- /scitex/{fig → canvas}/backend/_export.py +0 -0
- /scitex/{fig → canvas}/backend/_render.py +0 -0
- /scitex/{fig → canvas}/docs/CANVAS_ARCHITECTURE.md +0 -0
- /scitex/{fig → canvas}/editor/__init__.py +0 -0
- /scitex/{fig → canvas}/editor/_dearpygui_editor.py +0 -0
- /scitex/{fig → canvas}/editor/_flask_editor.py +0 -0
- /scitex/{fig → canvas}/editor/_mpl_editor.py +0 -0
- /scitex/{fig → canvas}/editor/_qt_editor.py +0 -0
- /scitex/{fig → canvas}/editor/_tkinter_editor.py +0 -0
- /scitex/{fig → canvas}/editor/edit/backend_detector.py +0 -0
- /scitex/{fig → canvas}/editor/edit/manual_handler.py +0 -0
- /scitex/{fig → canvas}/editor/edit/path_resolver.py +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/__init__.py +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/_plotter.py +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/_utils.py +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/base/reset.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/base/typography.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/base/variables.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/buttons.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/context-menu.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/dropdown.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/forms.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/modal.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/components/sections.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/features/element-inspector.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/features/loading.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/features/overlay.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/features/selection.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/features/statistics.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/index.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/layout/container.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/layout/controls.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/css/layout/preview.css +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/alignment/axis.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/alignment/basic.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/alignment/distribute.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/canvas/canvas.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/canvas/dragging.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/canvas/resize.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/canvas/selection.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/core/state.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/core/utils.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/dev/element-inspector.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/editor/bbox.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/editor/element-drag.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/editor/overlay.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/main.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/shortcuts/context-menu.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/shortcuts/keyboard.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/ui/controls.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/ui/download.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/ui/help.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/static/js/ui/theme.js +0 -0
- /scitex/{fig → canvas}/editor/flask_editor/templates/__init__.py +0 -0
- /scitex/{fig → canvas}/io/_directory.py +0 -0
- /scitex/{fig → canvas}/model/_plot_types.py +0 -0
- /scitex/{fig → canvas}/utils/_defaults.py +0 -0
- /scitex/{fig → canvas}/utils/_validate.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_conversion/__init__.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_conversion/_bundle2dict.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_conversion/_dict2bundle.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_Axes.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_BBox.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_ColumnDef.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_DataFormat.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_DataInfo.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_DataSource.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_dataclasses/_SizeMM.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_extractors/__init__.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_extractors/_extract_bar.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_extractors/_extract_line.py +0 -0
- /scitex/{fts/_bundle → io/bundle}/_extractors/_extract_scatter.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_figure/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_figure}/_composite.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_plot/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_backend/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_backend/_export.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_backend/_render.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_dataclasses/_ChannelEncoding.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_dataclasses/_Encoding.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_dataclasses/_Theme.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_dataclasses/_TraceEncoding.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_dataclasses/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_bar.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_box.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_distribution.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_errorbar.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_histogram.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_image.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_line.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_scatter.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_seaborn.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_models/_plot_types/_violin.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/__init__.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_auto_layout.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_calc_bounds.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_const_sizes.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_convert_coords.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_get_template.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_normalize.py +0 -0
- /scitex/{fts/_fig → io/bundle/kinds/_plot}/_utils/_validate.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_shape/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_stats/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_stats/_dataclasses/_Stats.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_stats/_dataclasses/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_table/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_editor/__init__.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_stats_formatter.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_utils.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_table/_latex/_validator.py +0 -0
- /scitex/{fts/_kinds → io/bundle/kinds}/_text/__init__.py +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/data_info.schema.json +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/encoding.schema.json +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/node.schema.json +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/render_manifest.schema.json +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/stats.schema.json +0 -0
- /scitex/{fts/_schemas → io/bundle/schemas}/theme.schema.json +0 -0
- {scitex-2.10.3.dist-info → scitex-2.13.0.dist-info}/WHEEL +0 -0
- {scitex-2.10.3.dist-info → scitex-2.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Timestamp: 2025-12-08
|
|
4
4
|
# File: /home/ywatanabe/proj/scitex-code/src/scitex/io/_load_modules/_canvas.py
|
|
5
5
|
"""
|
|
6
|
-
Load canvas directory (.canvas) for scitex.
|
|
6
|
+
Load canvas directory (.canvas) for scitex.canvas.
|
|
7
7
|
|
|
8
8
|
Canvas directories are portable figure bundles containing:
|
|
9
9
|
- canvas.json: Layout, panels, composition settings
|
|
@@ -100,7 +100,7 @@ def _load_canvas(
|
|
|
100
100
|
# Return Canvas object by default
|
|
101
101
|
if not as_dict:
|
|
102
102
|
try:
|
|
103
|
-
from scitex.
|
|
103
|
+
from scitex.canvas.canvas import Canvas
|
|
104
104
|
|
|
105
105
|
canvas_obj = Canvas.from_dict(canvas_dict)
|
|
106
106
|
# Store reference to original directory for copying
|
scitex/io/_load_modules/_con.py
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# Time-stamp: "2024-11-14 07:51:45 (ywatanabe)"
|
|
4
3
|
# File: ./scitex_repo/src/scitex/io/_load_modules/_con.py
|
|
5
4
|
|
|
6
5
|
from typing import Any
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
try:
|
|
8
|
+
import mne
|
|
9
|
+
|
|
10
|
+
MNE_AVAILABLE = True
|
|
11
|
+
except ImportError:
|
|
12
|
+
MNE_AVAILABLE = False
|
|
13
|
+
mne = None
|
|
9
14
|
|
|
10
15
|
|
|
11
16
|
def _load_con(lpath: str, **kwargs) -> Any:
|
|
17
|
+
if not MNE_AVAILABLE:
|
|
18
|
+
raise ImportError(
|
|
19
|
+
"MNE-Python is not installed. Please install with: pip install mne"
|
|
20
|
+
)
|
|
21
|
+
|
|
12
22
|
if not lpath.endswith(".con"):
|
|
13
23
|
raise ValueError("File must have .con extension")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
raw = mne.io.read_raw_fif(lpath, preload=True, **kwargs)
|
|
25
|
+
sfreq = raw.info["sfreq"]
|
|
26
|
+
df = raw.to_data_frame()
|
|
27
|
+
df["samp_rate"] = sfreq
|
|
28
|
+
return df
|
|
18
29
|
|
|
19
30
|
|
|
20
31
|
# EOF
|
scitex/io/_load_modules/_eeg.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# Time-stamp: "2024-11-14 07:56:27 (ywatanabe)"
|
|
4
3
|
# File: ./scitex_repo/src/scitex/io/_load_modules/_eeg.py
|
|
5
4
|
|
|
@@ -7,10 +6,16 @@ import os
|
|
|
7
6
|
import warnings
|
|
8
7
|
from typing import Any
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
try:
|
|
10
|
+
import mne
|
|
11
11
|
|
|
12
|
+
MNE_AVAILABLE = True
|
|
13
|
+
except ImportError:
|
|
14
|
+
MNE_AVAILABLE = False
|
|
15
|
+
mne = None
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
|
|
18
|
+
def _load_eeg_data(lpath: str, **kwargs) -> Any:
|
|
14
19
|
"""
|
|
15
20
|
Load EEG data based on file extension and associated files using MNE-Python.
|
|
16
21
|
|
|
@@ -39,19 +44,24 @@ def _load_eeg_data(path: str, **kwargs) -> Any:
|
|
|
39
44
|
This function uses MNE-Python to load the EEG data. It automatically detects the file format
|
|
40
45
|
based on the file extension and uses the appropriate MNE function to load the data.
|
|
41
46
|
"""
|
|
47
|
+
if not MNE_AVAILABLE:
|
|
48
|
+
raise ImportError(
|
|
49
|
+
"MNE-Python is not installed. Please install with: pip install mne"
|
|
50
|
+
)
|
|
51
|
+
|
|
42
52
|
# Get the file extension
|
|
43
53
|
extension = lpath.split(".")[-1]
|
|
44
54
|
|
|
45
55
|
allowed_extensions = [
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
56
|
+
"vhdr",
|
|
57
|
+
"vmrk",
|
|
58
|
+
"edf",
|
|
59
|
+
"bdf",
|
|
60
|
+
"gdf",
|
|
61
|
+
"cnt",
|
|
62
|
+
"egi",
|
|
63
|
+
"eeg",
|
|
64
|
+
"set",
|
|
55
65
|
]
|
|
56
66
|
|
|
57
67
|
if extension not in allowed_extensions:
|
|
@@ -59,6 +69,9 @@ def _load_eeg_data(path: str, **kwargs) -> Any:
|
|
|
59
69
|
f"File must have one of these extensions: {', '.join(allowed_extensions)}"
|
|
60
70
|
)
|
|
61
71
|
|
|
72
|
+
# Remove preload from kwargs if present - we always use preload=True
|
|
73
|
+
kwargs.pop("preload", None)
|
|
74
|
+
|
|
62
75
|
with warnings.catch_warnings():
|
|
63
76
|
warnings.simplefilter("ignore", RuntimeWarning)
|
|
64
77
|
|
|
@@ -98,9 +111,11 @@ def _load_eeg_data(path: str, **kwargs) -> Any:
|
|
|
98
111
|
lpath_v = lpath.replace(".eeg", ".vhdr")
|
|
99
112
|
raw = mne.io.read_raw_brainvision(lpath_v, preload=True, **kwargs)
|
|
100
113
|
# Nihon Koden
|
|
101
|
-
|
|
114
|
+
elif is_NihonKoden:
|
|
102
115
|
# raw = mne.io.read_raw_nihon(lpath, preload=True, **kwargs)
|
|
103
116
|
raw = mne.io.read_raw(lpath, preload=True, **kwargs)
|
|
117
|
+
else:
|
|
118
|
+
raise ValueError("No associated files found for .eeg file")
|
|
104
119
|
else:
|
|
105
120
|
raise ValueError(f"Unsupported file extension: {extension}")
|
|
106
121
|
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# Time-stamp: "2024-11-14 07:55:45 (ywatanabe)"
|
|
4
3
|
# File: ./scitex_repo/src/scitex/io/_load_modules/_optuna.py
|
|
5
4
|
|
|
6
5
|
from ._yaml import _load_yaml
|
|
7
6
|
|
|
7
|
+
try:
|
|
8
|
+
import optuna
|
|
9
|
+
|
|
10
|
+
OPTUNA_AVAILABLE = True
|
|
11
|
+
except ImportError:
|
|
12
|
+
OPTUNA_AVAILABLE = False
|
|
13
|
+
optuna = None
|
|
14
|
+
|
|
8
15
|
|
|
9
16
|
def load_yaml_as_an_optuna_dict(fpath_yaml, trial):
|
|
10
17
|
"""
|
|
@@ -31,7 +38,14 @@ def load_yaml_as_an_optuna_dict(fpath_yaml, trial):
|
|
|
31
38
|
If the specified YAML file does not exist.
|
|
32
39
|
ValueError
|
|
33
40
|
If the YAML file contains invalid configuration for Optuna.
|
|
41
|
+
ImportError
|
|
42
|
+
If Optuna is not installed.
|
|
34
43
|
"""
|
|
44
|
+
if not OPTUNA_AVAILABLE:
|
|
45
|
+
raise ImportError(
|
|
46
|
+
"Optuna is not installed. Please install with: pip install optuna"
|
|
47
|
+
)
|
|
48
|
+
|
|
35
49
|
_d = _load_yaml(fpath_yaml)
|
|
36
50
|
|
|
37
51
|
for k, v in _d.items():
|
|
@@ -74,6 +88,8 @@ def load_study_rdb(study_name, rdb_raw_bytes_url):
|
|
|
74
88
|
-------
|
|
75
89
|
optuna.exceptions.StorageInvalidUsageError
|
|
76
90
|
If there's an error loading the study from the storage.
|
|
91
|
+
ImportError
|
|
92
|
+
If Optuna is not installed.
|
|
77
93
|
|
|
78
94
|
Example:
|
|
79
95
|
--------
|
|
@@ -82,7 +98,10 @@ def load_study_rdb(study_name, rdb_raw_bytes_url):
|
|
|
82
98
|
... rdb_raw_bytes_url="sqlite:///path/to/your/study.db"
|
|
83
99
|
... )
|
|
84
100
|
"""
|
|
85
|
-
|
|
101
|
+
if not OPTUNA_AVAILABLE:
|
|
102
|
+
raise ImportError(
|
|
103
|
+
"Optuna is not installed. Please install with: pip install optuna"
|
|
104
|
+
)
|
|
86
105
|
|
|
87
106
|
storage = optuna.storages.RDBStorage(url=rdb_raw_bytes_url)
|
|
88
107
|
study = optuna.load_study(study_name=study_name, storage=storage)
|
|
@@ -90,65 +109,4 @@ def load_study_rdb(study_name, rdb_raw_bytes_url):
|
|
|
90
109
|
return study
|
|
91
110
|
|
|
92
111
|
|
|
93
|
-
def load_yaml_as_an_optuna_dict(fpath_yaml, trial):
|
|
94
|
-
"""
|
|
95
|
-
Load a YAML file and convert it to an Optuna-compatible dictionary.
|
|
96
|
-
|
|
97
|
-
Parameters:
|
|
98
|
-
-----------
|
|
99
|
-
fpath_yaml : str
|
|
100
|
-
The path to the YAML file.
|
|
101
|
-
trial : optuna.trial.Trial
|
|
102
|
-
The Optuna trial object.
|
|
103
|
-
|
|
104
|
-
Returns:
|
|
105
|
-
--------
|
|
106
|
-
dict
|
|
107
|
-
A dictionary with Optuna-compatible parameter suggestions.
|
|
108
|
-
"""
|
|
109
|
-
_d = _load_yaml(fpath_yaml)
|
|
110
|
-
|
|
111
|
-
for k, v in _d.items():
|
|
112
|
-
dist = v["distribution"]
|
|
113
|
-
|
|
114
|
-
if dist == "categorical":
|
|
115
|
-
_d[k] = trial.suggest_categorical(k, v["values"])
|
|
116
|
-
|
|
117
|
-
elif dist == "uniform":
|
|
118
|
-
_d[k] = trial.suggest_int(k, float(v["min"]), float(v["max"]))
|
|
119
|
-
|
|
120
|
-
elif dist == "loguniform":
|
|
121
|
-
_d[k] = trial.suggest_loguniform(k, float(v["min"]), float(v["max"]))
|
|
122
|
-
|
|
123
|
-
elif dist == "intloguniform":
|
|
124
|
-
_d[k] = trial.suggest_int(k, float(v["min"]), float(v["max"]), log=True)
|
|
125
|
-
|
|
126
|
-
return _d
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def load_study_rdb(study_name, rdb_raw_bytes_url):
|
|
130
|
-
"""
|
|
131
|
-
Load an Optuna study from a RDB storage.
|
|
132
|
-
|
|
133
|
-
Parameters:
|
|
134
|
-
-----------
|
|
135
|
-
study_name : str
|
|
136
|
-
The name of the Optuna study.
|
|
137
|
-
rdb_raw_bytes_url : str
|
|
138
|
-
The URL of the RDB storage.
|
|
139
|
-
|
|
140
|
-
Returns:
|
|
141
|
-
--------
|
|
142
|
-
optuna.study.Study
|
|
143
|
-
The loaded Optuna study object.
|
|
144
|
-
"""
|
|
145
|
-
import optuna
|
|
146
|
-
|
|
147
|
-
# rdb_raw_bytes_url = "sqlite:////tmp/fake/ywatanabe/_MicroNN_WindowSize-1.0-sec_MaxEpochs_100_2021-1216-1844/optuna_study_test_file#0.db"
|
|
148
|
-
storage = optuna.storages.RDBStorage(url=rdb_raw_bytes_url)
|
|
149
|
-
study = optuna.load_study(study_name=study_name, storage=storage)
|
|
150
|
-
print(f"\nLoaded: {rdb_raw_bytes_url}\n")
|
|
151
|
-
return study
|
|
152
|
-
|
|
153
|
-
|
|
154
112
|
# EOF
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# Time-stamp: "2024-11-14 07:41:34 (ywatanabe)"
|
|
4
3
|
# File: ./scitex_repo/src/scitex/io/_load_modules/_torch.py
|
|
5
4
|
|
|
5
|
+
try:
|
|
6
|
+
import torch
|
|
7
|
+
|
|
8
|
+
TORCH_AVAILABLE = True
|
|
9
|
+
except ImportError:
|
|
10
|
+
TORCH_AVAILABLE = False
|
|
11
|
+
|
|
6
12
|
|
|
7
13
|
def _load_torch(lpath, **kwargs):
|
|
8
14
|
"""Load PyTorch model/checkpoint file."""
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
if not TORCH_AVAILABLE:
|
|
16
|
+
raise ImportError(
|
|
17
|
+
"PyTorch is not installed. Please install with: pip install torch"
|
|
18
|
+
)
|
|
11
19
|
|
|
12
20
|
if not lpath.endswith((".pth", ".pt")):
|
|
13
21
|
raise ValueError("File must have .pth or .pt extension")
|
scitex/io/_save.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Save utilities for various data types to different file formats.
|
|
7
7
|
|
|
8
8
|
Supported formats include CSV, NPY, PKL, JOBLIB, PNG, HTML, TIFF, MP4, YAML,
|
|
9
|
-
JSON, HDF5, PTH, MAT, CBM, and
|
|
9
|
+
JSON, HDF5, PTH, MAT, CBM, and SciTeX bundles (.zip or directory).
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
import inspect
|
|
@@ -40,8 +40,6 @@ from ._save_modules import (
|
|
|
40
40
|
save_npz,
|
|
41
41
|
save_pickle,
|
|
42
42
|
save_pickle_compressed,
|
|
43
|
-
save_pltz_bundle,
|
|
44
|
-
save_stx_bundle,
|
|
45
43
|
save_tex,
|
|
46
44
|
save_text,
|
|
47
45
|
save_torch,
|
|
@@ -53,12 +51,9 @@ from ._save_modules import (
|
|
|
53
51
|
|
|
54
52
|
logger = logging.getLogger()
|
|
55
53
|
|
|
56
|
-
# Re-export for backward compatibility
|
|
57
54
|
_get_figure_with_data = get_figure_with_data
|
|
58
55
|
_symlink = symlink
|
|
59
56
|
_symlink_to = symlink_to
|
|
60
|
-
_save_stx_bundle = save_stx_bundle
|
|
61
|
-
_save_pltz_bundle = save_pltz_bundle
|
|
62
57
|
_handle_image_with_csv = handle_image_with_csv
|
|
63
58
|
|
|
64
59
|
|
|
@@ -278,17 +273,17 @@ def _save(
|
|
|
278
273
|
"""Core dispatcher for saving objects to various formats."""
|
|
279
274
|
ext = _os.path.splitext(spath)[1].lower()
|
|
280
275
|
|
|
281
|
-
# Check if this is a matplotlib figure being saved to
|
|
282
|
-
#
|
|
276
|
+
# Check if this is a matplotlib figure being saved to SciTeX bundle format
|
|
277
|
+
# SciTeX bundles use .zip (archive) or no extension (directory)
|
|
283
278
|
if _is_matplotlib_figure(obj):
|
|
284
|
-
# Save as
|
|
279
|
+
# Save as SciTeX bundle if:
|
|
285
280
|
# 1. Path ends with .zip (create ZIP bundle)
|
|
286
281
|
# 2. Path has no extension and doesn't match other formats (create directory bundle)
|
|
287
282
|
if ext == ".zip" or (ext == "" and not spath.endswith("/")):
|
|
288
|
-
# Check if explicitly requesting
|
|
283
|
+
# Check if explicitly requesting SciTeX bundle or just .zip
|
|
289
284
|
# Pop as_zip from kwargs to avoid duplicate parameter error
|
|
290
285
|
as_zip = kwargs.pop("as_zip", ext == ".zip")
|
|
291
|
-
|
|
286
|
+
_save_scitex_bundle(
|
|
292
287
|
obj, spath, as_zip, verbose, symlink_from_cwd, symlink_to, **kwargs
|
|
293
288
|
)
|
|
294
289
|
return
|
|
@@ -348,12 +343,12 @@ def _is_matplotlib_figure(obj):
|
|
|
348
343
|
return False
|
|
349
344
|
|
|
350
345
|
|
|
351
|
-
def
|
|
346
|
+
def _save_scitex_bundle(
|
|
352
347
|
obj, spath, as_zip, verbose, symlink_from_cwd, symlink_to_path, **kwargs
|
|
353
348
|
):
|
|
354
|
-
"""Save matplotlib figure as
|
|
349
|
+
"""Save matplotlib figure as SciTeX bundle (.zip or directory).
|
|
355
350
|
|
|
356
|
-
Delegates to scitex.
|
|
351
|
+
Delegates to scitex.io.bundle.from_matplotlib as the single source of truth
|
|
357
352
|
for bundle structure (canonical/artifacts/payload/children).
|
|
358
353
|
|
|
359
354
|
When figrecipe is available and enabled on the figure, also saves
|
|
@@ -362,7 +357,7 @@ def _save_fts_bundle(
|
|
|
362
357
|
# Get the actual matplotlib figure
|
|
363
358
|
import matplotlib.figure
|
|
364
359
|
|
|
365
|
-
from scitex.
|
|
360
|
+
from scitex.io.bundle import from_matplotlib
|
|
366
361
|
|
|
367
362
|
from ._save_modules._figure_utils import get_figure_with_data
|
|
368
363
|
|
|
@@ -390,7 +385,7 @@ def _save_fts_bundle(
|
|
|
390
385
|
except Exception:
|
|
391
386
|
pass
|
|
392
387
|
|
|
393
|
-
# Delegate to
|
|
388
|
+
# Delegate to Bundle (single source of truth)
|
|
394
389
|
# Encoding is built from CSV columns directly for consistency
|
|
395
390
|
from_matplotlib(fig, spath, name=name, csv_df=csv_df, dpi=dpi)
|
|
396
391
|
|
|
@@ -55,14 +55,10 @@ from ._mp4 import _mk_mp4 as save_mp4
|
|
|
55
55
|
from ._numpy import _save_npy as save_npy
|
|
56
56
|
from ._numpy import _save_npz as save_npz
|
|
57
57
|
from ._optuna_study_as_csv_and_pngs import save_optuna_study_as_csv_and_pngs
|
|
58
|
-
from ._pickle import
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
from .
|
|
62
|
-
_save_pickle_gz as save_pickle_compressed,
|
|
63
|
-
)
|
|
64
|
-
from ._pltz_bundle import save_pltz_bundle
|
|
65
|
-
from ._pltz_stx import save_pltz_as_stx
|
|
58
|
+
from ._pickle import _save_pickle as save_pickle
|
|
59
|
+
from ._pickle import _save_pickle_gz as save_pickle_compressed
|
|
60
|
+
from ._plot_bundle import save_plot_bundle
|
|
61
|
+
from ._plot_scitex import save_plot_as_scitex
|
|
66
62
|
from ._stx_bundle import save_stx_bundle
|
|
67
63
|
from ._symlink import symlink, symlink_to
|
|
68
64
|
from ._tex import _save_tex as save_tex
|
|
@@ -121,8 +117,8 @@ __all__ = [
|
|
|
121
117
|
"save_optuna_study_as_csv_and_pngs",
|
|
122
118
|
# Bundle save functions
|
|
123
119
|
"save_stx_bundle",
|
|
124
|
-
"
|
|
125
|
-
"
|
|
120
|
+
"save_plot_bundle",
|
|
121
|
+
"save_plot_as_scitex",
|
|
126
122
|
"save_separate_legends",
|
|
127
123
|
"handle_image_with_csv",
|
|
128
124
|
# Utilities
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Timestamp: 2025-12-08
|
|
4
4
|
# File: /home/ywatanabe/proj/scitex-code/src/scitex/io/_save_modules/_canvas.py
|
|
5
5
|
"""
|
|
6
|
-
Save canvas directory (.canvas) for scitex.
|
|
6
|
+
Save canvas directory (.canvas) for scitex.canvas.
|
|
7
7
|
|
|
8
8
|
Canvas directories are portable figure bundles containing:
|
|
9
9
|
- canvas.json: Layout, panels, composition settings
|
|
@@ -113,7 +113,7 @@ def _export_canvas_figures(
|
|
|
113
113
|
formats = ["png", "pdf", "svg"]
|
|
114
114
|
|
|
115
115
|
try:
|
|
116
|
-
from scitex.
|
|
116
|
+
from scitex.canvas.io.export import _compose_and_export
|
|
117
117
|
import json
|
|
118
118
|
|
|
119
119
|
# Load canvas.json
|
|
@@ -136,7 +136,7 @@ def _export_canvas_figures(
|
|
|
136
136
|
transparent=False,
|
|
137
137
|
)
|
|
138
138
|
except ImportError:
|
|
139
|
-
# scitex.
|
|
139
|
+
# scitex.canvas not available
|
|
140
140
|
pass
|
|
141
141
|
except Exception as e:
|
|
142
142
|
# Log but don't fail save if export fails
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# Time-stamp: "2024-11-02 17:01:15 (ywatanabe)"
|
|
4
3
|
# File: ./scitex_repo/src/scitex/io/_save_optuna_study_as_csv_and_pngs.py
|
|
5
4
|
|
|
5
|
+
try:
|
|
6
|
+
import optuna
|
|
7
|
+
|
|
8
|
+
OPTUNA_AVAILABLE = True
|
|
9
|
+
except ImportError:
|
|
10
|
+
OPTUNA_AVAILABLE = False
|
|
11
|
+
optuna = None
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
def save_optuna_study_as_csv_and_pngs(study, sdir):
|
|
8
|
-
|
|
15
|
+
if not OPTUNA_AVAILABLE:
|
|
16
|
+
raise ImportError(
|
|
17
|
+
"Optuna is not installed. Please install with: pip install optuna"
|
|
18
|
+
)
|
|
19
|
+
|
|
9
20
|
from .._save import save
|
|
10
21
|
|
|
11
22
|
## Trials DataFrame
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Timestamp: 2025-12-19
|
|
3
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/io/_save_modules/_plot_bundle.py
|
|
4
|
+
|
|
5
|
+
"""Save matplotlib figures as .plot bundles."""
|
|
6
|
+
|
|
7
|
+
import tempfile
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from scitex import logging
|
|
11
|
+
|
|
12
|
+
from ._figure_utils import get_figure_with_data
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def save_plot_bundle(obj, spath, as_zip=False, data=None, layered=True, **kwargs):
|
|
18
|
+
"""Save a matplotlib figure as a .plot bundle.
|
|
19
|
+
|
|
20
|
+
Bundle structure v2.0 (layered - default):
|
|
21
|
+
plot.plot/
|
|
22
|
+
spec.json # Semantic: WHAT to plot (canonical)
|
|
23
|
+
style.json # Appearance: HOW it looks (canonical)
|
|
24
|
+
data.csv # Raw data (immutable)
|
|
25
|
+
exports/ # PNG, SVG, hitmap
|
|
26
|
+
cache/ # geometry_px.json, render_manifest.json
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
obj : matplotlib.figure.Figure
|
|
31
|
+
The figure to save.
|
|
32
|
+
spath : str or Path
|
|
33
|
+
Output path (e.g., "plot.plot" or "plot.plot.zip").
|
|
34
|
+
as_zip : bool
|
|
35
|
+
If True, save as ZIP archive.
|
|
36
|
+
data : pandas.DataFrame, optional
|
|
37
|
+
Data to embed in the bundle as plot.csv.
|
|
38
|
+
layered : bool
|
|
39
|
+
If True (default), use new layered format (spec/style/geometry).
|
|
40
|
+
**kwargs
|
|
41
|
+
Additional arguments passed to savefig.
|
|
42
|
+
"""
|
|
43
|
+
import shutil
|
|
44
|
+
|
|
45
|
+
import matplotlib.figure
|
|
46
|
+
|
|
47
|
+
p = Path(spath)
|
|
48
|
+
|
|
49
|
+
# Extract basename from path
|
|
50
|
+
basename = p.stem
|
|
51
|
+
if basename.endswith(".plot"):
|
|
52
|
+
basename = basename[:-5]
|
|
53
|
+
elif basename.endswith(".zip"):
|
|
54
|
+
basename = Path(basename).stem
|
|
55
|
+
if basename.endswith(".plot"):
|
|
56
|
+
basename = basename[:-5]
|
|
57
|
+
|
|
58
|
+
# Extract figure from various matplotlib object types
|
|
59
|
+
fig = obj
|
|
60
|
+
if hasattr(obj, "figure"):
|
|
61
|
+
fig = obj.figure
|
|
62
|
+
elif hasattr(obj, "fig"):
|
|
63
|
+
fig = obj.fig
|
|
64
|
+
|
|
65
|
+
if not isinstance(fig, matplotlib.figure.Figure):
|
|
66
|
+
raise TypeError(f"Expected matplotlib Figure, got {type(obj).__name__}")
|
|
67
|
+
|
|
68
|
+
dpi = kwargs.pop("dpi", 300)
|
|
69
|
+
|
|
70
|
+
# === Always use layered format ===
|
|
71
|
+
# Determine bundle directory path
|
|
72
|
+
if as_zip:
|
|
73
|
+
temp_dir = Path(tempfile.mkdtemp())
|
|
74
|
+
bundle_dir = temp_dir / f"{basename}.plot"
|
|
75
|
+
zip_path = p if not str(p).endswith(".zip") else p
|
|
76
|
+
else:
|
|
77
|
+
bundle_dir = p if str(p).endswith(".plot") else Path(str(p) + ".plot")
|
|
78
|
+
temp_dir = None
|
|
79
|
+
|
|
80
|
+
# Get CSV data from figure if not provided
|
|
81
|
+
csv_df = data
|
|
82
|
+
if csv_df is None:
|
|
83
|
+
csv_source = get_figure_with_data(obj)
|
|
84
|
+
if csv_source is not None and hasattr(csv_source, "export_as_csv"):
|
|
85
|
+
try:
|
|
86
|
+
csv_df = csv_source.export_as_csv()
|
|
87
|
+
except Exception:
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
from scitex.plt.io import save_layered_plot_bundle
|
|
91
|
+
|
|
92
|
+
save_layered_plot_bundle(
|
|
93
|
+
fig=fig,
|
|
94
|
+
bundle_dir=bundle_dir,
|
|
95
|
+
basename=basename,
|
|
96
|
+
dpi=dpi,
|
|
97
|
+
csv_df=csv_df,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Compress to ZIP if requested
|
|
101
|
+
if as_zip:
|
|
102
|
+
import zipfile
|
|
103
|
+
|
|
104
|
+
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf:
|
|
105
|
+
for file_path in bundle_dir.rglob("*"):
|
|
106
|
+
if file_path.is_file():
|
|
107
|
+
arcname = file_path.relative_to(bundle_dir.parent)
|
|
108
|
+
zf.write(file_path, arcname)
|
|
109
|
+
shutil.rmtree(temp_dir)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# EOF
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# Timestamp: 2025-12-19
|
|
3
|
-
# File: /home/ywatanabe/proj/scitex-code/src/scitex/io/_save_modules/
|
|
3
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/io/_save_modules/_plot_scitex.py
|
|
4
4
|
|
|
5
|
-
"""Save matplotlib figures as
|
|
5
|
+
"""Save matplotlib figures as SciTeX bundles (ZIP or directory) with plot content type."""
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
8
|
import tempfile
|
|
@@ -199,8 +199,8 @@ def _build_theme_from_figure(fig):
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
|
|
202
|
-
def
|
|
203
|
-
"""Save a matplotlib figure as
|
|
202
|
+
def save_plot_as_scitex(obj, spath, as_zip=True, basename=None, **kwargs):
|
|
203
|
+
"""Save a matplotlib figure as a SciTeX bundle (ZIP or directory).
|
|
204
204
|
|
|
205
205
|
Bundle structure:
|
|
206
206
|
plot_name/ # or plot_name.zip (with plot_name/ inside)
|
|
@@ -463,7 +463,7 @@ def _generate_readme(bundle_dir, basename, spec, csv_df):
|
|
|
463
463
|
from datetime import datetime
|
|
464
464
|
|
|
465
465
|
readme_lines = [
|
|
466
|
-
f"# {basename}
|
|
466
|
+
f"# {basename} SciTeX Bundle",
|
|
467
467
|
"",
|
|
468
468
|
"## Overview",
|
|
469
469
|
"",
|
|
@@ -517,9 +517,9 @@ def _generate_readme(bundle_dir, basename, spec, csv_df):
|
|
|
517
517
|
"## Usage",
|
|
518
518
|
"",
|
|
519
519
|
"```python",
|
|
520
|
-
"from scitex.
|
|
520
|
+
"from scitex.io.bundle import Bundle",
|
|
521
521
|
"",
|
|
522
|
-
f'bundle =
|
|
522
|
+
f'bundle = Bundle("{basename}.zip") # or "{basename}/" directory',
|
|
523
523
|
"bundle.show() # Display",
|
|
524
524
|
'bundle.export("output.png") # Export',
|
|
525
525
|
"```",
|