easyscience 2.5.1__tar.gz → 3.0.2__tar.gz
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.
- {easyscience-2.5.1 → easyscience-3.0.2}/.copier-answers.yml +1 -1
- easyscience-3.0.2/.github/workflows/pypi-publish-check.yml +77 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/pypi-publish.yml +3 -1
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/pypi-test.yml +0 -4
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/test.yml +0 -34
- {easyscience-2.5.1 → easyscience-3.0.2}/PKG-INFO +2 -2
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/index.md +7 -10
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/introduction/index.md +1 -1
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/tutorials/fitting-bayesian.ipynb +36 -46
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/tutorials/fitting-qens.ipynb +6 -6
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/tutorials/fitting-sans.ipynb +6 -6
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/tutorials/progress-callback.ipynb +20 -28
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/user-guide/controlling-log-output.md +1 -5
- easyscience-3.0.2/docs/docs/user-guide/external-calculators.md +332 -0
- easyscience-3.0.2/docs/docs/user-guide/index.md +17 -0
- easyscience-3.0.2/docs/docs/user-guide/parameter-dependency-serialization.md +179 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/mkdocs.yml +3 -2
- {easyscience-2.5.1 → easyscience-3.0.2}/pixi.lock +5891 -5717
- {easyscience-2.5.1 → easyscience-3.0.2}/pixi.toml +9 -12
- easyscience-3.0.2/prettierrc.toml +24 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/pyproject.toml +82 -85
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/__init__.py +6 -8
- easyscience-3.0.2/src/easyscience/base_classes/__init__.py +7 -0
- easyscience-2.5.1/src/easyscience/base_classes/new_base.py → easyscience-3.0.2/src/easyscience/base_classes/easy_base.py +36 -36
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/base_classes/easy_list.py +54 -30
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/base_classes/model_base.py +5 -14
- {easyscience-2.5.1/src/easyscience/io → easyscience-3.0.2/src/easyscience/base_classes}/serializer_base.py +48 -83
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/__init__.py +0 -1
- easyscience-3.0.2/src/easyscience/fitting/engine_base.py +241 -0
- easyscience-3.0.2/src/easyscience/fitting/fitter.py +328 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/__init__.py +1 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/bumps_utils/__init__.py +4 -2
- easyscience-3.0.2/src/easyscience/fitting/minimizers/bumps_utils/problem.py +134 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/factory.py +6 -8
- easyscience-3.0.2/src/easyscience/fitting/minimizers/minimizer_base.py +139 -0
- easyscience-3.0.2/src/easyscience/fitting/minimizers/minimizer_bumps.py +439 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/minimizer_dfo.py +24 -96
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/minimizer_lmfit.py +34 -116
- easyscience-2.5.1/src/easyscience/fitting/available_minimizers.py → easyscience-3.0.2/src/easyscience/fitting/minimizers/minimizers.py +3 -37
- easyscience-3.0.2/src/easyscience/fitting/multi_fitter.py +146 -0
- easyscience-3.0.2/src/easyscience/fitting/reshaping.py +216 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/sampler.py +185 -141
- easyscience-3.0.2/src/easyscience/fitting/samplers/__init__.py +5 -0
- easyscience-3.0.2/src/easyscience/fitting/samplers/sampler_bumps.py +367 -0
- easyscience-3.0.2/src/easyscience/fitting/samplers/validation.py +33 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/global_object/__init__.py +1 -3
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/global_object/global_object.py +5 -23
- easyscience-3.0.2/src/easyscience/global_object/object_registry.py +77 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/job/analysis.py +12 -20
- easyscience-3.0.2/src/easyscience/job/experiment.py +20 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/job/job.py +5 -5
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/job/theoreticalmodel.py +6 -9
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/__init__.py +6 -8
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/descriptor_array.py +54 -67
- easyscience-3.0.2/src/easyscience/variable/descriptor_base.py +156 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/descriptor_bool.py +26 -11
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/descriptor_number.py +55 -69
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/descriptor_str.py +26 -9
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/parameter.py +35 -174
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/variable/parameter_dependency_resolver.py +2 -2
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/conftest.py +6 -3
- easyscience-3.0.2/tests/helpers/easy_test_models.py +111 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/integration/fitting/test_fitter.py +122 -113
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/integration/fitting/test_multi_fitter.py +72 -56
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/integration/fitting/test_sampler.py +148 -105
- easyscience-3.0.2/tests/integration/fitting/test_stateless_calculator.py +139 -0
- easyscience-2.5.1/tests/unit/base_classes/test_new_base.py → easyscience-3.0.2/tests/unit/base_classes/test_easy_base.py +126 -49
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/base_classes/test_easy_list.py +253 -31
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/base_classes/test_model_base.py +19 -28
- easyscience-3.0.2/tests/unit/base_classes/test_model_with_easy_list.py +112 -0
- {easyscience-2.5.1/tests/unit/io → easyscience-3.0.2/tests/unit/base_classes}/test_serializer_base.py +106 -77
- easyscience-3.0.2/tests/unit/fitting/minimizers/bumps_utils/__init__.py +2 -0
- easyscience-3.0.2/tests/unit/fitting/minimizers/bumps_utils/test_problem.py +166 -0
- easyscience-3.0.2/tests/unit/fitting/minimizers/test_factory.py +57 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/minimizers/test_minimizer_base.py +5 -5
- easyscience-3.0.2/tests/unit/fitting/minimizers/test_minimizer_bumps.py +847 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/minimizers/test_minimizer_dfo.py +10 -127
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/minimizers/test_minimizer_lmfit.py +50 -114
- easyscience-3.0.2/tests/unit/fitting/samplers/__init__.py +2 -0
- easyscience-3.0.2/tests/unit/fitting/samplers/test_sampler_bumps.py +486 -0
- easyscience-3.0.2/tests/unit/fitting/samplers/test_validation.py +36 -0
- easyscience-3.0.2/tests/unit/fitting/test_engine_base.py +47 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/test_fitter.py +13 -49
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/test_multi_fitter.py +143 -8
- easyscience-3.0.2/tests/unit/fitting/test_reshaping.py +100 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/test_sampler.py +213 -114
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/global_object/test_global_object.py +22 -48
- easyscience-3.0.2/tests/unit/global_object/test_integration_comprehensive.py +293 -0
- easyscience-3.0.2/tests/unit/global_object/test_object_registry.py +262 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/io/test_serializer_component.py +2 -4
- easyscience-3.0.2/tests/unit/job/__init__.py +2 -0
- easyscience-3.0.2/tests/unit/job/test_job.py +141 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_descriptor_array.py +434 -318
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_descriptor_base.py +22 -50
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_descriptor_bool.py +2 -7
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_descriptor_number.py +58 -97
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_descriptor_str.py +2 -7
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_parameter.py +464 -339
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/variable/test_parameter_dependency_serialization.py +97 -99
- easyscience-2.5.1/docs/docs/api-reference/io.md +0 -1
- easyscience-2.5.1/docs/docs/api-reference/models.md +0 -1
- easyscience-2.5.1/docs/docs/user-guide/index.md +0 -10
- easyscience-2.5.1/legacy/Examples/README.rst +0 -4
- easyscience-2.5.1/legacy/Examples/base/README.rst +0 -6
- easyscience-2.5.1/legacy/Examples/base/plot_baseclass1.py +0 -97
- easyscience-2.5.1/legacy/Examples/fitting/README.rst +0 -6
- easyscience-2.5.1/legacy/PARAMETER_DEPENDENCY_SERIALIZATION.md +0 -259
- easyscience-2.5.1/legacy/examples_old/dataset_examples.ipynb +0 -1254
- easyscience-2.5.1/legacy/examples_old/dimer_example.ipynb +0 -1144
- easyscience-2.5.1/legacy/examples_old/example1.py +0 -30
- easyscience-2.5.1/legacy/examples_old/example1_dream.py +0 -45
- easyscience-2.5.1/legacy/examples_old/example2.py +0 -53
- easyscience-2.5.1/legacy/examples_old/example3.py +0 -101
- easyscience-2.5.1/legacy/examples_old/example4.py +0 -448
- easyscience-2.5.1/legacy/examples_old/example5_broken.py +0 -367
- easyscience-2.5.1/legacy/examples_old/example6_broken.py +0 -446
- easyscience-2.5.1/legacy/examples_old/example_dataset.py +0 -56
- easyscience-2.5.1/legacy/examples_old/example_dataset2.py +0 -50
- easyscience-2.5.1/legacy/examples_old/example_dataset2pt2.py +0 -57
- easyscience-2.5.1/legacy/examples_old/example_dataset2pt2_broken.py +0 -57
- easyscience-2.5.1/legacy/examples_old/example_dataset3.py +0 -92
- easyscience-2.5.1/legacy/examples_old/example_dataset3pt2.py +0 -62
- easyscience-2.5.1/legacy/examples_old/example_dataset4.py +0 -49
- easyscience-2.5.1/legacy/examples_old/example_dataset4_2.py +0 -67
- easyscience-2.5.1/prettierrc.toml +0 -22
- easyscience-2.5.1/src/easyscience/base_classes/__init__.py +0 -11
- easyscience-2.5.1/src/easyscience/base_classes/based_base.py +0 -269
- easyscience-2.5.1/src/easyscience/base_classes/collection_base.py +0 -18
- easyscience-2.5.1/src/easyscience/base_classes/obj_base.py +0 -18
- easyscience-2.5.1/src/easyscience/fitting/calculators/__init__.py +0 -6
- easyscience-2.5.1/src/easyscience/fitting/calculators/interface_factory.py +0 -268
- easyscience-2.5.1/src/easyscience/fitting/fitter.py +0 -529
- easyscience-2.5.1/src/easyscience/fitting/minimizers/minimizer_base.py +0 -340
- easyscience-2.5.1/src/easyscience/fitting/minimizers/minimizer_bumps.py +0 -842
- easyscience-2.5.1/src/easyscience/fitting/multi_fitter.py +0 -189
- easyscience-2.5.1/src/easyscience/global_object/hugger/hugger.py +0 -221
- easyscience-2.5.1/src/easyscience/global_object/hugger/property.py +0 -281
- easyscience-2.5.1/src/easyscience/global_object/map.py +0 -337
- easyscience-2.5.1/src/easyscience/global_object/undo_redo.py +0 -472
- easyscience-2.5.1/src/easyscience/io/__init__.py +0 -12
- easyscience-2.5.1/src/easyscience/io/serializer_component.py +0 -123
- easyscience-2.5.1/src/easyscience/io/serializer_dict.py +0 -78
- easyscience-2.5.1/src/easyscience/job/experiment.py +0 -19
- easyscience-2.5.1/src/easyscience/legacy/__init__.py +0 -7
- easyscience-2.5.1/src/easyscience/legacy/collection_base.py +0 -338
- easyscience-2.5.1/src/easyscience/legacy/dict.py +0 -179
- easyscience-2.5.1/src/easyscience/legacy/json.py +0 -139
- easyscience-2.5.1/src/easyscience/legacy/legacy_core.py +0 -220
- easyscience-2.5.1/src/easyscience/legacy/obj_base.py +0 -171
- easyscience-2.5.1/src/easyscience/legacy/xml.py +0 -197
- easyscience-2.5.1/src/easyscience/models/__init__.py +0 -4
- easyscience-2.5.1/src/easyscience/models/polynomial.py +0 -78
- easyscience-2.5.1/src/easyscience/utils/classTools.py +0 -66
- easyscience-2.5.1/src/easyscience/variable/descriptor_any_type.py +0 -105
- easyscience-2.5.1/src/easyscience/variable/descriptor_base.py +0 -289
- easyscience-2.5.1/tests/functional/test_smoke.py +0 -20
- easyscience-2.5.1/tests/unit/base_classes/test_collection_base.py +0 -545
- easyscience-2.5.1/tests/unit/base_classes/test_deprecated_wrappers.py +0 -87
- easyscience-2.5.1/tests/unit/base_classes/test_obj_base.py +0 -498
- easyscience-2.5.1/tests/unit/fitting/calculators/test_interface_factory.py +0 -563
- easyscience-2.5.1/tests/unit/fitting/minimizers/test_factory.py +0 -110
- easyscience-2.5.1/tests/unit/fitting/minimizers/test_minimizer_bumps.py +0 -1341
- easyscience-2.5.1/tests/unit/global_object/__init__.py +0 -3
- easyscience-2.5.1/tests/unit/global_object/test_entry_list_comprehensive.py +0 -320
- easyscience-2.5.1/tests/unit/global_object/test_integration_comprehensive.py +0 -456
- easyscience-2.5.1/tests/unit/global_object/test_map.py +0 -757
- easyscience-2.5.1/tests/unit/global_object/test_undo_redo.py +0 -449
- easyscience-2.5.1/tests/unit/global_object/test_undo_redo_comprehensive.py +0 -705
- easyscience-2.5.1/tests/unit/io/test_serializer_dict.py +0 -121
- easyscience-2.5.1/tests/unit/legacy/__init__.py +0 -3
- easyscience-2.5.1/tests/unit/legacy/test_collection_base.py +0 -155
- easyscience-2.5.1/tests/unit/legacy/test_dict.py +0 -3
- easyscience-2.5.1/tests/unit/legacy/test_json.py +0 -3
- easyscience-2.5.1/tests/unit/legacy/test_obj_base.py +0 -119
- easyscience-2.5.1/tests/unit/legacy/test_xml.py +0 -3
- easyscience-2.5.1/tests/unit/models/__init__.py +0 -3
- easyscience-2.5.1/tests/unit/models/test_polynomial.py +0 -192
- easyscience-2.5.1/tests/unit/variable/__init__.py +0 -3
- easyscience-2.5.1/tests/unit/variable/test_descriptor_any_type.py +0 -83
- {easyscience-2.5.1 → easyscience-3.0.2}/.badgery.yaml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.codecov.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.coveragerc +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/download-artifact/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/github-script/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/setup-easyscience-bot/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/setup-pixi/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/upload-artifact/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/actions/upload-codecov/action.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/configs/pages-deployment.json +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/configs/rulesets-develop.json +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/configs/rulesets-gh-pages.json +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/configs/rulesets-master.json +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/scripts/backmerge-conflict-issue.js +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/scripts/publish-dashboard.sh +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/backmerge.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/cleanup.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/coverage.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/dashboard.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/docs.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/issues-labels.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/lint-format.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/pr-labels.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/release-notes.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/release-pr.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/security.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/test-trigger.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/tutorial-tests-trigger.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.github/workflows/tutorial-tests.yml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.gitignore +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.pre-commit-config.yaml +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/.prettierignore +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/CONTRIBUTING.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/LICENSE +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/README.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/base_classes.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/fitting.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/global_object.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/job.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/utils.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/api-reference/variable.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/images/favicon.png +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/images/logo_dark.svg +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/images/logo_light.svg +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/javascripts/extra.js +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/javascripts/mathjax.js +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/assets/stylesheets/extra.css +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/index.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/installation-and-setup/index.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/docs/tutorials/index.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/includes/abbreviations.md +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/overrides/.icons/app.svg +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/overrides/.icons/easyscience.svg +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/overrides/.icons/google-colab.svg +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/overrides/main.html +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/docs/overrides/partials/logo.html +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/bumps_utils/eval_counter.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/bumps_utils/progress_monitor.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/fitting/minimizers/utils.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/global_object/logger.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/job/__init__.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/utils/__init__.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/utils/classUtils.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/utils/decorators.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/src/easyscience/utils/string.py +0 -0
- {easyscience-2.5.1/src/easyscience/global_object/hugger → easyscience-3.0.2/tests/unit/base_classes}/__init__.py +0 -0
- {easyscience-2.5.1/tests/unit/base_classes → easyscience-3.0.2/tests/unit/fitting}/__init__.py +0 -0
- {easyscience-2.5.1/tests/unit/fitting → easyscience-3.0.2/tests/unit/fitting/minimizers}/__init__.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/fitting/minimizers/test_utils.py +0 -0
- {easyscience-2.5.1/tests/unit/fitting/calculators → easyscience-3.0.2/tests/unit/global_object}/__init__.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tests/unit/global_object/test_logger.py +0 -0
- {easyscience-2.5.1/tests/unit/fitting/minimizers → easyscience-3.0.2/tests/unit/variable}/__init__.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tools/license_headers.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tools/update_docs_assets.py +0 -0
- {easyscience-2.5.1 → easyscience-3.0.2}/tools/update_github_labels.py +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Dry run of the PyPI publishing workflow (see pypi-publish.yml).
|
|
2
|
+
# Performs the same setup and build steps on a simulated release tag, but
|
|
3
|
+
# never uploads anything. It fails if:
|
|
4
|
+
# - pixi.lock is out of date for the pixi version used on GitHub runners
|
|
5
|
+
# (pixi commands without --frozen would rewrite it, e.g. the shell-hook
|
|
6
|
+
# run by setup-pixi to activate the environment)
|
|
7
|
+
# - any tracked file is modified before the build, which gives
|
|
8
|
+
# versioningit a '+dirty' local version that PyPI rejects
|
|
9
|
+
# - the built package has a local version or fails 'twine check'
|
|
10
|
+
|
|
11
|
+
name: PyPI publishing check
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
pull_request:
|
|
15
|
+
branches: [master, develop]
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
concurrency:
|
|
22
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
23
|
+
cancel-in-progress: true
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
pypi-publish-check:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Check-out repository
|
|
31
|
+
uses: actions/checkout@v6
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
|
|
35
|
+
# Same setup as in pypi-publish.yml, so any pixi.lock rewrite done by
|
|
36
|
+
# setup-pixi itself is reproduced here
|
|
37
|
+
- name: Set up pixi
|
|
38
|
+
uses: ./.github/actions/setup-pixi
|
|
39
|
+
|
|
40
|
+
# setup-pixi may already have rewritten pixi.lock, so compare it with
|
|
41
|
+
# the committed version as well as running 'pixi lock --check'
|
|
42
|
+
- name: Check pixi.lock is up to date
|
|
43
|
+
run: |
|
|
44
|
+
pixi --version
|
|
45
|
+
if ! git diff --quiet -- pixi.lock || ! pixi lock --check; then
|
|
46
|
+
git diff --stat -- pixi.lock
|
|
47
|
+
echo "::error file=pixi.lock::pixi.lock is out of date for $(pixi --version). Update pixi locally (pixi self-update), run 'pixi lock' and commit pixi.lock."
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
- name: Check working tree is clean
|
|
52
|
+
run: |
|
|
53
|
+
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
|
54
|
+
echo "::error::Tracked files were modified before the build, so the package version would get a '+dirty' suffix:"
|
|
55
|
+
git status --porcelain --untracked-files=no
|
|
56
|
+
git diff --stat
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
- name: Simulate release tag
|
|
61
|
+
run: git tag v9999.0.0
|
|
62
|
+
|
|
63
|
+
- name: Create Python package
|
|
64
|
+
run: pixi run --frozen default-build
|
|
65
|
+
|
|
66
|
+
- name: Check package version
|
|
67
|
+
run: |
|
|
68
|
+
ls -l dist/
|
|
69
|
+
for f in dist/*; do
|
|
70
|
+
if [[ "$(basename "$f")" == *+* ]]; then
|
|
71
|
+
echo "::error::$(basename "$f") has a local version, which PyPI rejects."
|
|
72
|
+
exit 1
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
- name: Check package metadata
|
|
77
|
+
run: pipx run twine check --strict dist/*
|
|
@@ -28,8 +28,10 @@ jobs:
|
|
|
28
28
|
uses: ./.github/actions/setup-pixi
|
|
29
29
|
|
|
30
30
|
# Build the Python package (to dist/ folder)
|
|
31
|
+
# --frozen stops pixi from rewriting pixi.lock, which would make the
|
|
32
|
+
# tree dirty and give versioningit a '+dirty' version PyPI rejects
|
|
31
33
|
- name: Create Python package
|
|
32
|
-
run: pixi run default-build
|
|
34
|
+
run: pixi run --frozen default-build
|
|
33
35
|
|
|
34
36
|
# Publish the package to PyPI (from dist/ folder)
|
|
35
37
|
# Instead of publishing with personal access token, we use
|
|
@@ -69,10 +69,6 @@ jobs:
|
|
|
69
69
|
working-directory: easyscience
|
|
70
70
|
run: pixi run python -m pytest ../tests/unit/ --color=yes -v
|
|
71
71
|
|
|
72
|
-
- name: Run functional tests to verify the installation
|
|
73
|
-
working-directory: easyscience
|
|
74
|
-
run: pixi run python -m pytest ../tests/functional/ --color=yes -v
|
|
75
|
-
|
|
76
72
|
- name: Run integration tests to verify the installation
|
|
77
73
|
working-directory: easyscience
|
|
78
74
|
run: pixi run python -m pytest ../tests/integration/ --color=yes -n auto
|
|
@@ -102,21 +102,6 @@ jobs:
|
|
|
102
102
|
pixi run --environment $env unit-tests
|
|
103
103
|
done
|
|
104
104
|
|
|
105
|
-
- name: Run functional tests
|
|
106
|
-
shell: bash
|
|
107
|
-
run: |
|
|
108
|
-
set -euo pipefail
|
|
109
|
-
|
|
110
|
-
for py_ver in $PY_VERSIONS; do
|
|
111
|
-
echo
|
|
112
|
-
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
|
|
113
|
-
|
|
114
|
-
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.XX -> py-3XX-env
|
|
115
|
-
|
|
116
|
-
echo "Running tests in environment: $env"
|
|
117
|
-
pixi run --environment $env functional-tests
|
|
118
|
-
done
|
|
119
|
-
|
|
120
105
|
- name: Run integration tests ${{ needs.env-prepare.outputs.pytest-marks }}
|
|
121
106
|
shell: bash
|
|
122
107
|
run: |
|
|
@@ -258,25 +243,6 @@ jobs:
|
|
|
258
243
|
cd ..
|
|
259
244
|
done
|
|
260
245
|
|
|
261
|
-
- name: Run functional tests
|
|
262
|
-
shell: bash
|
|
263
|
-
run: |
|
|
264
|
-
set -euo pipefail
|
|
265
|
-
|
|
266
|
-
for py_ver in $PY_VERSIONS; do
|
|
267
|
-
echo
|
|
268
|
-
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
|
|
269
|
-
|
|
270
|
-
echo "Entering pixi project directory easyscience_py$py_ver"
|
|
271
|
-
cd easyscience_py$py_ver
|
|
272
|
-
|
|
273
|
-
echo "Running tests"
|
|
274
|
-
pixi run python -m pytest ../tests/functional/ --color=yes -v
|
|
275
|
-
|
|
276
|
-
echo "Exiting pixi project directory"
|
|
277
|
-
cd ..
|
|
278
|
-
done
|
|
279
|
-
|
|
280
246
|
- name: Run integration tests ${{ needs.env-prepare.outputs.pytest-marks }}
|
|
281
247
|
shell: bash
|
|
282
248
|
run: |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: easyscience
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.2
|
|
4
4
|
Summary: Core building blocks for EasyScience
|
|
5
5
|
Project-URL: Documentation, https://easyscience.github.io/core
|
|
6
6
|
Project-URL: Release Notes, https://github.com/easyscience/core/releases
|
|
@@ -8,19 +8,16 @@ This section contains the reference detailing the functions and modules
|
|
|
8
8
|
available in EasyScience.
|
|
9
9
|
|
|
10
10
|
- [base_classes](base_classes.md) – Core abstract and helper base
|
|
11
|
-
classes used to build EasyScience objects (e.g. `
|
|
12
|
-
`ModelBase`).
|
|
13
|
-
- [fitting](fitting.md) – Fitting
|
|
14
|
-
`
|
|
11
|
+
classes used to build EasyScience objects (e.g. `EasyBase`,
|
|
12
|
+
`ModelBase`, `EasyList`, `SerializerBase`).
|
|
13
|
+
- [fitting](fitting.md) – Fitting and sampling, including `Fitter`,
|
|
14
|
+
`Sampler` and the available minimizers.
|
|
15
15
|
- [global_object](global_object.md) – Global singleton providing shared
|
|
16
|
-
services (logger
|
|
17
|
-
- [io](io.md) – Serialization and deserialization framework for
|
|
18
|
-
persisting EasyScience objects (serializers and components).
|
|
16
|
+
services (logger and object registry).
|
|
19
17
|
- [job](job.md) – Job and experiment abstractions for running and
|
|
20
18
|
organizing analyses.
|
|
21
|
-
- [models](models.md) – Predefined model implementations (e.g.
|
|
22
|
-
polynomial models) used in fitting workflows.
|
|
23
19
|
- [utils](utils.md) – Miscellaneous utility functions and helpers (class
|
|
24
20
|
tools, decorators, type helpers).
|
|
25
21
|
- [variable](variable.md) – Descriptor types and variable abstractions
|
|
26
|
-
(e.g. `DescriptorNumber`, `Parameter`, `DescriptorArray`).
|
|
22
|
+
(e.g. `DescriptorNumber`, `Parameter`, `DescriptorArray`). All of them
|
|
23
|
+
are `EasyBase` objects, serialized with `to_dict`/`from_dict`.
|
|
@@ -41,7 +41,7 @@ Zenodo, each with a version-specific Digital Object Identifier (DOI).
|
|
|
41
41
|
|
|
42
42
|
Citation details in various styles (e.g., APA, MLA) and formats (e.g.,
|
|
43
43
|
BibTeX, JSON) are available on the
|
|
44
|
-
[Zenodo archive page](https://doi.org/10.5281/zenodo.
|
|
44
|
+
[Zenodo archive page](https://doi.org/10.5281/zenodo.19918609).
|
|
45
45
|
|
|
46
46
|
## Contributing
|
|
47
47
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"\n",
|
|
29
29
|
"where $\\theta$ are the model parameters, $d$ is the observed data, $p(d \\mid \\theta)$ is the likelihood, and $p(\\theta)$ is the prior. In `easyscience`, the `min`/`max` bounds of a `Parameter` are interpreted as a **uniform prior**, and a Gaussian likelihood is constructed from the data and supplied weights.\n",
|
|
30
30
|
"\n",
|
|
31
|
-
"`easyscience` exposes a Bayesian Markov-chain Monte Carlo (MCMC) sampler through the `Sampler` class
|
|
31
|
+
"`easyscience` exposes a Bayesian Markov-chain Monte Carlo (MCMC) sampler through the `Sampler` class.\n",
|
|
32
32
|
"\n",
|
|
33
33
|
"```{note}\n",
|
|
34
34
|
"This tutorial focuses on Bayesian analysis with a simple QENS model for illustration. For dedicated QENS fitting with more sophisticated models, consider using [`EasyDynamics`](https://github.com/easyscience/easydynamics).\n",
|
|
@@ -138,12 +138,12 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"cell_type": "markdown",
|
|
141
|
-
"id": "
|
|
141
|
+
"id": "7",
|
|
142
142
|
"metadata": {},
|
|
143
143
|
"source": [
|
|
144
144
|
"## Defining parameters with priors\n",
|
|
145
145
|
"\n",
|
|
146
|
-
"Create four `Parameter` objects, for the area $A$, $\\gamma$, $\\omega_0$ and $\\sigma$. The `min` and `max` arguments define a **uniform prior** on each parameter — the sampler will only consider values inside this range and will treat every value inside the range as equally plausible *a priori
|
|
146
|
+
"Create four `Parameter` objects, for the area $A$, $\\gamma$, $\\omega_0$ and $\\sigma$. The `min` and `max` arguments define a **uniform prior** on each parameter — the sampler will only consider values inside this range and will treat every value inside the range as equally plausible *a priori*. The parameters are then collected in an `EasyList` container: this is the model object that both `Fitter` and `Sampler` take, so it is defined here, before the optional fit.\n",
|
|
147
147
|
"\n",
|
|
148
148
|
"| Parameter | Initial Value | Min | Max |\n",
|
|
149
149
|
"| --- | --- | --- | --- |\n",
|
|
@@ -156,21 +156,24 @@
|
|
|
156
156
|
{
|
|
157
157
|
"cell_type": "code",
|
|
158
158
|
"execution_count": null,
|
|
159
|
-
"id": "
|
|
159
|
+
"id": "8",
|
|
160
160
|
"metadata": {},
|
|
161
161
|
"outputs": [],
|
|
162
162
|
"source": [
|
|
163
|
+
"from easyscience import EasyList\n",
|
|
163
164
|
"from easyscience import Parameter\n",
|
|
164
165
|
"\n",
|
|
165
|
-
"area = Parameter(
|
|
166
|
-
"gamma = Parameter(
|
|
167
|
-
"omega_0 = Parameter(
|
|
168
|
-
"sigma = Parameter(
|
|
166
|
+
"area = Parameter(display_name='area', value=10, fixed=False, min=1, max=100)\n",
|
|
167
|
+
"gamma = Parameter(display_name='gamma', value=8e-3, fixed=False, min=1e-4, max=1e-2)\n",
|
|
168
|
+
"omega_0 = Parameter(display_name='omega_0', value=1e-3, fixed=False, min=0, max=2e-3)\n",
|
|
169
|
+
"sigma = Parameter(display_name='sigma', value=1e-3, fixed=False, min=1e-5, max=1e-1)\n",
|
|
170
|
+
"\n",
|
|
171
|
+
"parameter_container = EasyList(area, gamma, omega_0, sigma)"
|
|
169
172
|
]
|
|
170
173
|
},
|
|
171
174
|
{
|
|
172
175
|
"cell_type": "markdown",
|
|
173
|
-
"id": "
|
|
176
|
+
"id": "9",
|
|
174
177
|
"metadata": {},
|
|
175
178
|
"source": [
|
|
176
179
|
"## The model\n",
|
|
@@ -193,7 +196,7 @@
|
|
|
193
196
|
{
|
|
194
197
|
"cell_type": "code",
|
|
195
198
|
"execution_count": null,
|
|
196
|
-
"id": "
|
|
199
|
+
"id": "10",
|
|
197
200
|
"metadata": {},
|
|
198
201
|
"outputs": [],
|
|
199
202
|
"source": [
|
|
@@ -217,9 +220,7 @@
|
|
|
217
220
|
"source": [
|
|
218
221
|
"## Maximum-likelihood fit (optional, but recommended)\n",
|
|
219
222
|
"\n",
|
|
220
|
-
"Perform a quick maximum-likelihood fit
|
|
221
|
-
"needs a *configured* `Fitter`, not a *fitted* one, and you can sample straight from the initial\n",
|
|
222
|
-
"parameter values.\n",
|
|
223
|
+
"Perform a quick maximum-likelihood fit.\n",
|
|
223
224
|
"\n",
|
|
224
225
|
"It is worth doing anyway, for two reasons:\n",
|
|
225
226
|
"\n",
|
|
@@ -239,9 +240,6 @@
|
|
|
239
240
|
"outputs": [],
|
|
240
241
|
"source": [
|
|
241
242
|
"from easyscience import Fitter\n",
|
|
242
|
-
"from easyscience import ObjBase\n",
|
|
243
|
-
"\n",
|
|
244
|
-
"parameter_container = ObjBase(name='params', A=area, gamma=gamma, omega_0=omega_0, sigma=sigma)\n",
|
|
245
243
|
"\n",
|
|
246
244
|
"mle_fitter = Fitter(parameter_container, intensity_model)\n",
|
|
247
245
|
"mle_result = mle_fitter.fit(x=omega, y=intensity_obs, weights=1 / intensity_error)\n",
|
|
@@ -261,7 +259,7 @@
|
|
|
261
259
|
"\n",
|
|
262
260
|
"We now draw samples from the posterior distribution $p(\\theta \\mid d)$ using the BUMPS DREAM (DiffeRential Evolution Adaptive Metropolis) algorithm. DREAM is an ensemble MCMC method that runs multiple chains in parallel and automatically tunes the proposal distribution.\n",
|
|
263
261
|
"\n",
|
|
264
|
-
"
|
|
262
|
+
"Create a `Sampler` from the same `parameter_container` and `intensity_model` we gave the `Fitter`, bound to the data. Calling `sampler.sample()` returns a `SamplingResults` object with the following attributes:\n",
|
|
265
263
|
"\n",
|
|
266
264
|
"- `draws`: a `(n_samples, n_parameters)` array of posterior samples: each **row** is one complete draw from the joint posterior (one value for every parameter simultaneously), and each **column** holds all sampled values for a single parameter. Note this is a *trimmed* view of the chain rather than the raw buffer, so `n_samples` is smaller than `samples / thin` — see the note under [Extend the chain](#extend-the-chain-and-check-convergence);\n",
|
|
267
265
|
"- `param_names`: the unique names of the parameters, in the same column order as `draws`;\n",
|
|
@@ -274,7 +272,9 @@
|
|
|
274
272
|
"- `burn` (500): the number of initial *burn-in* generations to discard — the sampler needs time to find the typical set of the posterior, and early samples are not representative. Note this counts generations, not raw samples, so `burn=500` discards `500 × n_chains` raw samples;\n",
|
|
275
273
|
"- `thin` (2): the *thinning* interval — only every second generation is kept, which reduces autocorrelation between consecutive draws;\n",
|
|
276
274
|
"\n",
|
|
277
|
-
"
|
|
275
|
+
"```{note}\n",
|
|
276
|
+
"If you already have a `Fitter`, `Sampler.from_fitter(mle_fitter, omega, intensity_obs, weights=1 / intensity_error)` builds the same sampler from the model bound to it. The fitter is neither needed afterwards nor modified.\n",
|
|
277
|
+
"```"
|
|
278
278
|
]
|
|
279
279
|
},
|
|
280
280
|
{
|
|
@@ -283,22 +283,12 @@
|
|
|
283
283
|
"id": "14",
|
|
284
284
|
"metadata": {},
|
|
285
285
|
"outputs": [],
|
|
286
|
-
"source": [
|
|
287
|
-
"from easyscience import AvailableMinimizers\n",
|
|
288
|
-
"\n",
|
|
289
|
-
"mle_fitter.switch_minimizer(AvailableMinimizers.Bumps)"
|
|
290
|
-
]
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
"cell_type": "code",
|
|
294
|
-
"execution_count": null,
|
|
295
|
-
"id": "5a219fcd",
|
|
296
|
-
"metadata": {},
|
|
297
|
-
"outputs": [],
|
|
298
286
|
"source": [
|
|
299
287
|
"from easyscience.fitting import Sampler\n",
|
|
300
288
|
"\n",
|
|
301
|
-
"sampler = Sampler(
|
|
289
|
+
"sampler = Sampler(\n",
|
|
290
|
+
" parameter_container, intensity_model, omega, intensity_obs, weights=1 / intensity_error\n",
|
|
291
|
+
")\n",
|
|
302
292
|
"results = sampler.sample(samples=10000, burn=500, thin=2)\n",
|
|
303
293
|
"\n",
|
|
304
294
|
"print(f'Drew {results.draws.shape[0]} samples for {results.draws.shape[1]} parameters.')\n",
|
|
@@ -307,7 +297,7 @@
|
|
|
307
297
|
},
|
|
308
298
|
{
|
|
309
299
|
"cell_type": "markdown",
|
|
310
|
-
"id": "
|
|
300
|
+
"id": "15",
|
|
311
301
|
"metadata": {},
|
|
312
302
|
"source": [
|
|
313
303
|
"## Convergence diagnostics\n",
|
|
@@ -323,7 +313,7 @@
|
|
|
323
313
|
{
|
|
324
314
|
"cell_type": "code",
|
|
325
315
|
"execution_count": null,
|
|
326
|
-
"id": "
|
|
316
|
+
"id": "16",
|
|
327
317
|
"metadata": {},
|
|
328
318
|
"outputs": [],
|
|
329
319
|
"source": [
|
|
@@ -359,7 +349,7 @@
|
|
|
359
349
|
},
|
|
360
350
|
{
|
|
361
351
|
"cell_type": "markdown",
|
|
362
|
-
"id": "
|
|
352
|
+
"id": "17",
|
|
363
353
|
"metadata": {},
|
|
364
354
|
"source": [
|
|
365
355
|
"## Posterior summaries\n",
|
|
@@ -377,7 +367,7 @@
|
|
|
377
367
|
{
|
|
378
368
|
"cell_type": "code",
|
|
379
369
|
"execution_count": null,
|
|
380
|
-
"id": "
|
|
370
|
+
"id": "18",
|
|
381
371
|
"metadata": {},
|
|
382
372
|
"outputs": [],
|
|
383
373
|
"source": []
|
|
@@ -385,7 +375,7 @@
|
|
|
385
375
|
{
|
|
386
376
|
"cell_type": "code",
|
|
387
377
|
"execution_count": null,
|
|
388
|
-
"id": "
|
|
378
|
+
"id": "19",
|
|
389
379
|
"metadata": {},
|
|
390
380
|
"outputs": [],
|
|
391
381
|
"source": [
|
|
@@ -407,7 +397,7 @@
|
|
|
407
397
|
},
|
|
408
398
|
{
|
|
409
399
|
"cell_type": "markdown",
|
|
410
|
-
"id": "
|
|
400
|
+
"id": "20",
|
|
411
401
|
"metadata": {},
|
|
412
402
|
"source": [
|
|
413
403
|
"## Visualise the joint posterior\n",
|
|
@@ -418,7 +408,7 @@
|
|
|
418
408
|
{
|
|
419
409
|
"cell_type": "code",
|
|
420
410
|
"execution_count": null,
|
|
421
|
-
"id": "
|
|
411
|
+
"id": "21",
|
|
422
412
|
"metadata": {},
|
|
423
413
|
"outputs": [],
|
|
424
414
|
"source": [
|
|
@@ -452,7 +442,7 @@
|
|
|
452
442
|
},
|
|
453
443
|
{
|
|
454
444
|
"cell_type": "markdown",
|
|
455
|
-
"id": "
|
|
445
|
+
"id": "22",
|
|
456
446
|
"metadata": {},
|
|
457
447
|
"source": [
|
|
458
448
|
"## Posterior-predictive band\n",
|
|
@@ -463,7 +453,7 @@
|
|
|
463
453
|
{
|
|
464
454
|
"cell_type": "code",
|
|
465
455
|
"execution_count": null,
|
|
466
|
-
"id": "
|
|
456
|
+
"id": "23",
|
|
467
457
|
"metadata": {},
|
|
468
458
|
"outputs": [],
|
|
469
459
|
"source": [
|
|
@@ -499,7 +489,7 @@
|
|
|
499
489
|
},
|
|
500
490
|
{
|
|
501
491
|
"cell_type": "markdown",
|
|
502
|
-
"id": "
|
|
492
|
+
"id": "24",
|
|
503
493
|
"metadata": {},
|
|
504
494
|
"source": [
|
|
505
495
|
"## Extend the chain and check convergence\n",
|
|
@@ -543,7 +533,7 @@
|
|
|
543
533
|
{
|
|
544
534
|
"cell_type": "code",
|
|
545
535
|
"execution_count": null,
|
|
546
|
-
"id": "
|
|
536
|
+
"id": "25",
|
|
547
537
|
"metadata": {},
|
|
548
538
|
"outputs": [],
|
|
549
539
|
"source": [
|
|
@@ -573,7 +563,7 @@
|
|
|
573
563
|
{
|
|
574
564
|
"cell_type": "code",
|
|
575
565
|
"execution_count": null,
|
|
576
|
-
"id": "
|
|
566
|
+
"id": "26",
|
|
577
567
|
"metadata": {},
|
|
578
568
|
"outputs": [],
|
|
579
569
|
"source": [
|
|
@@ -614,7 +604,7 @@
|
|
|
614
604
|
{
|
|
615
605
|
"cell_type": "code",
|
|
616
606
|
"execution_count": null,
|
|
617
|
-
"id": "
|
|
607
|
+
"id": "27",
|
|
618
608
|
"metadata": {},
|
|
619
609
|
"outputs": [],
|
|
620
610
|
"source": [
|
|
@@ -641,7 +631,7 @@
|
|
|
641
631
|
},
|
|
642
632
|
{
|
|
643
633
|
"cell_type": "markdown",
|
|
644
|
-
"id": "
|
|
634
|
+
"id": "28",
|
|
645
635
|
"metadata": {},
|
|
646
636
|
"source": [
|
|
647
637
|
"### What is Gelman-Rubin R-hat?\n",
|
|
@@ -675,7 +665,7 @@
|
|
|
675
665
|
{
|
|
676
666
|
"cell_type": "code",
|
|
677
667
|
"execution_count": null,
|
|
678
|
-
"id": "
|
|
668
|
+
"id": "29",
|
|
679
669
|
"metadata": {},
|
|
680
670
|
"outputs": [],
|
|
681
671
|
"source": [
|
|
@@ -246,10 +246,10 @@
|
|
|
246
246
|
"source": [
|
|
247
247
|
"from easyscience import Parameter\n",
|
|
248
248
|
"\n",
|
|
249
|
-
"A = Parameter(
|
|
250
|
-
"gamma = Parameter(
|
|
251
|
-
"omega_0 = Parameter(
|
|
252
|
-
"sigma = Parameter(
|
|
249
|
+
"A = Parameter(display_name='A', value=10, fixed=False, min=0.01, max=100)\n",
|
|
250
|
+
"gamma = Parameter(display_name='gamma', value=8e-3, fixed=False, min=1e-4, max=10e-3)\n",
|
|
251
|
+
"omega_0 = Parameter(display_name='omega_0', value=0.001, fixed=False, min=0, max=0.002)\n",
|
|
252
|
+
"sigma = Parameter(display_name='sigma', value=0.001, fixed=False, min=1e-5, max=0.1)"
|
|
253
253
|
]
|
|
254
254
|
},
|
|
255
255
|
{
|
|
@@ -293,10 +293,10 @@
|
|
|
293
293
|
"metadata": {},
|
|
294
294
|
"outputs": [],
|
|
295
295
|
"source": [
|
|
296
|
+
"from easyscience import EasyList\n",
|
|
296
297
|
"from easyscience import Fitter\n",
|
|
297
|
-
"from easyscience import ObjBase\n",
|
|
298
298
|
"\n",
|
|
299
|
-
"params =
|
|
299
|
+
"params = EasyList(A, gamma, omega_0, sigma)\n",
|
|
300
300
|
"f = Fitter(params, intensity)\n",
|
|
301
301
|
"\n",
|
|
302
302
|
"res = f.fit(x=q, y=i, weights=1 / di)"
|
|
@@ -236,10 +236,10 @@
|
|
|
236
236
|
"source": [
|
|
237
237
|
"from easyscience import Parameter\n",
|
|
238
238
|
"\n",
|
|
239
|
-
"scale = Parameter(
|
|
240
|
-
"delta_rho = Parameter(
|
|
241
|
-
"r = Parameter(
|
|
242
|
-
"bkg = Parameter(
|
|
239
|
+
"scale = Parameter(display_name='scale', value=1.4e-7, fixed=True)\n",
|
|
240
|
+
"delta_rho = Parameter(display_name='delta_rho', value=3, fixed=False, min=0, max=10)\n",
|
|
241
|
+
"r = Parameter(display_name='r', value=80, fixed=False, min=0, max=1000)\n",
|
|
242
|
+
"bkg = Parameter(display_name='bkg', value=0.01, fixed=False, min=0.001, max=0.1)"
|
|
243
243
|
]
|
|
244
244
|
},
|
|
245
245
|
{
|
|
@@ -283,10 +283,10 @@
|
|
|
283
283
|
"metadata": {},
|
|
284
284
|
"outputs": [],
|
|
285
285
|
"source": [
|
|
286
|
+
"from easyscience import EasyList\n",
|
|
286
287
|
"from easyscience import Fitter\n",
|
|
287
|
-
"from easyscience import ObjBase\n",
|
|
288
288
|
"\n",
|
|
289
|
-
"params =
|
|
289
|
+
"params = EasyList(delta_rho, r, bkg)\n",
|
|
290
290
|
"f = Fitter(params, sphere)\n",
|
|
291
291
|
"\n",
|
|
292
292
|
"res = f.fit(x=q, y=i, weights=1 / di)"
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
"import matplotlib.pyplot as plt\n",
|
|
48
48
|
"import numpy as np\n",
|
|
49
49
|
"\n",
|
|
50
|
-
"from easyscience import
|
|
50
|
+
"from easyscience import EasyList\n",
|
|
51
51
|
"from easyscience import Fitter\n",
|
|
52
|
-
"from easyscience import
|
|
52
|
+
"from easyscience import Minimizers\n",
|
|
53
|
+
"from easyscience import ModelBase\n",
|
|
53
54
|
"from easyscience import Parameter"
|
|
54
55
|
]
|
|
55
56
|
},
|
|
@@ -82,32 +83,23 @@
|
|
|
82
83
|
},
|
|
83
84
|
"outputs": [],
|
|
84
85
|
"source": [
|
|
85
|
-
"class MultiPeak(
|
|
86
|
-
" a0: Parameter\n",
|
|
87
|
-
" a1: Parameter\n",
|
|
88
|
-
" a2: Parameter\n",
|
|
89
|
-
" A1: Parameter\n",
|
|
90
|
-
" mu1: Parameter\n",
|
|
91
|
-
" sigma1: Parameter\n",
|
|
92
|
-
" A2: Parameter\n",
|
|
93
|
-
" mu2: Parameter\n",
|
|
94
|
-
" sigma2: Parameter\n",
|
|
95
|
-
" A3: Parameter\n",
|
|
96
|
-
" mu3: Parameter\n",
|
|
97
|
-
" sigma3: Parameter\n",
|
|
98
|
-
"\n",
|
|
86
|
+
"class MultiPeak(ModelBase):\n",
|
|
99
87
|
" def __init__(self, **values):\n",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
88
|
+
" super().__init__(display_name='multipeak')\n",
|
|
89
|
+
" self._parameters = EasyList(\n",
|
|
90
|
+
" *(Parameter(value, display_name=name) for name, value in values.items())\n",
|
|
91
|
+
" )\n",
|
|
92
|
+
"\n",
|
|
93
|
+
" @property\n",
|
|
94
|
+
" def parameters(self) -> EasyList:\n",
|
|
95
|
+
" return self._parameters\n",
|
|
102
96
|
"\n",
|
|
103
97
|
" def __call__(self, x):\n",
|
|
104
|
-
"
|
|
98
|
+
" p = {par.display_name: par.value for par in self.parameters}\n",
|
|
99
|
+
" bg = p['a0'] + p['a1'] * x + p['a2'] * x**2\n",
|
|
105
100
|
" peaks = 0.0\n",
|
|
106
|
-
" for
|
|
107
|
-
"
|
|
108
|
-
" (self.A2.value, self.mu2.value, self.sigma2.value),\n",
|
|
109
|
-
" (self.A3.value, self.mu3.value, self.sigma3.value),\n",
|
|
110
|
-
" ):\n",
|
|
101
|
+
" for i in (1, 2, 3):\n",
|
|
102
|
+
" A, mu, sigma = p[f'A{i}'], p[f'mu{i}'], p[f'sigma{i}']\n",
|
|
111
103
|
" peaks = peaks + A * np.exp(-0.5 * ((x - mu) / sigma) ** 2)\n",
|
|
112
104
|
" return bg + peaks"
|
|
113
105
|
]
|
|
@@ -205,7 +197,7 @@
|
|
|
205
197
|
" mu3=3.0,\n",
|
|
206
198
|
" sigma3=1.2,\n",
|
|
207
199
|
" )\n",
|
|
208
|
-
" for p in model.
|
|
200
|
+
" for p in model.get_all_parameters():\n",
|
|
209
201
|
" p.fixed = False\n",
|
|
210
202
|
" return model"
|
|
211
203
|
]
|
|
@@ -272,7 +264,7 @@
|
|
|
272
264
|
},
|
|
273
265
|
"outputs": [],
|
|
274
266
|
"source": [
|
|
275
|
-
"def fit_with(backend:
|
|
267
|
+
"def fit_with(backend: Minimizers):\n",
|
|
276
268
|
" model = make_initial_model()\n",
|
|
277
269
|
" fitter = Fitter(model, model)\n",
|
|
278
270
|
" fitter.switch_minimizer(backend)\n",
|
|
@@ -285,7 +277,7 @@
|
|
|
285
277
|
"\n",
|
|
286
278
|
"results = {}\n",
|
|
287
279
|
"histories = {}\n",
|
|
288
|
-
"for backend in (
|
|
280
|
+
"for backend in (Minimizers.LMFit, Minimizers.Bumps, Minimizers.DFO):\n",
|
|
289
281
|
" res, hist = fit_with(backend)\n",
|
|
290
282
|
" results[backend.name] = res\n",
|
|
291
283
|
" histories[backend.name] = hist\n",
|
|
@@ -378,7 +370,7 @@
|
|
|
378
370
|
"else:\n",
|
|
379
371
|
" model = make_initial_model()\n",
|
|
380
372
|
" fitter = Fitter(model, model)\n",
|
|
381
|
-
" fitter.switch_minimizer(
|
|
373
|
+
" fitter.switch_minimizer(Minimizers.LMFit)\n",
|
|
382
374
|
" fitter.max_evaluations = 108\n",
|
|
383
375
|
"\n",
|
|
384
376
|
" pbar = tqdm(total=fitter.max_evaluations, desc='LMFit', unit='eval')\n",
|
|
@@ -35,14 +35,13 @@ individual subsystems:
|
|
|
35
35
|
```
|
|
36
36
|
easyscience # root — controls everything
|
|
37
37
|
├── easyscience.base_classes # EasyList runtime warnings
|
|
38
|
-
├── easyscience.legacy # ObjBase / CollectionBase deprecations
|
|
39
38
|
├── easyscience.deprecated # @deprecated decorator messages
|
|
40
39
|
├── easyscience.fitting # import-availability warnings
|
|
41
40
|
│ ├── easyscience.fitting.bumps # Bumps fitting runtime messages
|
|
42
41
|
│ ├── easyscience.fitting.lmfit # LMFit fitting runtime messages
|
|
43
42
|
│ └── easyscience.fitting.dfo # DFO fitting runtime messages
|
|
44
43
|
├── easyscience.variable # parameter warnings
|
|
45
|
-
└── easyscience.global_object #
|
|
44
|
+
└── easyscience.global_object # debugging diagnostics
|
|
46
45
|
```
|
|
47
46
|
|
|
48
47
|
Setting the level on a parent logger affects all its children, because
|
|
@@ -56,9 +55,6 @@ logging.getLogger('easyscience.fitting').setLevel(logging.ERROR)
|
|
|
56
55
|
|
|
57
56
|
# Suppress only Bumps runtime messages
|
|
58
57
|
logging.getLogger('easyscience.fitting.bumps').setLevel(logging.ERROR)
|
|
59
|
-
|
|
60
|
-
# Suppress only legacy deprecation notices
|
|
61
|
-
logging.getLogger('easyscience.legacy').setLevel(logging.ERROR)
|
|
62
58
|
```
|
|
63
59
|
|
|
64
60
|
## Environment Variable
|