A standalone generator of susceptibility tensor series for pNMR simulations
Project description
pnmr-chi-gen
pnmr-chi-gen is a standalone generator of magnetic susceptibility tensor series for paramagnetic NMR simulation workflows and machine-learning datasets.
The package is built to generate physically valid, temperature-dependent susceptibility tensors in a format that can be consumed by paranmr/simpnmr. Its immediate value is upstream of simulation: it gives ML workflows a controlled way to sample tensor trajectories with explicit latent parameters, temperature grids, and reproducible seeds.
Why this library matters for ML
In paramagnetic NMR, the magnetic susceptibility tensor is a compact physical object that strongly controls PCS-driven spectral behaviour. For ML applications, that makes it a useful representation layer:
- physically meaningful
- lower-dimensional than spectra
- easy to constrain
- easy to sample reproducibly
- directly consumable by downstream simulation tools
Instead of starting from broad synthetic artifacts and inferring structure afterward, pnmr-chi-gen starts from the tensor itself. That makes dataset generation more controlled, more interpretable, and easier to audit.
Typical use cases:
- synthetic data generation for inverse pNMR problems
- supervised learning on latent-to-tensor mappings
- augmentation across temperature series
- benchmarking tensor reconstruction models
- generating
paranmr/simpnmr-compatible inputs at scale
Current scope
Version v0.0.1 is intentionally focused.
Implemented:
iso / ax / rho_over_axtensor parameterization- one shared orientation per generated series
- integer temperature grids
- Curie-like temperature dependence across the series
- deterministic YAML-driven generation
paranmr/simpnmr-compatible CSV export- CLI entrypoint for reproducible batch generation
Not implemented yet:
- alternative tensor parameterizations
- richer temperature-dependence models
- dataset manifests and metadata bundles
- dedicated ML dataset export layers
Installation
python3 -m pip install -e .
For development:
python3 -m pip install -e .[dev]
Quick start
Example config:
output_name: run_minimal_output
generator:
n_series: 1
seed: 7
temperature:
start: 280
stop: 282
step: 1
chi_iso: 10.0
chi_ax: 3.0
rho_over_ax: 0.1666666667
orientation:
alpha_deg: 0.0
beta_deg: 0.0
gamma_deg: 0.0
Run:
pnmr_chi_gen run examples/run_minimal.yaml
This creates:
examples/run_minimal_output/
susceptibility_tensor_1_280K_to_282K.csv
YAML contract
The input model is intentionally small.
Scalar values mean fixed parameters:
chi_ax: 3.0
Two-element lists mean uniform sampling bounds:
chi_ax: [0.0, 3.0]
The same pattern applies to Euler angles:
orientation:
alpha_deg: [0.0, 360.0]
beta_deg: [0.0, 180.0]
gamma_deg: [0.0, 360.0]
output_name controls the name of the folder created next to the YAML file.
If output_name is omitted, the folder name defaults to the YAML filename stem.
Output contract
Each generated CSV stores one full temperature series of susceptibility tensors.
The exported layout is compatible with paranmr/simpnmr and includes:
- temperature
chi_isochi_axchi_rho- full Cartesian tensor components
- traceless anisotropic components
- principal values
- Euler angles
That makes the generator useful both as a standalone library and as an upstream source for pNMR simulation pipelines.
Physical and engineering constraints
The library validates a small set of explicit invariants:
0 <= rho_over_ax <= 1/3- Euler angles in valid
ZYZranges - symmetric
3x3susceptibility tensors - positive temperatures
- strictly increasing temperature series without duplicates
- sampling bounds with
lower <= upper
These checks live in the core constraint layer rather than being scattered across CLI or config parsing code.
Architecture
The package is structured as a layered system:
src/pnmr_chi_gen/
app/ # orchestration
cfg/ # YAML-facing config loading
cli/ # command-line entrypoint and logging
core/ # constraints, domain, generators, parameterizations, rotations
io/ # export adapters
Responsibilities are separated on purpose:
clihandles user interactioncfgtranslates YAML into typed internal specscoreowns scientific and numerical logicioowns file-format boundariesappwires the pipeline end to end
This keeps the codebase usable both as a CLI tool and as a library component inside larger ML and simulation workflows.
Reproducibility
Generation is seed-controlled:
generator:
n_series: 100
seed: 42
That matters for ML dataset work, where exact regeneration of sampled tensors is often required for experiments, benchmarks, and audits.
Relationship to paranmr/simpnmr
pnmr-chi-gen is not meant to replace paranmr/simpnmr. It sits upstream of that ecosystem.
pnmr-chi-gengenerates susceptibility tensor seriesparanmr/simpnmrconsumes susceptibility tensors in fitting and simulation workflows
That separation is useful. One tool is responsible for controlled data generation; the other is responsible for domain simulation and analysis.
Development
Run tests:
PYTHONPATH=src python3 -m pytest -q
Run the example:
pnmr_chi_gen run examples/run_minimal.yaml
Roadmap
Planned next directions:
- broader prior families for tensor latents
- additional tensor parameterizations
- richer temperature-dependence models
- dataset provenance and metadata export
- tighter support for larger synthetic ML corpora
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pnmr_chi_gen-0.1.0.tar.gz.
File metadata
- Download URL: pnmr_chi_gen-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64c5d31ec8812d8a8463af262bc0edec74215aa318dbe355fae6abb0fcc4882a
|
|
| MD5 |
6afcce37d853ac449fd24ae75644258d
|
|
| BLAKE2b-256 |
213bdfd91cd54b09a6b7ba6c781eec46316cf0655d9033a09aebf3b86a5e1e75
|
Provenance
The following attestation bundles were made for pnmr_chi_gen-0.1.0.tar.gz:
Publisher:
release.yml on Mephistos-ML/pnmr-chi-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pnmr_chi_gen-0.1.0.tar.gz -
Subject digest:
64c5d31ec8812d8a8463af262bc0edec74215aa318dbe355fae6abb0fcc4882a - Sigstore transparency entry: 2168774853
- Sigstore integration time:
-
Permalink:
Mephistos-ML/pnmr-chi-gen@b98c7eb6054ea656a0f87d86db544b617616b9e0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Mephistos-ML
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b98c7eb6054ea656a0f87d86db544b617616b9e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pnmr_chi_gen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pnmr_chi_gen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84a9a3ec774cbd60f1e175f7f3cc92bd8fd67516c52ffd130211a3cab746afa4
|
|
| MD5 |
d59b4833b02e35a039e2e1e454b07eee
|
|
| BLAKE2b-256 |
b9014e5a72fff2bb5f19bc66ae2b8f2698dba2ecca565b89748fa49312fe5270
|
Provenance
The following attestation bundles were made for pnmr_chi_gen-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Mephistos-ML/pnmr-chi-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pnmr_chi_gen-0.1.0-py3-none-any.whl -
Subject digest:
84a9a3ec774cbd60f1e175f7f3cc92bd8fd67516c52ffd130211a3cab746afa4 - Sigstore transparency entry: 2168774888
- Sigstore integration time:
-
Permalink:
Mephistos-ML/pnmr-chi-gen@b98c7eb6054ea656a0f87d86db544b617616b9e0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Mephistos-ML
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b98c7eb6054ea656a0f87d86db544b617616b9e0 -
Trigger Event:
push
-
Statement type: