vector-mtrl 0.5.2__tar.gz → 0.5.4__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.
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/CHANGELOG.md +118 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/NOTICE +5 -2
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/PKG-INFO +1 -1
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_archive_serialise.py +49 -8
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/validation.py +11 -1
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/excel.py +56 -12
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/exports.py +112 -8
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/frames.py +2 -2
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_group_keys.py +2 -3
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_preprocessing.py +9 -29
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_splits.py +3 -4
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/processing/registry.py +1 -1
- vector_mtrl-0.5.4/mtrl/unit_conversion.py +535 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/units.py +20 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/pyproject.toml +19 -4
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/.gitignore +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/LICENSE +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/README.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/01-samples-runs-checkpoints.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/02-the-commit-boundary.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/03-two-kinds-of-identity.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/04-corrections-vs-replacements.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/05-lineage-and-the-recorded-recipe.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/06-revisions-the-archive-timeline.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/07-inside-a-mtrl-archive.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/08-trust-over-time.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/index.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/concepts/units-of-measure.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/align-mixed-resolution-members.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/anchor-verification-with-receipts.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/attach-author-disclosure.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/author-an-ingestion-loader.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/check-external-evidence.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/control-the-operation-registry.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/handle-missing-extras.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/handle-selection-and-data-errors.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/index.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/inspect-a-damaged-archive.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/prepare-an-ml-dataset.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/record-scientific-assertions.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/replace-a-checkpoint.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/replay-a-committed-chain.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/resample-with-scipy.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/how-to/use-scientific-python-libraries.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/reference.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/01-your-first-record.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/02-save-load-verify.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/03-transform-and-plot.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/04-handles-and-the-core.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/05-fix-a-mistake.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/06-replicates-and-the-mean.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/07-get-your-data-out.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/08-record-a-claim.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/docs/user/start-here/09-one-complete-analysis.md +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_alignment_report.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_archive_documents.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_archive_integrity.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_archive_loading.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_archive_summary.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_assertions_io.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_assertions_ops.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_assertions_validation.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_candidate_matching.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_cli.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_disclosure.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_install_targets.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_optional.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_provenance.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_receipts.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_record_resolution.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_replay_plan.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_replay_run.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_run_management.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_source_capture.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_summaries.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_summary_text.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_table_plan.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_table_provenance.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_table_values.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_transform_apply.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_transform_validation.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_unit_summary.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/_uuid7.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/canonical.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/codecs.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/dtypes.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/archive/reader.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/assertions/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/assertions/_resolver.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/connectors/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/connectors/protocols.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/disclosure.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/archive_limits.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/assertions.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/committed_values.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/frozen_containers.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/identities.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/provenance.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/records.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/revisions.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/source.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/domain/verification.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/exceptions.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/features.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/grids.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/canonical.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/digests.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/manifest.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/receipts.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/integrity/verification.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_adapters.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_canonical.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_dataset.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_flat.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_metadata_view.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_provenance.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_source_walk.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_specs.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/ml/_summaries.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/models.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/mtrl.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/_identity.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/_validation.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/arithmetic.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/base.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/resampling.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/resampling_scipy.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/operations/spectra.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/processing/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/processing/_table_capture.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/processing/limits.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/protocols.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/py.typed +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/replay.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/sample.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/tables.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/transformations/__init__.py +0 -0
- {vector_mtrl-0.5.2 → vector_mtrl-0.5.4}/mtrl/transformations/base.py +0 -0
|
@@ -10,6 +10,124 @@ break, and every breaking change is named in the release entry.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
This patch release covers `vector-mtrl-v0.5.3..vector-mtrl-v0.5.4`. It adds the reviewed
|
|
14
|
+
display-unit conversion allowlist used by the Viewer, stores highly compressible archive entries
|
|
15
|
+
instead of rejecting a valid save, rejects CSV headers that collide after formula neutralisation,
|
|
16
|
+
tightens tabular numeric and connector staging validation, and aligns the Excel units sheet with
|
|
17
|
+
the stored data columns. It changes no archive format or stored value, and names no breaking change.
|
|
18
|
+
The Viewer does not ship in the wheel or the source archive.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- The distribution version and the source-tree operation version fallback advance to `0.5.4`.
|
|
23
|
+
- The Viewer runtime pin advances to the `0.5.4` wheel built from wheel-producing commit
|
|
24
|
+
`3fd10552c6d688444eddc89e33b2abe1111a6d61`, with 453,611 bytes and SHA-256
|
|
25
|
+
`a6082cbf576baec367d20e7806ff1374de5592310faf008f965586fc9b81dd7f`. The wheel contains
|
|
26
|
+
`mtrl/unit_conversion.py`; merge, tag, and publication remain separate gates.
|
|
27
|
+
- The Excel units sheet follows the stored content fields in data-column order. A field with no
|
|
28
|
+
declared unit keeps a null row, and a legacy unit key that matches no stored field follows the
|
|
29
|
+
content rows without shifting one.
|
|
30
|
+
- The viewer CSV mapping wizard now uses compact per-column rows and a searchable Carbon
|
|
31
|
+
`ComboBox` for declared units, with reviewed suggestions and verbatim custom text. Whitespace-only
|
|
32
|
+
input means no declared unit, and the commit keeps every other string exactly as typed.
|
|
33
|
+
- Dialect changes refresh the bounded preview after a 300 ms pause. A newer request discards a late
|
|
34
|
+
reply, the last good preview stays visible, and Import waits until the preview matches the
|
|
35
|
+
settings.
|
|
36
|
+
- The checkpoint table shows mapped columns in file order with role and unit headers, CSV record
|
|
37
|
+
numbers, labelled missing and invalid cells, original missing tokens as titles, and a counts line
|
|
38
|
+
for retained, excluded, missing, invalid, outside-window, and lossy facts. Mapped columns outside
|
|
39
|
+
the 24-column window and ignored columns are disclosed separately.
|
|
40
|
+
- A changed preview keeps roles, kinds, and units only across exact, unrenamed header names and
|
|
41
|
+
reports the kept columns by name. A failed mapping commit returns to the wizard with the original
|
|
42
|
+
bytes, preview, mapping, and ignore confirmation.
|
|
43
|
+
- The mapping wizard recognises Number, Boolean, Exact integer, Numeric identifier, and Category
|
|
44
|
+
or text columns. It imports Number, Boolean, Exact integer, and Numeric identifier columns and
|
|
45
|
+
blocks Category or text storage. Boolean accepts only case-insensitive `true` and `false`; blank
|
|
46
|
+
and configured missing tokens are missing, and `0`/`1` are not inferred. Missing Boolean and
|
|
47
|
+
integer values use a stored `<name>_present` mask, and those generated fields count toward the
|
|
48
|
+
128 stored-field limit. Exact integers keep signed or unsigned 64-bit values without a float
|
|
49
|
+
round-trip, reject leading zeros and inexact tokens, and are excluded from automatic and manual
|
|
50
|
+
plot axes when JavaScript cannot represent them faithfully or they have no finite values.
|
|
51
|
+
- Numeric identifiers must be unique and present on every row; duplicate and missing records are
|
|
52
|
+
named. Per-column duplicate facts remain complete after the bounded preview examples fill, so an
|
|
53
|
+
ignored identifier cannot hide a mapped duplicate. Boolean, identifier, and exact-integer Data
|
|
54
|
+
columns are auxiliary data, never plot axes. Boolean, identifier, and Category columns reject a
|
|
55
|
+
declared unit.
|
|
56
|
+
- Category and text-identifier storage fails closed. The wizard blocks commit and offers one-action
|
|
57
|
+
map-to-ignore; Ignore retains the original source text and names the column in a warning.
|
|
58
|
+
- The text-column problem names the offending column and record, including a text cell after the
|
|
59
|
+
preview window, uses the concise Number-column wording, and offers one-action map-to-ignore
|
|
60
|
+
controls. Lossy-number warnings cover only Number columns with inspected preview cells and do
|
|
61
|
+
not suggest that typed kinds preserve leading zeros.
|
|
62
|
+
- Raw CSV download remains the #139 stored-field export, including generated presence masks and
|
|
63
|
+
raw `False` for a missing Boolean; re-importing it is not type-exact. NPZ is the exact round-trip.
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- `mtrl.unit_conversion` exposes the reviewed display-unit conversion allowlist for absolute and
|
|
68
|
+
interval temperature, temperature rate, time, power, energy, wavenumber, and dimensionless
|
|
69
|
+
ratios. It returns no target for an unknown, ambiguous, or semantically incompatible unit.
|
|
70
|
+
- `mtrl.units.unit_identity` provides the stable unit identity shared by comparison and conversion
|
|
71
|
+
resolution.
|
|
72
|
+
- The tabular preview reports bounded `cellStates`, `recordNumbers`, `longCells`, `longColumns`,
|
|
73
|
+
`invalidColumns`, complete `identifierDuplicateColumns` facts, `lossyNumbers`, `headerRenamed`,
|
|
74
|
+
and reviewed `unitSuggestions`. Each `invalidColumns` entry carries its first record and
|
|
75
|
+
kind-specific reason.
|
|
76
|
+
- `reviewed_units` exposes the reviewed unit allowlist for viewer suggestions without changing
|
|
77
|
+
resolution or catalogue order.
|
|
78
|
+
|
|
79
|
+
### Fixed
|
|
80
|
+
|
|
81
|
+
- Saving now stores any archive entry whose deflate ratio would exceed the effective compression
|
|
82
|
+
bound. A valid import with highly repetitive values therefore remains readable under the normal
|
|
83
|
+
bounded reader, while the reader still enforces its compression-ratio limit.
|
|
84
|
+
- The viewer import contract lists `invalidColumns` in the preview payload and describes it for
|
|
85
|
+
every inspected mapped column with an invalid value, including columns outside the preview
|
|
86
|
+
window, not only outside-window cells.
|
|
87
|
+
- The CSV mapping wizard labels a column that is not entirely numeric with the default Number kind
|
|
88
|
+
as `Not all numeric` and `Number (default)` without changing its kind, detection, or commit plan;
|
|
89
|
+
the selected kind keeps its full wording visible at 1024 pixels. Ignored-column warnings use the
|
|
90
|
+
tense-neutral `N columns not imported: …`, and imported runs label their run warning disclosure
|
|
91
|
+
`Import warnings (N)` while converted runs keep `Conversion warnings (N)`.
|
|
92
|
+
- Long file and record names use a one-line and two-line visual clamp with the full text in the
|
|
93
|
+
title, so they no longer consume the header. The record plot height follows the viewport from 220
|
|
94
|
+
to 320 pixels. An expanded warning tightens the gap above the plot when needed, keeping the chart
|
|
95
|
+
at or above 220 pixels and the bottom x-axis title inside the panel at 720 pixels high; resizes
|
|
96
|
+
update the existing chart host.
|
|
97
|
+
|
|
98
|
+
## [0.5.3] - 2026-11-14
|
|
99
|
+
|
|
100
|
+
This patch release covers `vector-mtrl-v0.5.2..vector-mtrl-v0.5.3`. It changes no public
|
|
101
|
+
Python API, no archive format, and no parser behaviour. The viewer does not ship in the wheel
|
|
102
|
+
or the source archive. Its runtime pin advances to the `0.5.3` wheel built from this release
|
|
103
|
+
preparation; merging that preparation deploys Viewer `0.5.3` before the core is published.
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
|
|
107
|
+
- The distribution version and the source-tree operation version fallback advance to `0.5.3`.
|
|
108
|
+
- The Viewer runtime pin advances to the `0.5.3` wheel built from release-preparation commit
|
|
109
|
+
`01ba7e3ef4cd8cbb37a07f3d780ce229bc7df223`; the full Viewer gate, merge, tag, and publication
|
|
110
|
+
remain separate gates.
|
|
111
|
+
- The `NOTICE` states the core MPL-2.0 scope, the proprietary viewer scope, and third-party
|
|
112
|
+
terms. The viewer's first-party licence text does not ship in either core archive.
|
|
113
|
+
- The consumer-pinned `public-core` artefact keeps the private-repository maximum retention of
|
|
114
|
+
90 days; the review manifest keeps 7 days. This is a release-control change and does not
|
|
115
|
+
alter the installed package.
|
|
116
|
+
- The post-publish final resolution check retries only the resolver's no-version outcome within
|
|
117
|
+
a 120-second bound. It never retries an upload.
|
|
118
|
+
- The authorised-suite guide names the 0.5.3 core wheel and records the unchanged connector
|
|
119
|
+
range `vector-mtrl>=0.5.1,<0.6`.
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
|
|
123
|
+
- Archive structural validation offers the retired `.spa` payload-path hint only for a bytes
|
|
124
|
+
checkpoint whose file type is `spa` and whose entry uses the retired path. Other `.bin`
|
|
125
|
+
mismatches no longer receive that hint.
|
|
126
|
+
|
|
127
|
+
## [0.5.2] - 2026-11-10
|
|
128
|
+
|
|
129
|
+
This patch release covers `vector-mtrl-v0.5.1..vector-mtrl-v0.5.2`, through
|
|
130
|
+
`326bcb8e61dc3063548a1a2d1a140b09cdca7951`.
|
|
13
131
|
This patch release carries a licensing change only. It changes no public Python API, no archive
|
|
14
132
|
format, and no parser behaviour. The viewer does not ship in the wheel or the source archive.
|
|
15
133
|
|
|
@@ -17,5 +17,8 @@ Third-party components
|
|
|
17
17
|
Third-party components keep their own licences. This notice does not replace them. The viewer
|
|
18
18
|
ships the third-party texts under `viewer/public/licenses/` and `viewer/third-party/`.
|
|
19
19
|
|
|
20
|
-
The deployed viewer also serves
|
|
21
|
-
|
|
20
|
+
The deployed viewer also serves the MPL-2.0 `vector-mtrl` wheel and the pinned MPL-2.0 Pyodide
|
|
21
|
+
runtime. It serves the `vector-mtrl-trios` wheel under the Vector Labs Limited Proprietary
|
|
22
|
+
Software Licence. That licence permits platform use, including delivery to platform users, but
|
|
23
|
+
grants no standalone-use right. The other served Python wheels keep their own licences. The
|
|
24
|
+
relevant licence texts ship with the viewer.
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import os
|
|
6
6
|
import tempfile
|
|
7
7
|
import zipfile
|
|
8
|
+
import zlib
|
|
8
9
|
from collections import Counter
|
|
9
10
|
from collections.abc import Iterable, Mapping, Sequence
|
|
10
11
|
from copy import deepcopy
|
|
@@ -562,6 +563,45 @@ def _integrity_schema_for_save(container: Mtrl) -> str:
|
|
|
562
563
|
raise InvalidArchiveStructureError("The in-memory integrity schema is not supported.")
|
|
563
564
|
|
|
564
565
|
|
|
566
|
+
def _deflated_size(entry_bytes: bytes) -> int:
|
|
567
|
+
"""Return the raw-deflate size that ``zipfile`` writes for one entry.
|
|
568
|
+
|
|
569
|
+
``zipfile`` wraps its deflate output in a raw stream, while ``zlib.compress``
|
|
570
|
+
includes the zlib header and checksum. Estimating with the wrapper can therefore
|
|
571
|
+
understate the archived ratio by a few bytes. This function uses the same raw
|
|
572
|
+
stream as the writer so a boundary entry is stored rather than rejected after
|
|
573
|
+
the write.
|
|
574
|
+
"""
|
|
575
|
+
compressor = zlib.compressobj(wbits=-15)
|
|
576
|
+
return len(compressor.compress(entry_bytes)) + len(compressor.flush())
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
def _write_archive_entry(
|
|
580
|
+
archive: zipfile.ZipFile,
|
|
581
|
+
entry_name: str,
|
|
582
|
+
entry_bytes: bytes,
|
|
583
|
+
limits: ArchiveLimits,
|
|
584
|
+
) -> None:
|
|
585
|
+
"""Write one archive entry within the normal reader compression limit.
|
|
586
|
+
|
|
587
|
+
Deflate can make a short, repetitive source or generated payload smaller than the
|
|
588
|
+
reader's compression-ratio guarantee. Store only that entry instead of weakening the
|
|
589
|
+
reader or rejecting valid data.
|
|
590
|
+
"""
|
|
591
|
+
if limits.max_compression_ratio == float("inf"):
|
|
592
|
+
archive.writestr(entry_name, entry_bytes)
|
|
593
|
+
return
|
|
594
|
+
if (
|
|
595
|
+
_compression_ratio(len(entry_bytes), _deflated_size(entry_bytes))
|
|
596
|
+
<= limits.max_compression_ratio
|
|
597
|
+
):
|
|
598
|
+
archive.writestr(entry_name, entry_bytes)
|
|
599
|
+
return
|
|
600
|
+
info = zipfile.ZipInfo(entry_name)
|
|
601
|
+
info.compress_type = zipfile.ZIP_STORED
|
|
602
|
+
archive.writestr(info, entry_bytes)
|
|
603
|
+
|
|
604
|
+
|
|
565
605
|
def _write_archive_entries(
|
|
566
606
|
container: Mtrl,
|
|
567
607
|
path: Path,
|
|
@@ -591,9 +631,10 @@ def _write_archive_entries(
|
|
|
591
631
|
Attached content — retained sources, the environment record, and source
|
|
592
632
|
bundles — entered the container through explicit capture or attach calls
|
|
593
633
|
that each accepted their own caller limits. The save-time reader check
|
|
594
|
-
lifts only those attachment byte bounds and the compression ratio.
|
|
595
|
-
|
|
596
|
-
``max_compression_ratio
|
|
634
|
+
lifts only those attachment byte bounds and the compression ratio. The
|
|
635
|
+
writer stores any entry whose deflate ratio would exceed the effective
|
|
636
|
+
``max_compression_ratio``, so the archive still passes the normal bounded
|
|
637
|
+
reader without rejecting compressible data.
|
|
597
638
|
|
|
598
639
|
A successful save applies the new archive state first. When the caller
|
|
599
640
|
supplied ``limits``, the save then adopts every raised bound onto the
|
|
@@ -631,7 +672,7 @@ def _write_archive_entries(
|
|
|
631
672
|
compression=zipfile.ZIP_DEFLATED,
|
|
632
673
|
) as archive:
|
|
633
674
|
for entry_name, entry_bytes in entries:
|
|
634
|
-
archive
|
|
675
|
+
_write_archive_entry(archive, entry_name, entry_bytes, effective_limits)
|
|
635
676
|
with BoundedZipReader(
|
|
636
677
|
tmp_path,
|
|
637
678
|
_save_time_limits(effective_limits),
|
|
@@ -673,10 +714,10 @@ def _save_time_limits(limits: ArchiveLimits) -> ArchiveLimits:
|
|
|
673
714
|
|
|
674
715
|
Each attachment entered the container under the caller limits that its
|
|
675
716
|
explicit capture or attach call accepted. The reader check therefore
|
|
676
|
-
lifts the attachment byte bounds and the compression ratio.
|
|
677
|
-
|
|
678
|
-
``
|
|
679
|
-
|
|
717
|
+
lifts the attachment byte bounds and the compression ratio. The writer
|
|
718
|
+
stores any entry whose deflate ratio would exceed the effective bound, so
|
|
719
|
+
``_check_generated_entry_ratios`` remains a defensive check after the
|
|
720
|
+
write rather than a reason to reject compressible data.
|
|
680
721
|
|
|
681
722
|
Args:
|
|
682
723
|
limits: The effective archive limits of the save.
|
|
@@ -1062,6 +1062,16 @@ def _expected_source_path(source: Any) -> str:
|
|
|
1062
1062
|
return str(PurePosixPath(_SOURCE_PREFIX) / f"{source.source_id}{suffix}")
|
|
1063
1063
|
|
|
1064
1064
|
|
|
1065
|
+
def _uses_retired_spa_payload_path(checkpoint: CheckpointManifestEntry, entry_path: str) -> bool:
|
|
1066
|
+
"""Return whether a bytes payload uses the retired ``spa`` file-type path."""
|
|
1067
|
+
retired_path = PurePosixPath(_NEW_PAYLOAD_PREFIX) / f"{checkpoint.record_id}.spa"
|
|
1068
|
+
return (
|
|
1069
|
+
checkpoint.encoding == CheckpointEncoding.BYTES
|
|
1070
|
+
and checkpoint.file_type == "spa"
|
|
1071
|
+
and entry_path == str(retired_path)
|
|
1072
|
+
)
|
|
1073
|
+
|
|
1074
|
+
|
|
1065
1075
|
def _validate_payload_descriptor(
|
|
1066
1076
|
reader: BoundedZipReader,
|
|
1067
1077
|
checkpoint: CheckpointManifestEntry,
|
|
@@ -1079,7 +1089,7 @@ def _validate_payload_descriptor(
|
|
|
1079
1089
|
if entry_path != expected_path:
|
|
1080
1090
|
hint = (
|
|
1081
1091
|
" Archives written before the .bin payload convention fail here."
|
|
1082
|
-
if
|
|
1092
|
+
if _uses_retired_spa_payload_path(checkpoint, entry_path)
|
|
1083
1093
|
else ""
|
|
1084
1094
|
)
|
|
1085
1095
|
raise InvalidArchiveStructureError(
|
|
@@ -12,14 +12,23 @@ from enum import StrEnum
|
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from typing import TYPE_CHECKING, Any, cast
|
|
14
14
|
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
15
17
|
from mtrl._optional import require_optional_module
|
|
16
|
-
from mtrl.exports import
|
|
18
|
+
from mtrl.exports import (
|
|
19
|
+
EXCEL_SUFFIX,
|
|
20
|
+
UNNAMED_VALUE_COLUMN,
|
|
21
|
+
ExportRequest,
|
|
22
|
+
_prepared_path,
|
|
23
|
+
_staged_path,
|
|
24
|
+
)
|
|
17
25
|
from mtrl.frames import (
|
|
18
26
|
_labelled_checkpoint_frame,
|
|
19
27
|
lineage_to_frame,
|
|
20
28
|
manifest_to_frame,
|
|
21
29
|
metadata_to_frame,
|
|
22
30
|
)
|
|
31
|
+
from mtrl.models import field_names_of
|
|
23
32
|
|
|
24
33
|
if TYPE_CHECKING:
|
|
25
34
|
import pandas as pd
|
|
@@ -29,6 +38,9 @@ if TYPE_CHECKING:
|
|
|
29
38
|
UNIT_COLUMNS = ("checkpoint_id", "field", "raw", "qudt_unit", "qudt_quantity_kind")
|
|
30
39
|
"""The columns of the frame that `units_to_frame` returns."""
|
|
31
40
|
|
|
41
|
+
_MATRIX_NDIM = 2
|
|
42
|
+
"""The number of dimensions in a tabular content array."""
|
|
43
|
+
|
|
32
44
|
ILLEGAL_EXCEL_CHARACTERS = re.compile(r"[\000-\010\013\014\016-\037]")
|
|
33
45
|
"""The control characters that Excel rejects. The XML format behind .xlsx forbids them."""
|
|
34
46
|
|
|
@@ -99,19 +111,51 @@ def _manifest_for_run(manifest: models.Manifest, run_id: str) -> models.Manifest
|
|
|
99
111
|
)
|
|
100
112
|
|
|
101
113
|
|
|
114
|
+
def _content_column_labels(checkpoint: models.MaterialData) -> tuple[str | int, ...]:
|
|
115
|
+
"""Return the content fields in the order the data sheet exports them.
|
|
116
|
+
|
|
117
|
+
A plain one-dimensional array exports one ``value`` column and a plain
|
|
118
|
+
two-dimensional array exports pandas' numbered columns. Returning those labels
|
|
119
|
+
keeps the units sheet aligned instead of omitting the unnamed columns.
|
|
120
|
+
"""
|
|
121
|
+
named = field_names_of(checkpoint.content)
|
|
122
|
+
if named:
|
|
123
|
+
return named
|
|
124
|
+
content = checkpoint.content
|
|
125
|
+
if not isinstance(content, np.ndarray):
|
|
126
|
+
return ()
|
|
127
|
+
if content.ndim == 1:
|
|
128
|
+
# A fieldless structured dtype still exports one pandas column, numbered 0.
|
|
129
|
+
return (UNNAMED_VALUE_COLUMN if content.dtype.names is None else 0,)
|
|
130
|
+
if content.ndim == _MATRIX_NDIM:
|
|
131
|
+
return tuple(range(content.shape[1]))
|
|
132
|
+
return ()
|
|
133
|
+
|
|
134
|
+
|
|
102
135
|
def _units_to_frame(checkpoint: models.MaterialData) -> pd.DataFrame:
|
|
103
|
-
"""Collect the units for one checkpoint into a spreadsheet frame.
|
|
136
|
+
"""Collect the units for one checkpoint into a spreadsheet frame.
|
|
137
|
+
|
|
138
|
+
The rows follow the stored content fields, so the unit row at a given position
|
|
139
|
+
describes the data column at the same position. A field with no declared unit
|
|
140
|
+
keeps its row with null unit terms. A legacy unit key that matches no stored
|
|
141
|
+
field follows the content fields, so it stays visible without shifting one.
|
|
142
|
+
"""
|
|
104
143
|
pandas = require_optional_module("pandas", extra="excel", capability="Excel export")
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
fields = _content_column_labels(checkpoint)
|
|
145
|
+
field_set = set(fields)
|
|
146
|
+
names = (*fields, *(name for name in checkpoint.units if name not in field_set))
|
|
147
|
+
rows = []
|
|
148
|
+
for field_name in names:
|
|
149
|
+
unit = checkpoint.units.get(field_name) if isinstance(field_name, str) else None
|
|
150
|
+
rows.append(
|
|
151
|
+
{
|
|
152
|
+
"checkpoint_id": checkpoint.checkpoint_id,
|
|
153
|
+
"field": field_name,
|
|
154
|
+
"raw": unit.raw if unit is not None else None,
|
|
155
|
+
"qudt_unit": unit.qudt_unit if unit is not None else None,
|
|
156
|
+
"qudt_quantity_kind": unit.qudt_quantity_kind if unit is not None else None,
|
|
157
|
+
}
|
|
158
|
+
)
|
|
115
159
|
return cast("pd.DataFrame", pandas.DataFrame(rows, columns=UNIT_COLUMNS))
|
|
116
160
|
|
|
117
161
|
|
|
@@ -11,6 +11,7 @@ pandas or OpenPyXL until a caller exports a workbook.
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
13
|
import csv
|
|
14
|
+
import errno
|
|
14
15
|
import math
|
|
15
16
|
import os
|
|
16
17
|
import tempfile
|
|
@@ -90,7 +91,14 @@ class _ExportColumns:
|
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
# @lat: [[exports#CSV output]]
|
|
93
|
-
def write_csv(
|
|
94
|
+
def write_csv(
|
|
95
|
+
run_id: str,
|
|
96
|
+
checkpoint: models.MaterialData,
|
|
97
|
+
filename: str | Path,
|
|
98
|
+
*,
|
|
99
|
+
max_bytes: int | None = None,
|
|
100
|
+
neutralise_formulas: bool = False,
|
|
101
|
+
) -> Path:
|
|
94
102
|
"""Write the content of one checkpoint to a CSV file, without its metadata.
|
|
95
103
|
|
|
96
104
|
The writer uses the standard library, so CSV output needs no optional
|
|
@@ -101,32 +109,128 @@ def write_csv(run_id: str, checkpoint: models.MaterialData, filename: str | Path
|
|
|
101
109
|
run_id: The identifier of the run that holds the checkpoint.
|
|
102
110
|
checkpoint: The checkpoint to write.
|
|
103
111
|
filename: The path to write the data to. The suffix becomes `CSV_SUFFIX`.
|
|
112
|
+
max_bytes: The maximum encoded output size, or None for no limit. The limit
|
|
113
|
+
is enforced while each row is written, so a table that expands beyond it
|
|
114
|
+
never occupies that full size on disk or in MEMFS.
|
|
115
|
+
neutralise_formulas: Prefix formula-like text with an apostrophe so a
|
|
116
|
+
spreadsheet treats archive-supplied names as text. Numeric cells are
|
|
117
|
+
unchanged. The default keeps the byte-for-byte pandas parity.
|
|
104
118
|
|
|
105
119
|
Returns:
|
|
106
120
|
The path of the CSV file.
|
|
107
121
|
|
|
108
122
|
Raises:
|
|
109
123
|
UnexportableCheckpointError: If the checkpoint holds no table.
|
|
124
|
+
OSError: With `errno.EFBIG` when `max_bytes` is exceeded.
|
|
125
|
+
ValueError: If `max_bytes` is negative.
|
|
110
126
|
"""
|
|
127
|
+
if max_bytes is not None and max_bytes < 0:
|
|
128
|
+
raise ValueError("max_bytes must be non-negative.")
|
|
111
129
|
columns = _checkpoint_export_columns(run_id, checkpoint)
|
|
112
130
|
|
|
113
131
|
path = _prepared_path(filename, CSV_SUFFIX)
|
|
114
132
|
with _staged_path(path) as staged_path:
|
|
115
|
-
_write_csv_rows(
|
|
133
|
+
_write_csv_rows(
|
|
134
|
+
staged_path,
|
|
135
|
+
columns,
|
|
136
|
+
max_bytes=max_bytes,
|
|
137
|
+
neutralise_formulas=neutralise_formulas,
|
|
138
|
+
)
|
|
116
139
|
return path
|
|
117
140
|
|
|
118
141
|
|
|
119
|
-
|
|
142
|
+
class _BoundedTextWriter:
|
|
143
|
+
"""Count UTF-8 bytes and refuse the chunk that would exceed one limit."""
|
|
144
|
+
|
|
145
|
+
def __init__(self, handle: Any, max_bytes: int | None) -> None:
|
|
146
|
+
self._handle = handle
|
|
147
|
+
self._max_bytes = max_bytes
|
|
148
|
+
self._written = 0
|
|
149
|
+
|
|
150
|
+
def write(self, text: str) -> int:
|
|
151
|
+
"""Write one text chunk after checking its encoded size."""
|
|
152
|
+
self._written += len(text.encode("utf-8"))
|
|
153
|
+
if self._max_bytes is not None and self._written > self._max_bytes:
|
|
154
|
+
raise OSError(errno.EFBIG, "The CSV output exceeds the maximum size.")
|
|
155
|
+
return int(self._handle.write(text))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _neutralise_formula(text: str) -> str:
|
|
159
|
+
"""Prefix formula-like text so a spreadsheet cannot evaluate it."""
|
|
160
|
+
if not text:
|
|
161
|
+
return text
|
|
162
|
+
stripped = text.lstrip()
|
|
163
|
+
if not stripped:
|
|
164
|
+
return text
|
|
165
|
+
candidate = stripped[0] in "=+@\t\r"
|
|
166
|
+
if stripped[0] == "-":
|
|
167
|
+
try:
|
|
168
|
+
float(stripped)
|
|
169
|
+
except ValueError:
|
|
170
|
+
candidate = True
|
|
171
|
+
return f"'{text}" if candidate else text
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def csv_headers(
|
|
175
|
+
headers: Sequence[str],
|
|
176
|
+
*,
|
|
177
|
+
neutralise_formulas: bool = False,
|
|
178
|
+
checkpoint_id: str | None = None,
|
|
179
|
+
) -> tuple[str, ...]:
|
|
180
|
+
"""Return the final CSV header row after optional formula neutralisation.
|
|
181
|
+
|
|
182
|
+
The content-header alias check runs before neutralisation. Two distinct source
|
|
183
|
+
headers can still converge on one final header when one already starts with the
|
|
184
|
+
apostrophe that neutralisation adds. Reject that row before it is written, so a
|
|
185
|
+
reader cannot silently keep only the later column.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
headers: The headers after the checkpoint and content alias rules.
|
|
189
|
+
neutralise_formulas: Whether to prefix formula-like header text.
|
|
190
|
+
checkpoint_id: The checkpoint identity for the error text, when known.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
The exact headers that the writer will emit.
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
UnexportableCheckpointError: If two final headers are equal.
|
|
197
|
+
"""
|
|
198
|
+
final = tuple(
|
|
199
|
+
_neutralise_formula(header) if neutralise_formulas else header for header in headers
|
|
200
|
+
)
|
|
201
|
+
seen: set[str] = set()
|
|
202
|
+
for header in final:
|
|
203
|
+
if header in seen:
|
|
204
|
+
identity = f"Checkpoint {checkpoint_id!r}" if checkpoint_id else "The checkpoint"
|
|
205
|
+
raise UnexportableCheckpointError(
|
|
206
|
+
f"{identity} would emit the CSV header {header!r} more than once after "
|
|
207
|
+
"formula neutralisation. The mtrl archive still holds every source field."
|
|
208
|
+
)
|
|
209
|
+
seen.add(header)
|
|
210
|
+
return final
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _write_csv_rows(
|
|
214
|
+
staged_path: Path,
|
|
215
|
+
columns: _ExportColumns,
|
|
216
|
+
*,
|
|
217
|
+
max_bytes: int | None = None,
|
|
218
|
+
neutralise_formulas: bool = False,
|
|
219
|
+
) -> None:
|
|
120
220
|
"""Write one CSV table to a staged path, with each value in its export text form."""
|
|
221
|
+
headers = csv_headers(columns.headers, neutralise_formulas=neutralise_formulas)
|
|
121
222
|
with staged_path.open("w", encoding="utf-8", newline="") as handle:
|
|
122
|
-
writer = csv.writer(handle, lineterminator="\n")
|
|
123
|
-
writer.writerow(
|
|
223
|
+
writer = csv.writer(_BoundedTextWriter(handle, max_bytes), lineterminator="\n")
|
|
224
|
+
writer.writerow(headers)
|
|
124
225
|
for index in range(columns.row_count):
|
|
125
226
|
cell_values = (
|
|
126
227
|
*columns.labels,
|
|
127
228
|
*(column[index] for _, column in columns.columns),
|
|
128
229
|
)
|
|
129
|
-
|
|
230
|
+
row = [_csv_cell_text(value) for value in cell_values]
|
|
231
|
+
writer.writerow(
|
|
232
|
+
[_neutralise_formula(text) if neutralise_formulas else text for text in row]
|
|
233
|
+
)
|
|
130
234
|
|
|
131
235
|
|
|
132
236
|
def _csv_cell_text(value: Any) -> str:
|
|
@@ -166,7 +270,7 @@ def _checkpoint_export_columns(
|
|
|
166
270
|
content_columns = _content_columns(content, checkpoint)
|
|
167
271
|
headers = (
|
|
168
272
|
*CHECKPOINT_COLUMNS,
|
|
169
|
-
*
|
|
273
|
+
*content_csv_headers(
|
|
170
274
|
tuple(name for name, _ in content_columns),
|
|
171
275
|
checkpoint_id=checkpoint.checkpoint_id,
|
|
172
276
|
),
|
|
@@ -179,7 +283,7 @@ def _checkpoint_export_columns(
|
|
|
179
283
|
)
|
|
180
284
|
|
|
181
285
|
|
|
182
|
-
def
|
|
286
|
+
def content_csv_headers(names: Sequence[str], *, checkpoint_id: str) -> tuple[str, ...]:
|
|
183
287
|
"""Return the export header of each content field beside the checkpoint columns.
|
|
184
288
|
|
|
185
289
|
A field named after a column in `CHECKPOINT_COLUMNS`, such as "type", becomes
|
|
@@ -29,7 +29,7 @@ from mtrl.exceptions import (
|
|
|
29
29
|
from mtrl.exports import (
|
|
30
30
|
CHECKPOINT_COLUMNS,
|
|
31
31
|
UNNAMED_VALUE_COLUMN,
|
|
32
|
-
|
|
32
|
+
content_csv_headers,
|
|
33
33
|
)
|
|
34
34
|
from mtrl.integrity.canonical import encode_typed_metadata
|
|
35
35
|
|
|
@@ -558,7 +558,7 @@ def _labelled_checkpoint_frame(run_id: str, checkpoint: models.MaterialData) ->
|
|
|
558
558
|
"""
|
|
559
559
|
frame = checkpoint_to_frame(checkpoint)
|
|
560
560
|
content_labels = tuple(frame.columns)
|
|
561
|
-
headers =
|
|
561
|
+
headers = content_csv_headers(
|
|
562
562
|
tuple(str(label) for label in content_labels),
|
|
563
563
|
checkpoint_id=checkpoint.checkpoint_id,
|
|
564
564
|
)
|
|
@@ -17,8 +17,7 @@ import numpy as np
|
|
|
17
17
|
from mtrl.domain.committed_values import _INT64_MAX, _INT64_MIN
|
|
18
18
|
from mtrl.integrity.canonical import canonicalise_json
|
|
19
19
|
from mtrl.ml._canonical import _canonical_text
|
|
20
|
-
from mtrl.
|
|
21
|
-
from mtrl.units import Unit
|
|
20
|
+
from mtrl.units import Unit, unit_identity
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
def _normalise_group_value(value: Any) -> Any:
|
|
@@ -67,7 +66,7 @@ def _with_unit_identity(key: str, unit: Unit | None) -> str:
|
|
|
67
66
|
"""
|
|
68
67
|
if unit is None:
|
|
69
68
|
return key
|
|
70
|
-
kind_tag, identity =
|
|
69
|
+
kind_tag, identity = unit_identity(unit)
|
|
71
70
|
return f"{key}\t{kind_tag}:{identity}"
|
|
72
71
|
|
|
73
72
|
|