easydiffraction 0.1.6__tar.gz → 0.2.0__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.
- easydiffraction-0.2.0/.github/release-drafter.yml +35 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/delete-old-runs.yml +2 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/ossar-analysis.yml +2 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/pypi-publish.yml +4 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/release-drafter.yml +4 -3
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/test-code.yaml +4 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/test-ipynb.yml +4 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/test-package.yaml +7 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/workflows/verify-pr-labels.yml +3 -2
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/DEVELOPMENT.md +5 -4
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/PKG-INFO +2 -1
- easydiffraction-0.2.0/docs/dev/diagrams/classes.md +95 -0
- easydiffraction-0.2.0/pyproject.toml +147 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/Analysis.py +21 -17
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/Container.py +10 -13
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/Experiment.py +144 -142
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/JobType.py +29 -27
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/P1D.py +257 -265
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/Sample.py +6 -4
- {easydiffraction-0.1.6/easydiffraction/components → easydiffraction-0.2.0/src/easydiffraction/Profiles}/__init__.py +1 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/Profiles/common.py +30 -39
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/__init__.py +3 -3
- easydiffraction-0.2.0/src/easydiffraction/calculators/__init__.py +22 -0
- easydiffraction-0.1.6/easydiffraction/calculators/cryspy.py → easydiffraction-0.2.0/src/easydiffraction/calculators/cryspy/calculator.py +191 -230
- easydiffraction-0.2.0/src/easydiffraction/calculators/cryspy/parser.py +651 -0
- easydiffraction-0.1.6/easydiffraction/Interfaces/cryspyV2.py → easydiffraction-0.2.0/src/easydiffraction/calculators/cryspy/wrapper.py +118 -131
- easydiffraction-0.1.6/easydiffraction/calculators/pdffit2.py → easydiffraction-0.2.0/src/easydiffraction/calculators/pdffit2/calculator.py +18 -18
- easydiffraction-0.1.6/easydiffraction/Interfaces/pdffit2.py → easydiffraction-0.2.0/src/easydiffraction/calculators/pdffit2/wrapper.py +43 -37
- easydiffraction-0.1.6/easydiffraction/calculators/CFML.py → easydiffraction-0.2.0/src/easydiffraction/calculators/pycrysfml/calculator.py +71 -96
- easydiffraction-0.1.6/easydiffraction/Interfaces/CFML.py → easydiffraction-0.2.0/src/easydiffraction/calculators/pycrysfml/wrapper.py +51 -51
- easydiffraction-0.1.6/easydiffraction/Interfaces/interfaceTemplate.py → easydiffraction-0.2.0/src/easydiffraction/calculators/wrapper_base.py +35 -21
- easydiffraction-0.1.6/easydiffraction/interface.py → easydiffraction-0.2.0/src/easydiffraction/calculators/wrapper_factory.py +4 -4
- easydiffraction-0.1.6/easydiffraction/Interfaces/types.py → easydiffraction-0.2.0/src/easydiffraction/calculators/wrapper_types.py +5 -8
- {easydiffraction-0.1.6/easydiffraction/Profiles → easydiffraction-0.2.0/src/easydiffraction/components}/__init__.py +1 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/components/phase.py +6 -17
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/components/polarization.py +16 -16
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/components/site.py +17 -22
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Backgrounds/Background.py +5 -3
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Backgrounds/Factorial.py +5 -8
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Backgrounds/Point.py +7 -8
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Backgrounds/__init__.py +1 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Experiments/Experiment.py +98 -71
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/elements/Experiments/Pattern.py +22 -18
- {easydiffraction-0.1.6/easydiffraction/calculators → easydiffraction-0.2.0/src/easydiffraction/elements/Experiments}/__init__.py +1 -1
- easydiffraction-0.2.0/src/easydiffraction/elements/__init__.py +3 -0
- easydiffraction-0.2.0/src/easydiffraction/io/__init__.py +3 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/io/cif.py +347 -464
- easydiffraction-0.2.0/src/easydiffraction/io/cif_reader.py +317 -0
- easydiffraction-0.1.6/easydiffraction/Job.py → easydiffraction-0.2.0/src/easydiffraction/job.py +216 -240
- easydiffraction-0.2.0/src/easydiffraction/main.py +14 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0/src}/easydiffraction/sample.py +44 -44
- easydiffraction-0.1.6/easydiffraction/io/download.py → easydiffraction-0.2.0/src/easydiffraction/utils.py +10 -8
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/fit_script.py +2 -2
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/test1.py +1 -1
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/test3.py +2 -2
- easydiffraction-0.2.0/tests/integration_tests/test_scipp/test_scipp.py +18 -0
- easydiffraction-0.2.0/tests/resources/scipp.cif +40 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/test_Job.py +3 -3
- easydiffraction-0.2.0/tools/Scripts/generate_html.py +31 -0
- easydiffraction-0.1.6/.github/release-drafter.yml +0 -32
- easydiffraction-0.1.6/easydiffraction/Interfaces/GSASII.py +0 -185
- easydiffraction-0.1.6/easydiffraction/Interfaces/__init__.py +0 -27
- easydiffraction-0.1.6/easydiffraction/Interfaces/cryspy.py +0 -422
- easydiffraction-0.1.6/easydiffraction/Jobs.py +0 -484
- easydiffraction-0.1.6/easydiffraction/Runner.py +0 -53
- easydiffraction-0.1.6/easydiffraction/calculators/GSASII.py +0 -172
- easydiffraction-0.1.6/easydiffraction/elements/Experiments/__init__.py +0 -3
- easydiffraction-0.1.6/easydiffraction/elements/__init__.py +0 -3
- easydiffraction-0.1.6/easydiffraction/io/__init__.py +0 -3
- easydiffraction-0.1.6/easydiffraction/io/cif_reader.py +0 -244
- easydiffraction-0.1.6/easydiffraction/io/cryspy_parser.py +0 -798
- easydiffraction-0.1.6/easydiffraction/io/helpers.py +0 -30
- easydiffraction-0.1.6/easydiffraction/main.py +0 -13
- easydiffraction-0.1.6/pyproject.toml +0 -110
- easydiffraction-0.1.6/tools/Scripts/generate_html.py +0 -29
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.github/dependabot.yml +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/.gitignore +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/CONTRIBUTING.md +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/LICENSE +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/README.md +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Change-minimizer.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Define-experiment.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Define-model.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Fitting-emcee_pd-neut-cwl_LBCO-HRPT.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Fitting_pd-neut-cwl_LBCO-HRPT.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Fitting_pd-neut-tof_NCAF-WISH.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Fitting_pd-neut-tof_Si-SEPD.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/Simulation_pd-xray_NaCl.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/d1a.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/hrpt.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/lbco.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/lbco_adp.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/ncaf.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/sepd.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/si.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples/data/wish.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/3T2@LLB.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/D1A@ILL.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-CW_La0.5Ba0.5CoO3-HRPT@PSI/fitting.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-CW_La0.5Ba0.5CoO3-HRPT@PSI/fitting.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-CW_La0.5Ba0.5CoO3-HRPT@PSI/hrpt.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-TOF_Si-SEPD@Argonne/fitting copy.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-TOF_Si-SEPD@Argonne/fitting.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-TOF_Si-SEPD@Argonne/fitting.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-TOF_Si-SEPD@Argonne/sepd.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_PD-TOF_Si-SEPD@Argonne/si.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_TOF.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_TOF_xye.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Fitting_multiphase.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/Calculate_PDF_Profile_Ni.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/Fitting_PDF_Profile_Ni.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/Fitting_PDF_Profile_Si.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/4507226.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Ni-xray.gr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Ni.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Si_calibration_cryostat_100A.fgr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Si_calibration_cryostat_20A.fgr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Si_calibration_cryostat_20A_01Rmin.fgr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Si_calibration_cryostat_50A.fgr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF/data/Si_calibration_cryostat_50A_01Rmin.fgr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Calculate_PDF_Profile.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Fitting_PDF_Profile.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Ni-xray.gr +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Ni.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Ni_fitting.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PDF2/Ni_profile.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PbSO4.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/PolNPD5T.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Polarized.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Simulation.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/Simulation_xray.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/CrysPy/rhochi_unpolarized_tof_powder_Si/calc_chisq.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/CrysPy/rhochi_unpolarized_tof_powder_Si/cryspy_PbSO4-D1A@ILL.rcif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/CrysPy/rhochi_unpolarized_tof_powder_Si/cryspy_unpolarized_tof_powder_Si.rcif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/CrysPy/rhochi_unpolarized_tof_powder_Si/refinement.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/CrysPy/rhochi_unpolarized_tof_powder_Si/rhochi_unpolarized_tof_powder_CeCuAl.rcif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDB/experiments/d1a.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDB/models/pbso4.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDB/models/pbso4_dark.png +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDB/project.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDB/summary/report.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDL/D1A@ILL.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDL/PbSO4.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/TestingAPI/EDL/TestingAPI.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/advanced/refinement_bumps_dream.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/advanced/refinement_emcee.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/d1a.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/diamond_exp.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/diamond_phase.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/experiment_polarized.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/multiphase.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/ncaf.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/structure_polarized.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/examples_old/wish.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/CFML_Cryspy.png +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/FittingData.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/FittingData_CFML-xarrays.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/FittingData_CFML.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/PbSO4.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/PbSO4_neutrons_short.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/PbSO4_xrays_short.xye +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/SrTiO3.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/WorkedExample2.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/workedExample1.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/integration_tests/xarray_test.ipynb +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/resources/PbSO4.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/resources/PolNPD5T.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/resources/d1a.cif +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Calculators/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Elements/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Interfaces/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Profiles/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Profiles/test_Experiment.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/Profiles/test_JobType.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/__init__.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/test_Jobs.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/test_Runner.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/test_interface.py +0 -0
- {easydiffraction-0.1.6 → easydiffraction-0.2.0}/tests/unit_tests/test_sample.py +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# This file is used to configure the Release Drafter GitHub Action
|
|
2
|
+
# https://github.com/marketplace/actions/release-drafter
|
|
3
|
+
|
|
4
|
+
name-template: 'EasyDiffraction $RESOLVED_VERSION'
|
|
5
|
+
tag-template: 'v$RESOLVED_VERSION'
|
|
6
|
+
categories:
|
|
7
|
+
- title: 'Added'
|
|
8
|
+
labels: # Labels to use to categorize a pull request as a feature
|
|
9
|
+
- 'enhancement'
|
|
10
|
+
- title: 'Fixed'
|
|
11
|
+
labels: # Labels to use to categorize a pull request as a bug fix
|
|
12
|
+
- 'bug'
|
|
13
|
+
- title: 'Changed'
|
|
14
|
+
labels: # Labels to use to categorize a pull request as a maintenance task
|
|
15
|
+
- 'chore'
|
|
16
|
+
- 'documentation'
|
|
17
|
+
- 'refactor'
|
|
18
|
+
change-template: '- $TITLE (#$NUMBER)'
|
|
19
|
+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
|
|
20
|
+
version-resolver:
|
|
21
|
+
major:
|
|
22
|
+
labels:
|
|
23
|
+
- 'major'
|
|
24
|
+
minor:
|
|
25
|
+
labels:
|
|
26
|
+
- 'enhancement'
|
|
27
|
+
patch:
|
|
28
|
+
labels:
|
|
29
|
+
- 'bug'
|
|
30
|
+
- 'chore'
|
|
31
|
+
- 'documentation'
|
|
32
|
+
- 'refactor'
|
|
33
|
+
default: patch
|
|
34
|
+
template: |
|
|
35
|
+
$CHANGES
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
# Builds a Python package and publish it to PyPI when a new tag is
|
|
1
|
+
# Builds a Python package and publish it to PyPI when a new tag is
|
|
2
|
+
# created.
|
|
2
3
|
|
|
3
4
|
name: Upload release to PyPI
|
|
4
5
|
|
|
@@ -19,6 +20,8 @@ jobs:
|
|
|
19
20
|
steps:
|
|
20
21
|
- name: Check-out repository
|
|
21
22
|
uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
22
25
|
|
|
23
26
|
- name: Set up Python
|
|
24
27
|
uses: actions/setup-python@v5
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
# Drafts your next Release notes as pull requests are merged into
|
|
1
|
+
# Drafts your next Release notes as pull requests are merged into
|
|
2
|
+
# default branch
|
|
2
3
|
|
|
3
4
|
name: Update release draft
|
|
4
5
|
|
|
@@ -14,7 +15,7 @@ jobs:
|
|
|
14
15
|
|
|
15
16
|
steps:
|
|
16
17
|
- uses: release-drafter/release-drafter@v6
|
|
17
|
-
id:
|
|
18
|
+
id: create-release
|
|
18
19
|
env:
|
|
19
20
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
20
21
|
|
|
@@ -31,7 +32,7 @@ jobs:
|
|
|
31
32
|
env:
|
|
32
33
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
33
34
|
with:
|
|
34
|
-
upload_url: ${{ steps.
|
|
35
|
+
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the create-release step above
|
|
35
36
|
asset_path: ./examples.zip
|
|
36
37
|
asset_name: examples.zip
|
|
37
38
|
asset_content_type: application/zip
|
|
@@ -44,6 +44,8 @@ jobs:
|
|
|
44
44
|
steps:
|
|
45
45
|
- name: Checkout repository
|
|
46
46
|
uses: actions/checkout@v4
|
|
47
|
+
with:
|
|
48
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
47
49
|
|
|
48
50
|
- name: Set up Python
|
|
49
51
|
uses: actions/setup-python@v5
|
|
@@ -83,6 +85,8 @@ jobs:
|
|
|
83
85
|
steps:
|
|
84
86
|
- name: Checkout repository
|
|
85
87
|
uses: actions/checkout@v4
|
|
88
|
+
with:
|
|
89
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
86
90
|
|
|
87
91
|
- name: Set up Python ${{ matrix.python-version }}
|
|
88
92
|
uses: actions/setup-python@v5
|
|
@@ -34,6 +34,8 @@ jobs:
|
|
|
34
34
|
steps:
|
|
35
35
|
- name: Checkout repository
|
|
36
36
|
uses: actions/checkout@v4
|
|
37
|
+
with:
|
|
38
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
37
39
|
|
|
38
40
|
- name: Set up Python
|
|
39
41
|
uses: actions/setup-python@v5
|
|
@@ -69,6 +71,8 @@ jobs:
|
|
|
69
71
|
steps:
|
|
70
72
|
- name: Check-out repository
|
|
71
73
|
uses: actions/checkout@v4
|
|
74
|
+
with:
|
|
75
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
72
76
|
|
|
73
77
|
- name: Set up Python environment
|
|
74
78
|
uses: actions/setup-python@v5
|
|
@@ -51,6 +51,8 @@ jobs:
|
|
|
51
51
|
steps:
|
|
52
52
|
- name: Checkout repository
|
|
53
53
|
uses: actions/checkout@v4
|
|
54
|
+
with:
|
|
55
|
+
fetch-depth: '0' # full history with tags to get the version number by versioningit
|
|
54
56
|
|
|
55
57
|
- name: Set up Python ${{ matrix.python-version }}
|
|
56
58
|
uses: actions/setup-python@v5
|
|
@@ -104,6 +106,10 @@ jobs:
|
|
|
104
106
|
name: EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os }}_${{ runner.arch }}
|
|
105
107
|
path: . # directory to extract downloaded zipped artifacts
|
|
106
108
|
|
|
109
|
+
# The local version must be higher than the PyPI version for pip to
|
|
110
|
+
# prefer the local version. So, after a new release and a new tag,
|
|
111
|
+
# remember to merge the master branch with the develop branch,
|
|
112
|
+
# and then create a new feature branch from the develop branch.
|
|
107
113
|
- name: Install Python package from previous job with 'dev' extras
|
|
108
114
|
run: pip install 'easydiffraction[dev]' --find-links=dist
|
|
109
115
|
|
|
@@ -117,7 +123,7 @@ jobs:
|
|
|
117
123
|
shell: bash
|
|
118
124
|
run: >
|
|
119
125
|
pytest
|
|
120
|
-
--nbmake examples
|
|
126
|
+
--nbmake examples/
|
|
121
127
|
--ignore-glob='examples/*emcee*'
|
|
122
128
|
--nbmake-timeout=300
|
|
123
129
|
--color=yes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
# Verifies if a pull request has at least one label from a set of valid
|
|
1
|
+
# Verifies if a pull request has at least one label from a set of valid
|
|
2
|
+
# labels before it can be merged.
|
|
2
3
|
|
|
3
4
|
name: Verify pull request labels
|
|
4
5
|
|
|
@@ -18,6 +19,6 @@ jobs:
|
|
|
18
19
|
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
|
|
19
20
|
with:
|
|
20
21
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
21
|
-
valid-labels:
|
|
22
|
+
valid-labels: 'enhancement, bug, chore, documentation, refactor'
|
|
22
23
|
pull-request-number: ${{ github.event.pull_request.number }}
|
|
23
24
|
disable-reviews: false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Development
|
|
2
2
|
|
|
3
|
-
This is an example of a workflow that describes the development process.
|
|
3
|
+
This is an example of a workflow that describes the development process.
|
|
4
4
|
|
|
5
5
|
* Clone EasyDiffractionLib repository
|
|
6
6
|
```console
|
|
@@ -27,18 +27,19 @@ This is an example of a workflow that describes the development process.
|
|
|
27
27
|
```console
|
|
28
28
|
python -m pip install --upgrade pip
|
|
29
29
|
```
|
|
30
|
-
* Install easydiffraction from root with `dev` extras for development
|
|
30
|
+
* Install easydiffraction from root with `dev` extras for development
|
|
31
31
|
```console
|
|
32
32
|
pip install '.[dev]'
|
|
33
33
|
```
|
|
34
34
|
* Make changes in the code
|
|
35
35
|
* Run Ruff - Python linter and code formatter (configuration is in pyproject.toml)
|
|
36
36
|
```console
|
|
37
|
-
ruff check
|
|
37
|
+
ruff check --fix # Linting (overwriting files)
|
|
38
|
+
ruff format # Formatting (overwriting files)
|
|
38
39
|
```
|
|
39
40
|
* Run python tests
|
|
40
41
|
```console
|
|
41
|
-
pytest tests/ --color=yes -n auto
|
|
42
|
+
pytest tests/ --color=yes -n auto
|
|
42
43
|
```
|
|
43
44
|
* Clear all Jupyter notebooks output
|
|
44
45
|
```console
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: easydiffraction
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Making diffraction data analysis and modelling easy
|
|
5
5
|
Project-URL: homepage, https://easydiffraction.org
|
|
6
6
|
Project-URL: documentation, https://docs.easydiffraction.org/lib
|
|
@@ -65,6 +65,7 @@ Requires-Dist: pytest; extra == 'dev'
|
|
|
65
65
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
66
66
|
Requires-Dist: pytest-xdist; extra == 'dev'
|
|
67
67
|
Requires-Dist: ruff; extra == 'dev'
|
|
68
|
+
Requires-Dist: versioningit; extra == 'dev'
|
|
68
69
|
Description-Content-Type: text/markdown
|
|
69
70
|
|
|
70
71
|
<img src="https://raw.githubusercontent.com/EasyScience/EasyDiffractionApp/master/resources/images/ed_logo.svg" height="65">
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
* src
|
|
2
|
+
* easydiffraction (as before)
|
|
3
|
+
* calculators (as before)
|
|
4
|
+
* cryspy
|
|
5
|
+
* calculator.py (instead of calculators/cryspy.py)
|
|
6
|
+
* class Cryspy (as before)
|
|
7
|
+
* wrapper.py (instead of Interfaces/cryspyV2.py)
|
|
8
|
+
* class CryspyWrapper (instead of CryspyV2)
|
|
9
|
+
* pdffit2
|
|
10
|
+
* calculator.py (instead of calculators/pdffit2.py)
|
|
11
|
+
* class Pdffit2 (as before)
|
|
12
|
+
* wrapper.py (instead of Interfaces/pdffit2.py)
|
|
13
|
+
* class Pdffit2Wrapper (instead of Pdffit2)
|
|
14
|
+
* pycrysfml
|
|
15
|
+
* calculator.py (instead of calculators/CFML.py)
|
|
16
|
+
* class Pycrysfml (instead of CFML)
|
|
17
|
+
* wrapper.py (instead of Interfaces/CFML.py)
|
|
18
|
+
* class PycrysfmlWrapper (instead of CFML)
|
|
19
|
+
* \_\_init\_\_.py
|
|
20
|
+
* calculator_base.py (no equivalent in old API? Do we need it?)
|
|
21
|
+
* class CalculatorBase (no equivalent in old API? Do we need it?)
|
|
22
|
+
* wrapper_factory.py ??? (instead of interface.py)
|
|
23
|
+
* class WrapperFactory ??? (instead of InterfaceFactory)
|
|
24
|
+
* wrapper_base.py (instead of Interfaces/interfaceTemplate.py)
|
|
25
|
+
* class WrapperBase (instead of InterfaceTemplate)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Old structure
|
|
31
|
+
|
|
32
|
+
* easydiffraction - As before
|
|
33
|
+
* calculators - As before
|
|
34
|
+
* \_\_init\_\_.py - As before
|
|
35
|
+
* CFML.py - Move to src/easydiffraction/calculators/pycrysfml/calculator.py
|
|
36
|
+
* class CFML - Rename to Pycrysfml
|
|
37
|
+
* cryspy.py - Move to src/easydiffraction/calculators/cryspy/calculator.py
|
|
38
|
+
* class Cryspy - As before
|
|
39
|
+
* GSASII.py - Remove
|
|
40
|
+
* pdffit2.py - Move to src/easydiffraction/calculators/pdffit2/calculator.py
|
|
41
|
+
* class Pdffit2 - As before
|
|
42
|
+
* components - Temporarily as before
|
|
43
|
+
* \_\_init\_\_.py
|
|
44
|
+
* phase.py
|
|
45
|
+
* polarization.py
|
|
46
|
+
* site.py
|
|
47
|
+
* elements - Temporarily as before
|
|
48
|
+
* Backgrounds
|
|
49
|
+
* \_\_init\_\_.py
|
|
50
|
+
* Background.py
|
|
51
|
+
* Factorial.py
|
|
52
|
+
* Point.py
|
|
53
|
+
* Experiments
|
|
54
|
+
* \_\_init\_\_.py
|
|
55
|
+
* Experiment.py
|
|
56
|
+
* Pattern.py
|
|
57
|
+
* \_\_init\_\_.py
|
|
58
|
+
* Interfaces
|
|
59
|
+
* \_\_init\_\_.py
|
|
60
|
+
* CFML.py - Move to src/easydiffraction/calculators/pycrysfml/wrapper.py
|
|
61
|
+
* class CFML - Rename to PycrysfmlWrapper
|
|
62
|
+
* cryspy.py - Remove
|
|
63
|
+
* cryspyV2.py - Move to src/easydiffraction/calculators/cryspy/wrapper.py
|
|
64
|
+
* class CryspyV2 - Rename to CryspyWrapper
|
|
65
|
+
* GSASII.py - Remove
|
|
66
|
+
* interfaceTemplate.py - Move to src/easydiffraction/calculators/wrapper_base.py
|
|
67
|
+
* class InterfaceTemplate - Rename to WrapperBase
|
|
68
|
+
* pdffit2.py - Move to src/easydiffraction/calculators/pdffit2/wrapper.py
|
|
69
|
+
* class Pdffit2 - Rename to Pdffit2Wrapper
|
|
70
|
+
* types.py
|
|
71
|
+
* io - Remove
|
|
72
|
+
* \_\_init\_\_.py - Remove
|
|
73
|
+
* cif.py - Remove
|
|
74
|
+
* cif_reader.py - From EDB. Move to EasyCrystallography
|
|
75
|
+
* cryspy_parser.py - Move to calculators/cryspy/...
|
|
76
|
+
* download.py - Remove
|
|
77
|
+
* def download_from_repository -> Move to easydiffraction/utils.py
|
|
78
|
+
* helpers.py - Remove
|
|
79
|
+
* Profiles - Temporarily as before
|
|
80
|
+
* \_\_init\_\_.py
|
|
81
|
+
* Analysis.py
|
|
82
|
+
* common.py
|
|
83
|
+
* Container.py
|
|
84
|
+
* Experiment.py
|
|
85
|
+
* JobType.py
|
|
86
|
+
* P1D.py
|
|
87
|
+
* Sample.py
|
|
88
|
+
* \_\_init\_\_.py - As before
|
|
89
|
+
* interfaces.py - Move to src/easydiffraction/calculators/wrapper_factory.py
|
|
90
|
+
* class InterfaceFactory - Rename to WrapperFactory
|
|
91
|
+
* Job.py - Rename to job.py
|
|
92
|
+
* Jobs.py - Remove
|
|
93
|
+
* main.py - As before
|
|
94
|
+
* Runner.py - Remove
|
|
95
|
+
* sample.py - Temporarily as before
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
# Configuration for the project
|
|
3
|
+
###############################
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = 'easydiffraction'
|
|
7
|
+
dynamic = ['version'] # Use versioningit to manage the version
|
|
8
|
+
description = 'Making diffraction data analysis and modelling easy'
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = 'EasyDiffraction contributors', email = 'support@easydiffraction.org' }
|
|
11
|
+
]
|
|
12
|
+
readme = 'README.md'
|
|
13
|
+
license = { file = 'LICENSE' }
|
|
14
|
+
classifiers = [
|
|
15
|
+
'Topic :: Scientific/Engineering',
|
|
16
|
+
'Development Status :: 4 - Beta',
|
|
17
|
+
'License :: OSI Approved :: BSD License',
|
|
18
|
+
'Operating System :: OS Independent',
|
|
19
|
+
'Programming Language :: Python :: 3 :: Only',
|
|
20
|
+
'Programming Language :: Python :: 3',
|
|
21
|
+
'Programming Language :: Python :: 3.9',
|
|
22
|
+
'Programming Language :: Python :: 3.10',
|
|
23
|
+
'Programming Language :: Python :: 3.11',
|
|
24
|
+
'Programming Language :: Python :: 3.12'
|
|
25
|
+
]
|
|
26
|
+
requires-python = '>=3.9,<3.13'
|
|
27
|
+
dependencies = [
|
|
28
|
+
'cryspy', # For calculations of diffraction patterns
|
|
29
|
+
'pooch', # For data fetching
|
|
30
|
+
'easyscience', # The base library of the EasyScience framework
|
|
31
|
+
'easycrystallography', # Crystallography tools of the EasyScience framework
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = [
|
|
36
|
+
'build', # For building the package
|
|
37
|
+
'pytest', # For testing
|
|
38
|
+
'pytest-xdist', # For parallel testing
|
|
39
|
+
'pytest-cov', # For coverage
|
|
40
|
+
'ruff', # For linting
|
|
41
|
+
'nbmake', # For building notebooks
|
|
42
|
+
'nbqa', # For linting notebooks
|
|
43
|
+
'jinja2', # For templating
|
|
44
|
+
'versioningit', # For versioning
|
|
45
|
+
]
|
|
46
|
+
charts = [
|
|
47
|
+
'darkdetect', # For dark mode detection
|
|
48
|
+
'plotly', # For interactive plots
|
|
49
|
+
'py3Dmol', # For visualisation of crystal structures
|
|
50
|
+
'pandas', # For displaying tables in juptyer notebooks
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
homepage = 'https://easydiffraction.org'
|
|
55
|
+
documentation = 'https://docs.easydiffraction.org/lib'
|
|
56
|
+
source = 'https://github.com/EasyScience/EasyDiffractionLib'
|
|
57
|
+
tracker = 'https://github.com/EasyScience/EasyDiffractionLib/issues'
|
|
58
|
+
|
|
59
|
+
############################
|
|
60
|
+
# Build system configuration
|
|
61
|
+
############################
|
|
62
|
+
|
|
63
|
+
# Build system 'hatch' -- Python project manager
|
|
64
|
+
# https://hatch.pypa.io/
|
|
65
|
+
|
|
66
|
+
# Versioning system 'versioningit' -- Versioning from git tags
|
|
67
|
+
# https://versioningit.readthedocs.io/
|
|
68
|
+
|
|
69
|
+
[build-system]
|
|
70
|
+
build-backend = 'hatchling.build'
|
|
71
|
+
requires = [
|
|
72
|
+
'hatchling',
|
|
73
|
+
'versioningit'
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
#############################
|
|
77
|
+
# Configuration for hatchling
|
|
78
|
+
#############################
|
|
79
|
+
|
|
80
|
+
[tool.hatch.build.targets.wheel]
|
|
81
|
+
packages = ['src/easydiffraction']
|
|
82
|
+
|
|
83
|
+
[tool.hatch.metadata]
|
|
84
|
+
allow-direct-references = true
|
|
85
|
+
|
|
86
|
+
[tool.hatch.version]
|
|
87
|
+
source = 'versioningit' # Use versioningit to manage the version
|
|
88
|
+
|
|
89
|
+
################################
|
|
90
|
+
# Configuration for versioningit
|
|
91
|
+
################################
|
|
92
|
+
|
|
93
|
+
# Versioningit generates versions from git tags, so we don't need to
|
|
94
|
+
# either specify them statically in pyproject.toml or save them in the
|
|
95
|
+
# source code.
|
|
96
|
+
|
|
97
|
+
[tool.versioningit.format]
|
|
98
|
+
distance = '{base_version}.post{distance}' # example: 1.2.3.post42
|
|
99
|
+
dirty = '{base_version}' # example: 1.2.3
|
|
100
|
+
distance-dirty = '{base_version}.post{distance}' # example: 1.2.3.post42
|
|
101
|
+
|
|
102
|
+
[tool.versioningit.vcs]
|
|
103
|
+
method = 'git'
|
|
104
|
+
match = ['v*']
|
|
105
|
+
default-tag = 'v999.0.0'
|
|
106
|
+
|
|
107
|
+
########################
|
|
108
|
+
# Configuration for ruff
|
|
109
|
+
########################
|
|
110
|
+
|
|
111
|
+
# 'ruff' -- Python linter and code formatter
|
|
112
|
+
# https://docs.astral.sh/ruff/rules/
|
|
113
|
+
|
|
114
|
+
[tool.ruff]
|
|
115
|
+
exclude = [
|
|
116
|
+
'examples',
|
|
117
|
+
'examples_old',
|
|
118
|
+
'tests'
|
|
119
|
+
]
|
|
120
|
+
indent-width = 4
|
|
121
|
+
line-length = 127
|
|
122
|
+
|
|
123
|
+
[tool.ruff.format]
|
|
124
|
+
docstring-code-format = true # Whether to format code snippets in docstrings
|
|
125
|
+
indent-style = 'space' # PEP 8 recommends using spaces over tabs
|
|
126
|
+
line-ending = 'lf' # Line endings will be converted to \n
|
|
127
|
+
quote-style = 'single' # But double quotes in docstrings (PEP 8, PEP 257)
|
|
128
|
+
|
|
129
|
+
[tool.ruff.lint]
|
|
130
|
+
select = [
|
|
131
|
+
'E9', 'F63', 'F7', 'F82', # flake8 settings from existing CI setup
|
|
132
|
+
'E', 'W', # pycodestyle
|
|
133
|
+
'F', # Pyflakes
|
|
134
|
+
'I', # isort
|
|
135
|
+
'S', # flake8-bandit
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[tool.ruff.lint.isort]
|
|
139
|
+
force-single-line = true
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint.per-file-ignores]
|
|
142
|
+
# allow asserts in test files
|
|
143
|
+
'*test_*.py' = ['S101']
|
|
144
|
+
|
|
145
|
+
#[tool.ruff.lint.pycodestyle]
|
|
146
|
+
#max-line-length = 79 # https://peps.python.org/pep-0008/#maximum-line-length
|
|
147
|
+
#max-doc-length = 72 # https://peps.python.org/pep-0008/#maximum-line-length
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2024 EasyDiffraction contributors
|
|
2
2
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
-
# © 2021-2024 Contributors to the EasyDiffraction project <https://github.com/
|
|
3
|
+
# © 2021-2024 Contributors to the EasyDiffraction project <https://github.com/EasyScience/EasyDiffraction>
|
|
4
4
|
|
|
5
5
|
from typing import Union
|
|
6
6
|
|
|
@@ -10,32 +10,33 @@ from easyscience.fitting.fitter import Fitter as CoreFitter
|
|
|
10
10
|
from easyscience.fitting.minimizers.factory import AvailableMinimizers
|
|
11
11
|
from easyscience.Objects.job.analysis import AnalysisBase as coreAnalysis
|
|
12
12
|
|
|
13
|
-
from easydiffraction.
|
|
13
|
+
from easydiffraction.calculators.wrapper_factory import WrapperFactory
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class Analysis(coreAnalysis):
|
|
17
17
|
"""
|
|
18
18
|
Diffraction-specific Experiment object.
|
|
19
19
|
"""
|
|
20
|
+
|
|
20
21
|
def __init__(self, name: str, interface=None, *args, **kwargs):
|
|
21
22
|
super(Analysis, self).__init__(name, *args, **kwargs)
|
|
22
23
|
self.name = name
|
|
23
24
|
if interface is None:
|
|
24
|
-
interface =
|
|
25
|
+
interface = WrapperFactory()
|
|
25
26
|
self.interface = interface
|
|
26
27
|
self._fitter = CoreFitter(self, self.interface.fit_func)
|
|
27
28
|
|
|
28
29
|
def calculate_theory(self, x: Union[xr.DataArray, np.ndarray], **kwargs) -> np.ndarray:
|
|
29
|
-
|
|
30
|
+
"""
|
|
30
31
|
Implementation of the abstract method from JobBase.
|
|
31
32
|
Just a wrapper around the profile calculation.
|
|
32
|
-
|
|
33
|
+
"""
|
|
33
34
|
return self.calculate_profile(x, **kwargs)
|
|
34
35
|
|
|
35
36
|
def calculate_profile(self, x: Union[xr.DataArray, np.ndarray] = None, coord=None, **kwargs) -> np.ndarray:
|
|
36
|
-
|
|
37
|
+
"""
|
|
37
38
|
Calculate the profile based on current phase.
|
|
38
|
-
|
|
39
|
+
"""
|
|
39
40
|
x_store, f = coord.EasyScience.fit_prep(
|
|
40
41
|
self.interface.fit_func,
|
|
41
42
|
bdims=xr.broadcast(coord.transpose()),
|
|
@@ -43,13 +44,16 @@ class Analysis(coreAnalysis):
|
|
|
43
44
|
y = xr.apply_ufunc(f, *x_store, kwargs=kwargs)
|
|
44
45
|
return y
|
|
45
46
|
|
|
46
|
-
def fit(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
def fit(
|
|
48
|
+
self,
|
|
49
|
+
x: Union[xr.DataArray, np.ndarray],
|
|
50
|
+
y: Union[xr.DataArray, np.ndarray],
|
|
51
|
+
e: Union[xr.DataArray, np.ndarray],
|
|
52
|
+
**kwargs,
|
|
53
|
+
):
|
|
54
|
+
"""
|
|
51
55
|
Fit the profile based on current phase and experiment.
|
|
52
|
-
|
|
56
|
+
"""
|
|
53
57
|
# cursory checks
|
|
54
58
|
if x is None or y is None or e is None:
|
|
55
59
|
return None
|
|
@@ -73,7 +77,7 @@ class Analysis(coreAnalysis):
|
|
|
73
77
|
res = self._fitter.fit(x, y, **kwargs)
|
|
74
78
|
|
|
75
79
|
except Exception as ex:
|
|
76
|
-
print(f
|
|
80
|
+
print(f'Error in fitting: {ex}')
|
|
77
81
|
return None
|
|
78
82
|
return res
|
|
79
83
|
|
|
@@ -101,7 +105,7 @@ class Analysis(coreAnalysis):
|
|
|
101
105
|
"""
|
|
102
106
|
# Convert the string to an enum
|
|
103
107
|
if minimizer not in AvailableMinimizers.__members__:
|
|
104
|
-
raise ValueError(f
|
|
108
|
+
raise ValueError(f'Minimizer {minimizer} not available')
|
|
105
109
|
minimizer = AvailableMinimizers[minimizer]
|
|
106
110
|
self._fitter.switch_minimizer(minimizer)
|
|
107
111
|
|
|
@@ -111,8 +115,8 @@ class Analysis(coreAnalysis):
|
|
|
111
115
|
Load the analysis from a CIF file
|
|
112
116
|
"""
|
|
113
117
|
# TODO: Implement this
|
|
114
|
-
return Analysis(
|
|
118
|
+
return Analysis('Analysis')
|
|
115
119
|
|
|
116
120
|
# required dunder methods
|
|
117
121
|
def __str__(self):
|
|
118
|
-
return f
|
|
122
|
+
return f'Analysis: {self.name}'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2024 EasyDiffraction contributors
|
|
2
2
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
-
# © 2021-2024 Contributors to the EasyDiffraction project <https://github.com/
|
|
3
|
+
# © 2021-2024 Contributors to the EasyDiffraction project <https://github.com/EasyScience/EasyDiffraction>
|
|
4
4
|
|
|
5
5
|
from easyscience.Objects.core import ComponentSerializer
|
|
6
6
|
|
|
@@ -9,7 +9,6 @@ from easydiffraction.Profiles.Sample import Sample
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class DataContainer(ComponentSerializer):
|
|
12
|
-
|
|
13
12
|
def __init__(self, sim_store: Sample, exp_store: Experiment):
|
|
14
13
|
self._simulations = sim_store
|
|
15
14
|
self._experiments = exp_store
|
|
@@ -29,21 +28,20 @@ class DataContainer(ComponentSerializer):
|
|
|
29
28
|
"""
|
|
30
29
|
:return: Json-able dictionary representation.
|
|
31
30
|
"""
|
|
32
|
-
d = {
|
|
33
|
-
|
|
34
|
-
d["simulations"] = self._dataset.as_dict()
|
|
31
|
+
d = {'@module': self.__class__.__module__, '@class': self.__class__.__name__}
|
|
32
|
+
d['simulations'] = self._dataset.as_dict()
|
|
35
33
|
return d
|
|
36
34
|
|
|
37
35
|
class Experiment(experiment_class):
|
|
38
36
|
def __init__(self, sim_prefix):
|
|
39
37
|
super(Experiment, self).__init__(sim_prefix, dataset)
|
|
38
|
+
|
|
40
39
|
def as_dict(self, skip=None):
|
|
41
40
|
"""
|
|
42
41
|
:return: Json-able dictionary representation.
|
|
43
42
|
"""
|
|
44
|
-
d = {
|
|
45
|
-
|
|
46
|
-
d["simulations"] = self._dataset.as_dict()
|
|
43
|
+
d = {'@module': self.__class__.__module__, '@class': self.__class__.__name__}
|
|
44
|
+
d['simulations'] = self._dataset.as_dict()
|
|
47
45
|
return d
|
|
48
46
|
|
|
49
47
|
s = Simulation(dataset=dataset)
|
|
@@ -63,10 +61,9 @@ class DataContainer(ComponentSerializer):
|
|
|
63
61
|
"""
|
|
64
62
|
:return: Json-able dictionary representation.
|
|
65
63
|
"""
|
|
66
|
-
d = {
|
|
67
|
-
|
|
68
|
-
d[
|
|
69
|
-
d["experiments"] = self._experiments.as_dict()
|
|
64
|
+
d = {'@module': self.__class__.__module__, '@class': self.__class__.__name__}
|
|
65
|
+
d['simulations'] = self._simulations.as_dict()
|
|
66
|
+
d['experiments'] = self._experiments.as_dict()
|
|
70
67
|
return d
|
|
71
68
|
|
|
72
69
|
@classmethod
|
|
@@ -75,4 +72,4 @@ class DataContainer(ComponentSerializer):
|
|
|
75
72
|
:param d: Dict representation.
|
|
76
73
|
:return: Species.
|
|
77
74
|
"""
|
|
78
|
-
return cls(d[
|
|
75
|
+
return cls(d['simulations'], d['experiments'])
|