Skip to content

Record the origin of experimental data and import large integers exactly - #78

Merged
PierreRaybaut merged 10 commits into
developfrom
feature/experimental-data-integration
Oct 23, 2026
Merged

PierreRaybaut merged 10 commits into
developfrom
feature/experimental-data-integration

Conversation

@PierreRaybaut

@PierreRaybaut PierreRaybaut commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #77.

First of three companion PRs for experimental data integration; merge it first:

  1. This PR (Sigima 1.4.0)
  2. Browse and import large HDF5 and NeXus experimental files SigimaX#13 — HDF5/NeXus browsing and import (requires Sigima ≥ 1.4.0)
  3. Integrate experimental data: NeXus files, robust HDF5 import and threaded plugin instruments DataLab#422 — NeXus files, robust HDF5 import, threaded instruments (requires both)

Changes

  • Experimental origin (sigima/objects/source.py): versioned, JSON-only experimental_source metadata entry with make_experimental_source, set_experimental_source and get_experimental_source. Values are restricted to what HDF5 files restore exactly, and NumPy scalars restored by .h5sig/.h5ima files and DataLab workspaces are normalized back to Python types.
  • Exact integer import (sigima/io/common/converters.py): out-of-range integers are converted to the smallest floating-point type representing every value exactly; a UserWarning is emitted beyond 2⁵³.
  • Remote client: add_group returns the UUID of the created group (str | None, None with DataLab < 1.4).
  • Version bumped to 1.4.0; release notes, user guide section and French translations.

Validation

  • converters_unit_test.py, experimental_source_unit_test.py and client tests: 51 passed.
  • Ruff check/format clean, Pylint 10/10 on changed files.

Assisted-by: Claude Opus 5.5
Add executable examples for source metadata persistence and remote groups, explain integer precision limits and provide French translations.

Assisted-by: GPT-6.1 Sol
…rips

HDF5 files restored `None` as an empty string and numbers as NumPy scalars,
so a source read back from .h5sig/.h5ima files or DataLab workspaces was no
longer JSON-serializable and was rejected by set_experimental_source.

- Values are restricted to what HDF5 files restore exactly: None, invalid
  keys (non-string, empty, with "/" or reserved by guidata) and integers
  beyond 64 bits are rejected; NumPy scalars and tuples are converted.
- Signals and images restore the Python types of the entry once
  deserialized; get_experimental_source also normalizes them.

Assisted-by: Claude Opus 5.5
The CI quality gate (`python -m pylint sigima`) failed on the experimental
source module: too many return statements in `_normalize`, and exact type
checks flagged as unidiomatic.

- Move scalar normalization to `_normalize_scalar`.
- Check the version with `isinstance`, still rejecting `True` (a `bool` is
  an `int`), and test it.
- Keep the exact `str` key check in tests (it rejects `numpy.str_`), with a
  local justification.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
DataLab servers before 1.4 do not return the UUID of the created group.

Assisted-by: Claude Opus 5.5
@PierreRaybaut PierreRaybaut added the enhancement New feature or request label Oct 23, 2026
@PierreRaybaut
PierreRaybaut merged commit 8b194f4 into develop Oct 23, 2026
3 checks passed
@PierreRaybaut
PierreRaybaut deleted the feature/experimental-data-integration branch October 23, 2026 14:34
@ThomasMalletCodra ThomasMalletCodra added this to the v1.4.0 milestone Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants