Skip to content

Commit 0d9f10e

Browse files
Merge pull request #217 from easyscience/develop
πŸŽ‰ Release: merge develop into master
2 parents ba3677a + 7054af7 commit 0d9f10e

97 files changed

Lines changed: 370 additions & 323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Ž.github/workflows/pypi-test.ymlβ€Ž

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,43 @@ jobs:
4040
- name: Init pixi project
4141
run: pixi init easydiffraction
4242

43-
- name: Set the minimum system requirements
43+
- name: Configure Pixi platforms
4444
working-directory: easydiffraction
45+
shell: bash
4546
run: |
46-
pixi project system-requirements add macos 14.0
47-
pixi project system-requirements add glibc 2.35
48-
49-
- name: Add Python 3.14 from Conda
47+
set -euo pipefail
48+
49+
case "$RUNNER_OS" in
50+
Linux)
51+
pixi_platforms='[{ name = "linux-64-glibc-2-35", platform = "linux-64", glibc = "2.35" }]'
52+
;;
53+
macOS)
54+
pixi_platforms='[{ name = "osx-arm64-macos-14-0", platform = "osx-arm64", macos = "14.0" }]'
55+
;;
56+
Windows)
57+
pixi_platforms='["win-64"]'
58+
;;
59+
*)
60+
echo "Unsupported runner OS: $RUNNER_OS"
61+
exit 1
62+
;;
63+
esac
64+
65+
PIXI_PLATFORMS="$pixi_platforms" python -c 'import os, pathlib; path = pathlib.Path("pixi.toml"); text = path.read_text(); path.write_text(text.replace(text.split("platforms = ", 1)[1].split("\n", 1)[0], os.environ["PIXI_PLATFORMS"], 1))'
66+
pixi workspace platform list
67+
68+
- name: Add Python 3.14
5069
working-directory: easydiffraction
5170
run: pixi add "python=3.14"
5271

72+
# GNU Scientific Library (required by diffpy.pdffit2)
73+
# libc++ for macOS (required by diffpy.pdffit2)
5374
- name: Add other Conda dependencies
5475
working-directory: easydiffraction
5576
run: |
5677
pixi add gsl
5778
pixi add --platform osx-arm64 libcxx
5879
59-
#- name: Add pycrysfml calculator from custom PyPI index
60-
# working-directory: easydiffraction
61-
# run: |
62-
# echo '' >> pixi.toml
63-
# echo '[pypi-dependencies]' >> pixi.toml
64-
# echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml
65-
6680
- name: Add easydiffraction (with dev dependencies) from PyPI
6781
working-directory: easydiffraction
6882
run: pixi add --pypi "easydiffraction[dev]"

β€Ž.github/workflows/test.ymlβ€Ž

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,32 @@ jobs:
231231
pixi init easydiffraction_py$py_ver
232232
cd easydiffraction_py$py_ver
233233
234-
echo "Setting the minimum system requirements"
235-
pixi project system-requirements add macos 14.0
236-
pixi project system-requirements add glibc 2.35
237-
238-
echo "Adding Python $py_ver"
234+
echo "Configure Pixi platforms"
235+
case "$RUNNER_OS" in
236+
Linux)
237+
pixi_platforms='[{ name = "linux-64-glibc-2-35", platform = "linux-64", glibc = "2.35" }]'
238+
;;
239+
macOS)
240+
pixi_platforms='[{ name = "osx-arm64-macos-14-0", platform = "osx-arm64", macos = "14.0" }]'
241+
;;
242+
Windows)
243+
pixi_platforms='["win-64"]'
244+
;;
245+
*)
246+
echo "Unsupported runner OS: $RUNNER_OS"
247+
exit 1
248+
;;
249+
esac
250+
251+
PIXI_PLATFORMS="$pixi_platforms" python -c 'import os, pathlib; path = pathlib.Path("pixi.toml"); text = path.read_text(); path.write_text(text.replace(text.split("platforms = ", 1)[1].split("\n", 1)[0], os.environ["PIXI_PLATFORMS"], 1))'
252+
pixi workspace platform list
253+
254+
echo "Add Python $py_ver"
239255
pixi add "python=$py_ver"
240256
241-
echo "Adding GNU Scientific Library (required by diffpy.pdffit2)"
257+
# Add other Conda dependencies
258+
259+
echo "Add GNU Scientific Library (required by diffpy.pdffit2)"
242260
pixi add gsl
243261
244262
# diffpy.pdffit2 wheel links @rpath/libc++.1.dylib, which must be
@@ -248,14 +266,6 @@ jobs:
248266
echo "Adding libc++ for macOS (required by diffpy.pdffit2)"
249267
pixi add --platform osx-arm64 libcxx
250268
251-
# Doing this in a hacky way, as pixi does not support adding
252-
# dependencies from a custom PyPI index with a CLI command without
253-
# specifying full wheel name.
254-
#echo "Adding pycrysfml from custom PyPI index"
255-
#echo '' >> pixi.toml
256-
#echo '[pypi-dependencies]' >> pixi.toml
257-
#echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml
258-
259269
echo "Looking for wheel in ../dist/py$py_ver/"
260270
ls -l "../dist/py$py_ver/"
261271
@@ -267,7 +277,7 @@ jobs:
267277
268278
whl_abs_path="$(python -c 'import os,sys; print(os.path.abspath(sys.argv[1]))' "${whl_path[0]}")"
269279
270-
echo "Adding easydiffraction from: $whl_abs_path"
280+
echo "Add easydiffraction from: $whl_abs_path"
271281
pixi add --pypi "easydiffraction[dev] @ ${whl_abs_path}"
272282
273283
echo "Exiting pixi project directory"

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Please make sure you follow the EasyScience organization-wide
4242
If you are not planning to contribute code, you may want to:
4343

4444
- 🐞 Report a bug β€” see [Reporting Issues](#11-reporting-issues)
45-
- πŸ›‘ Report a security issue β€” see
46-
[Security Issues](#12-security-issues)
45+
- πŸ›‘ Report a security issue β€” see [Security Issues](#12-security-issues)
4746
- πŸ’¬ Ask a question or start a discussion at
4847
[Project Discussions](https://github.com/easyscience/diffraction-lib/discussions)
4948

β€Ždocs/dev/adrs/accepted/background-auto-estimate.mdβ€Ž

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ one-line summary (Β§1). Empirical calibration was carried out in Phase 2:
368368

369369
- The Stage-2 tolerance multiplier (`c Β· Οƒ`, `c = 2`) and the width
370370
percentile (~75th) are first-cut constants; they were validated β€” not
371-
exhaustively swept β€” against the representative CWL (`ed-2`) and TOF
372-
(`ed-13`) datasets plus the analytic unit cases, and produce sensible
371+
exhaustively swept β€” against the representative CWL
372+
(`refine-lbco-hrpt-from-data`) and TOF (`fitting-exercise-si-lbco`)
373+
datasets plus the analytic unit cases, and produce sensible
373374
backgrounds there. Re-tuning stays possible if a future dataset needs
374375
it.
375376
- The single Stage-1 method (`arpls`) holds for both validated beam
@@ -485,15 +486,16 @@ line-segment points are a real-world reference: stripping them and
485486
re-running `auto_estimate()` should reproduce a comparable background
486487
curve. **Phase 2 outcome:** the functional regression validates two
487488
representative datasets β€” CWL
488-
[`ed-2.py`](../../../../docs/docs/tutorials/ed-2.py) and TOF
489-
[`ed-13.py`](../../../../docs/docs/tutorials/ed-13.py) β€” comparing the
490-
estimated curve against the hand-placed reference to within a fraction
491-
of the measured signal scale; the single `arpls` default and the
492-
first-cut constants hold for both. Sloping and curved backgrounds are
493-
covered against exact analytic ground truth by the unit tests, not the
494-
corpus. A broader per-tutorial sweep (e.g. `ed-17`, `ed-16`) was not
495-
needed and stays available if a future dataset misbehaves. These checks
496-
run at the functional / unit level.
489+
[`refine-lbco-hrpt-from-data.py`](../../../../docs/docs/tutorials/refine-lbco-hrpt-from-data.py)
490+
and TOF
491+
[`fitting-exercise-si-lbco.py`](../../../../docs/docs/tutorials/fitting-exercise-si-lbco.py)
492+
β€” comparing the estimated curve against the hand-placed reference to
493+
within a fraction of the measured signal scale; the single `arpls`
494+
default and the first-cut constants hold for both. Sloping and curved
495+
backgrounds are covered against exact analytic ground truth by the unit
496+
tests, not the corpus. A broader per-tutorial sweep (e.g. `ed-17`,
497+
`ed-16`) was not needed and stays available if a future dataset
498+
misbehaves. These checks run at the functional / unit level.
497499

498500
The estimator module mirrors into
499501
`tests/unit/easydiffraction/datablocks/experiment/categories/background/`

β€Ždocs/dev/adrs/accepted/iucr-cif-tag-alignment.mdβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ In `analysis/analysis.cif`:
276276
- Bayesian diagnostics, success/message/iterations/fitting*time,
277277
`result_kind`, `point_estimate_name`, fit-parameter posterior
278278
summaries, and the `_alias` / `_constraint` / `_joint_fit` /
279-
`\_sequential_fit*`registries β€” **stay under their current category names**. File-scoping to`analysis/analysis.cif`carries the disambiguation; no`\_easydiffraction\*\*`
280-
prefix is added in the default save.
279+
`\_sequential_fit*`registries β€” **stay under their current category
280+
names**. File-scoping to`analysis/analysis.cif`carries the
281+
disambiguation; no`\_easydiffraction\*\*` prefix is added in the
282+
default save.
281283
- The `_minimizer.*`, `_fitting_mode.*`, `_calculator.*` selectors stay
282284
under their current names for the same reason.
283285

β€Ždocs/dev/adrs/accepted/project-summary-rendering.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ Summary, Software, Refinement, Structures (one subsection per phase),
11301130
Experiments (one subsection per experiment). Tables use `booktabs`
11311131
(`\toprule`/`\midrule`/`\bottomrule`) and `float`'s `[H]` placement;
11321132
math uses inline LaTeX (`$Fd\bar{3}m$`, `\AA`, `$\deg$`). Reference
1133-
example at [`tmp/latex/example.tex`](../../../../tmp/latex/example.tex).
1133+
example at `tmp/latex/example.tex`.
11341134

11351135
The `iucrjournals.cls` choice has two practical advantages over a bare
11361136
`article`:

β€Ždocs/dev/adrs/accepted/switchable-category-owned-selectors.mdβ€Ž

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ single-purpose blocks aligned with the new `_<cat>.type` rule.
164164

165165
`_minimizer.optimizer_name` and `_minimizer.method_name` are also
166166
**dropped**. Inspecting
167-
[`src/easydiffraction/analysis/minimizers/lmfit_leastsq.py`](../../../src/easydiffraction/analysis/minimizers/lmfit_leastsq.py)
167+
[`src/easydiffraction/analysis/minimizers/lmfit_leastsq.py`](../../../../src/easydiffraction/analysis/minimizers/lmfit_leastsq.py)
168168
(and the matching `bumps_lm.py`, `dfols.py`, …) shows that `name`
169169
defaults to the enum tag itself and `method` to a per-engine
170170
module-level constant. The public API never overrides them at
@@ -370,7 +370,7 @@ class PeakBase(CategoryItem, SwitchableCategoryBase):
370370
Categories that want to show aliases alongside canonical tags (peak)
371371
override `show_supported()` to add a third column; the per-category
372372
override pattern is the same as the existing
373-
[`base.show_peak_profile_types()`](../../../src/easydiffraction/datablocks/experiment/item/base.py)
373+
[`base.show_peak_profile_types()`](../../../../src/easydiffraction/datablocks/experiment/item/base.py)
374374
implementation, just moved onto the category.
375375

376376
`type` is backed by a **real `StringDescriptor`** named `_type` that
@@ -382,12 +382,12 @@ the staleness checks.
382382

383383
For `CategoryItem` substrates (minimizer, peak, extinction, calculator,
384384
chart, table, fitting_mode) the generic CIF emit/read path
385-
[`io/cif/serialize.py:170`](../../../src/easydiffraction/io/cif/serialize.py)
385+
[`io/cif/serialize.py:170`](../../../../src/easydiffraction/io/cif/serialize.py)
386386
picks the descriptor up by name automatically β€” no custom hook is
387387
needed. For the `CategoryCollection` substrate (background only),
388-
[`category.py:230`](../../../src/easydiffraction/core/category.py)'s
388+
[`category.py:230`](../../../../src/easydiffraction/core/category.py)'s
389389
`parameters` returns only loop-item parameters and
390-
[`io/cif/serialize.py:244`](../../../src/easydiffraction/io/cif/serialize.py)
390+
[`io/cif/serialize.py:244`](../../../../src/easydiffraction/io/cif/serialize.py)
391391
writes only the loop, so a collection-level `_type` descriptor needs a
392392
small additional path: the writer emits the scalar tag above the loop,
393393
and the reader peeks the scalar before iterating items. This is a
@@ -451,8 +451,8 @@ class ExperimentBase:
451451
```
452452

453453
The existing owner-level `show_<cat>_types()` methods
454-
([`bragg_pd.show_background_types()`](../../../src/easydiffraction/datablocks/experiment/item/bragg_pd.py),
455-
[`base.show_peak_profile_types()`](../../../src/easydiffraction/datablocks/experiment/item/base.py),
454+
([`bragg_pd.show_background_types()`](../../../../src/easydiffraction/datablocks/experiment/item/bragg_pd.py),
455+
[`base.show_peak_profile_types()`](../../../../src/easydiffraction/datablocks/experiment/item/base.py),
456456
`Calculation.show_calculator_types()`,
457457
`Analysis.show_supported_minimizer_types()`, …) are **deleted**. The
458458
mixin's `show_supported()` reproduces the same `['*', tag, description]`
@@ -722,7 +722,7 @@ Notes on the in-scope rows:
722722
renamed `calculator_type` β†’ `type`, and the CIF block changes from
723723
`_calculation.*` to `_calculator.*`. The setter delegation pattern is
724724
already in place today
725-
([`calculation/default.py:61`](../../../src/easydiffraction/datablocks/experiment/categories/calculation/default.py)),
725+
([`calculator/default.py:61`](../../../../src/easydiffraction/datablocks/experiment/categories/calculator/default.py)),
726726
so no mechanism change is required.
727727
- Rows 6 and 7 involve Β§8a's `Rendering` β†’ `Chart` + `Table` split
728728
(Python category restructure, CIF block split).
@@ -958,7 +958,7 @@ Three things change in this block:
958958
- `_peak.profile_type` becomes `_peak.type`; the existing
959959
`_peak.broad_gauss_*` and `_peak.broad_lorentz_*` parameter tags are
960960
unchanged (the names come from
961-
[`src/easydiffraction/datablocks/experiment/categories/peak/cwl_mixins.py`](../../../src/easydiffraction/datablocks/experiment/categories/peak/cwl_mixins.py)).
961+
[`src/easydiffraction/datablocks/experiment/categories/peak/cwl_mixins.py`](../../../../src/easydiffraction/datablocks/experiment/categories/peak/cwl_mixins.py)).
962962
The CIF value is the **canonical tag** (`cwl-pseudo-voigt` here, since
963963
the example experiment is constant-wavelength); the writable Python
964964
setter `experiment.peak.type` accepts the alias `'pseudo-voigt'` too

β€Ždocs/dev/adrs/suggestions/cif-numeric-precision.mdβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Core model.
88

99
> This ADR follows [`AGENTS.md`](../../../../AGENTS.md). It is the
1010
> data-side counterpart to
11-
> [`plotting-docs-performance.md`](plotting-docs-performance.md), which
12-
> handles **display** precision (downcasting plot arrays to float32).
13-
> This ADR concerns the precision of numbers we **store and serialize**
14-
> in CIF, which is a separate decision because CIF is a data
11+
> [`plotting-docs-performance.md`](../accepted/plotting-docs-performance.md),
12+
> which handles **display** precision (downcasting plot arrays to
13+
> float32). This ADR concerns the precision of numbers we **store and
14+
> serialize** in CIF, which is a separate decision because CIF is a data
1515
> source-of-truth, not a throwaway view.
1616
1717
## Context

β€Ždocs/dev/issues/closed/add-help-methods-to-public-discovery-facades.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ that do not inherit the guarded object hierarchy: `project.display`,
77
Introduced `render_object_help()` so these helpers share the same
88
property and method table style as `GuardedBase.help()`. Documented the
99
convention in
10-
[`help-discoverability.md`](../adrs/accepted/help-discoverability.md).
10+
[`help-discoverability.md`](../../adrs/accepted/help-discoverability.md).

β€Ždocs/dev/issues/closed/consistent-type-suffix-in-switchable-category-api-names.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 76. Consistent `_type` Suffix in Switchable-Category API Names
22

33
Closed by
4-
[`switchable-category-owned-selectors.md`](../adrs/accepted/switchable-category-owned-selectors.md).
4+
[`switchable-category-owned-selectors.md`](../../adrs/accepted/switchable-category-owned-selectors.md).
55
The public suffix is dropped: owners expose categories, categories
66
expose a uniform `type` property plus `show_supported()`, and CIF uses
77
one `_<cat>.type` selector tag per category.

0 commit comments

Comments
Β (0)