vector-mtrl
mtrl reads, checks, and writes materials data archives. It records each scientific result as an
immutable record with exact lineage.
What you get
- Immutable committed records with stable identities and complete lineage.
- Bounded
.mtrlarchives with an integrity manifest, external receipts, and forensic inspection. - NumPy-only operations: identity, scale, offset, peak normalisation, zero-at-point, and linear resample, beside mean and median aggregates.
- Explicit analysis grids and a read-only alignment report.
- A read-only replay plan, a capability view, and a detached rerun for committed chains.
- Author disclosure that stays inert: stored environment records and passive source bundles that MTRL never imports or executes.
- CSV export without pandas.
- Optional extras add SciPy resampling, pandas conversion, and Excel export.
Install
vector-mtrl requires Python 3.14 or newer, below Python 4. The base install depends only on
NumPy, Pydantic, and RFC 8785 canonical JSON. Create one environment and install the core:
uv venv --python 3.14
uv pip install --python .venv/bin/python vector-mtrl
Quick start
Commit one synthetic spectrum, normalise it, save an archive, verify it, load it, and export CSV. The base install alone runs every step.
Example: Quick start
Required install: vector-mtrl
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
from mtrl import InstrumentRun, MaterialData, Mtrl, verify_archive
application = Mtrl(sample_id="sample-01")
run = InstrumentRun(run_name="replicate-01")
axis = np.array([2000.0, 2100.0, 2200.0])
content = np.empty(axis.size, dtype=[("wavenumber", "<f8"), ("absorbance", "<f8")])
content["wavenumber"] = axis
content["absorbance"] = [0.1, 0.2, 0.3]
checkpoint = MaterialData(
content=content,
type="raw",
checkpoint_name="spectrum",
)
run.add_checkpoint(checkpoint)
application.add(run)
normalised = application.transform(
run.run_id,
checkpoint.checkpoint_id,
"normalise_peak",
)
print(normalised.lineage.provenance.qualified_identifier)
with TemporaryDirectory() as directory:
archive_path = application.save(Path(directory) / "sample.mtrl")
verification = verify_archive(archive_path)
print(verification.structural_status.value, verification.hash_status.value)
loaded = Mtrl.load(archive_path)
print(loaded.sample_id, loaded.get_run(run.run_id) is not None)
csv_path = loaded.export_checkpoint(
run.run_id,
normalised.checkpoint_id,
Path(directory) / "signal.csv",
)
exported = np.genfromtxt(csv_path, delimiter=",", names=True)
np.testing.assert_allclose(exported["absorbance"], [1 / 3, 2 / 3, 1])
print(csv_path.is_file())
Mtrl.add() commits a detached copy, so later changes to your arrays cannot alter the record.
Every mutation, including the transform above, creates one new revision.
Guides
The expanded guides ship in the source archive under docs/user/. Download the archive for a
release from https://pypi.org/project/vector-mtrl/#files, then read:
docs/user/getting-started.mdfor installation, first records, and the save, load, verify, and export loop.docs/user/workflows.mdfor corrections, replacements, transforms, resampling, aggregates, alignment reports, replay, receipts, forensic inspection, disclosure, exports, and registry control.docs/user/reference.mdfor every public route, the stable typed imports, the exact package-root export list, registry names, format features, and the archive safety contract.
Archive and provenance limits
MTRL reads .mtrl archives inside configured size and member limits, and it validates paths,
entries, JSON, references, payloads, and integrity before it returns data. It does not extract
archive files.
Archive content does not install packages, does not import operation code, does not change a
registry, does not execute stored source, and does not change committed records directly.
Committed records are immutable: use Mtrl methods to create a new record version or change the
active view.
New archives require integrity coverage. Keep a receipt outside the archive if you need to
detect a complete rewrite. A receipt has no signature, so send it through a separate trusted
channel. forensic_inspect() reports damaged archive facts, but it does not return damaged data
for normal analysis. MTRL verifies digests and never verifies your execution environment:
environment records are author claims, not checked facts.
Licence
The core is licensed under the MPL-2.0. Read the licence text in LICENSE and the inherited
notices in NOTICE, both included in this distribution. The upstream licence reference is
https://www.mozilla.org/en-US/MPL/2.0/.
Metadata
Release files for vector-mtrl 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| vector_mtrl-0.2.0.tar.gz | 242.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vector_mtrl-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 510.0 kB
Release files / vector_mtrl-0.2.0.tar.gz
| Download URL | vector_mtrl-0.2.0.tar.gz |
|---|---|
| Size | 242.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acbcd7f5d541c286e7a75b56a81172b17d48986d01984dd75569da912938382f
|
|
BLAKE2b-256 checksum How to use checksums |
0544e121a51d631613daad64b2af9d86b37f0d14caebba491c08596385e07f15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / vector_mtrl-0.2.0-py3-none-any.whl
| Download URL | vector_mtrl-0.2.0-py3-none-any.whl |
|---|---|
| Size | 267.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c4fc027616ab474d28f29b3ba07b1ba1429060db42d27d94671f7235b0ea876
|
|
BLAKE2b-256 checksum How to use checksums |
caf4bc80e2ee2efb62beba762fde753d22b9d7e512105121893bfc33106d25c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for vector-mtrl 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for vector_mtrl-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.