Skip to content

delta storage for polychrom - #81

Open
mimakaev wants to merge 5 commits into
masterfrom
chain-delta-storage
Open

mimakaev wants to merge 5 commits into
masterfrom
chain-delta-storage

Conversation

@mimakaev

@mimakaev mimakaev commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Introduces new storage format to save 2x to 4x of space.
Bump of test versions.

PR Checklist

  • [] apply "black" to the whole codebase (black .)
  • [] apply isort to the codebase (isort .)
  • [] fun flake8 and try to resolve all the issues (work in progress!)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved defects break simulation reconstruction, violate requested trajectory rounding accuracy, and allow infinite precision to produce NaN coordinates.

3 open issues
What changed in this PR

Introduces delta-encoded storage for polymer conformations, targeting 2–4× smaller trajectory files while preserving transparent loading.

Changes:

  • Adds integer-grid position encoding with anchors and automatic HDF5 decoding.
  • Introduces save_precision, defaults to a 0.04 grid step, and retains legacy save_decimals handling.
  • Adds encoding tests, raises the h5py minimum, and updates the CI Python matrix.
File Description
tests/​test_pos_encoding.py Tests encoding accuracy, validation, warnings, and reporter round trips.
tests/​test_io.py Updates integration assertions for the new default precision.
requirements.txt Raises minimum h5py version to 2.10.
pyproject.toml Aligns the packaged h5py dependency minimum.
polychrom/​simulation.py Adds precision-based snapping and storage metadata.
polychrom/​hdf5_format.py Implements delta encoding, transparent decoding, and HDF5 v1.10 writes.
.github/​workflows/​pythonapp.yml Updates tested Python versions to 3.11–3.14.

Review effort: Balanced

Comment thread polychrom/hdf5_format.py
Comment on lines +154 to +155
if not precision > 0:
raise ValueError(f"pos_precision must be a positive number, got {precision}")
Comment thread polychrom/hdf5_format.py
Comment on lines +310 to +313
precision = dataDict.get("pos_precision", False)
if "pos" in dataDict and precision is not False and precision is not None:
dataDict = dict(dataDict) # do not modify the caller's dict
encoded = encode_positions(dataDict.pop("pos"), precision)
Comment thread polychrom/simulation.py Outdated
Comment on lines +269 to +270
if "save_precision" in kwargs:
raise ValueError("Pass either save_precision or save_decimals, not both")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants