| --- |
| license: cc-by-4.0 |
| task_categories: [other] |
| tags: [mri, diffusion-mri, monte-carlo, microstructure, replay-pack, rpk, restricted-diffusion] |
| pretty_name: Canonical Pores — Monte-Carlo Replay Packs |
| --- |
| |
| # Canonical Pores — Monte-Carlo Replay Packs |
|
|
| Converged Monte-Carlo diffusion walks in the three geometries that have exact analytical solutions — |
| **parallel planes, cylinders, spheres** — frozen so that **any** acquisition can be computed afterwards |
| without re-simulating. |
|
|
| **600 substrates**: 200 diameters per shape, **0.1–20.0 µm in 0.1 µm steps**, each walked to |
| **T = 200 ms** at D₀ = 2.0×10⁻⁹ m²/s. One `.rpk` (safetensors) per substrate. |
|
|
| ## What you can replay |
|
|
| A replay pack is not a lookup table of pre-computed signals. It stores the walk itself, so the forward |
| model is evaluated at read time: |
|
|
| | you supply | how it is handled | exact? | |
| |---|---|---| |
| | **any gradient waveform** `G(t)` — PGSE, OGSE, PGSTE, CPMG-with-gradients, b-tensor (STE/PTE), arbitrary | projected onto the pack's temporal basis; the gradient phase is *linear* in position, so Parseval applies | exact for waveform content within the stored bands | |
| | **surface relaxivity** ρ, any value | the pack's boundary-local-time channel, replayed | **exact** — not a mean-field `exp(-TE·ρ·S/V)` tag-on | |
| | **per-compartment T₁ / T₂** | compartment map + relaxation log-weights | exact | |
| | **any b-value, Δ, δ, direction, orientation** | consequences of the waveform above | — | |
|
|
| There is **no short-pulse (SGP) and no Gaussian-phase approximation** anywhere in that path. That is the |
| point of the dataset: the analytical models (`P2`–`P5`, `C2`–`C5`, `S2`–`S5` in |
| [dmipy-fit](https://github.com/dmrai-lab/dmipy-fit)) each hold under some acquisition assumption; replay |
| holds for the acquisition you actually ran. |
|
|
| **Not in these packs**: susceptibility / off-resonance (no field channel), magnetization transfer, and |
| diffusivity is fixed per pack — D₀ is baked into the walk, not a replay knob. (Time-rescaling to a |
| different D₀ is a planned extension.) |
|
|
| ## What has been *certified*, and what that does not mean |
|
|
| Every substrate's replay was compared against the exact eigenmode (matrix-method) solution and sized until |
| the worst residual met **ε = 5×10⁻³**, measured over a battery of PGSE acquisitions: |
| (δ, Δ) ∈ {(10,20), (10,40), (10,60), (10,100), (5,40)} ms × b ∈ {1, 3, 5}×10⁹ s/m², plus a |
| surface-relaxivity battery. Walker counts were **measured**, never extrapolated: each candidate count was |
| replayed and compared to the analytic reference on up to five *disjoint* blocks, all of which had to pass. |
|
|
| **That battery is where the bound was measured — it is not a limit on what the pack replays.** The |
| distinction matters in one direction only: a waveform whose temporal content falls outside the tested |
| spectral range (very high-frequency OGSE, pulses shorter than the save grid) is still *replayable*, but its |
| error is not covered by the quoted ε. For these three geometries you can settle that yourself — the exact |
| analytical model ships in dmipy-fit (`P5PlaneMatrixMethod`, `C5CylinderMatrixMethod`, |
| `S5SphereMatrixMethod`), so any acquisition you care about can be checked directly against ground truth. |
| That is precisely what makes this dataset the validity proof for replay on substrates where no analytic |
| answer exists. |
|
|
| Practical resolution limits: the save grid is n_t ∈ {2000, 4000, 8000} over 200 ms, so features finer than |
| that grid are not resolved; and the position codec keeps K ∈ {128, 196} temporal bands, which bounds the |
| waveform bandwidth represented. |
| |
| | shape | substrates | all meet ε=5e-3 | worst residual | |
| |---|---|---|---| |
| | plane | 200 | ✅ | see `manifest.json` | |
| | cylinder | 200 | ✅ | see `manifest.json` | |
| | sphere | 200 | ✅ | see `manifest.json` | |
| |
| Each pack carries its own certification in metadata (`grid.worst_residual`, `grid.ladder`), so no consumer |
| has to trust this table. |
|
|
| ## Tiers: fetch only what you need |
|
|
| Two independent selections, and they **compose into a single contiguous byte range** — verified against |
| HuggingFace range requests (`Accept-Ranges: bytes`, HTTP 206). |
|
|
| **1. Precision (walkers).** Walkers are the leading axis of every per-walker tensor, and any prefix is an |
| unbiased sub-ensemble with floor ∝ 1/√n. Each pack ships the **measured** prefix length for each floor: |
|
|
| ```python |
| grid["prefix_tiers"] # e.g. {"0.03": 1000, "0.02": 1000, "0.01": 1000, "0.005": 1000} |
| ``` |
|
|
| **2. Spatial axis.** Positions are stored as **one tensor per axis** (`pos_x`, `pos_y`, `pos_z`, each |
| `(n_walkers, K)`), so you fetch only the components your geometry needs — a slab restricts one direction |
| (the other two are free and analytic), a cylinder two, a sphere three. All three are always present, so |
| rotating / b-tensor encodings that need the joint trajectory lose nothing. |
|
|
| Measured on a 17.36 MiB pack: one axis + a 2,000-walker prefix = **0.49 MiB, a 36× reduction**. |
|
|
| ```python |
| from safetensors import safe_open |
| with safe_open("cylinder/d10.00um.rpk", framework="np") as f: |
| x = f.get_slice("pos_x")[0:2000] # one axis, coarse tier: one contiguous read |
| ``` |
|
|
| **Status of the two selections.** Both are real and verified at the byte level, but only one is automatic |
| today: |
|
|
| * **Per-diameter fetch is automatic.** The `X6` compartments resolve a fitted diameter to the two |
| bracketing packs and download only those, so a fit transfers ~tens of MiB, never the dataset. |
| * **Coarser-ε prefix fetch is automatic too**, via `eps=`: |
|
|
| ```python |
| from dmipy_fit.data.mc_replay import load_replay_family |
| fam = load_replay_family("cylinder", 2e-9, eps=1e-2) # range-reads each pack down to its 1e-2 tier |
| ``` |
|
|
| Measured live on this dataset (cylinder d=13.45 µm, 50,000-row pack): ε=5e-3 moves 43.39 MiB, |
| ε=1e-2 moves 17.36 MiB, ε=3e-2 moves **4.34 MiB** — a 10× reduction — with the delivered accuracy |
| tracking the request. The tier count comes from `manifest.json`, so choosing one costs no transfer, |
| and an ε with no measured tier raises rather than silently returning something coarser. |
|
|
| `axes=` restricts which position components are fetched (1 for a slab, 2 for a cylinder's transverse |
| plane) for a further 1.5–3×. It is **not** defaulted: rotating / b-tensor encodings need the joint |
| trajectory, so ask for it only when your encoding is fixed-direction. |
|
|
| ## Usage |
|
|
| ```python |
| from dmipy_sim import read_rpk, compile_scheme, replay_signal |
| pack = read_rpk("cylinder/d05.00um.rpk") |
| W = compile_scheme(G, dt, pack.meta["compression"]["K"]) # G: (n_meas, n_t, 3), any waveform |
| E = replay_signal(pack, W) # + rho_over_D= for surface relaxivity |
| ``` |
|
|
| As fit compartments (`X6`), with the same parameters as their analytic siblings: |
|
|
| ```python |
| from dmipy_fit.signal_models.cylinder_models import C6MonteCarloReplayCylinder |
| model = C6MonteCarloReplayCylinder() # mu, lambda_par, diameter — fetches packs on demand |
| ``` |
|
|
| `manifest.json` lists every substrate with its walker count, size, certified residual and prefix tiers. |
|
|
| ## Layout |
|
|
| ``` |
| canonical/D0-2.00e-9/{plane,cylinder,sphere}/d<NN.NN>um.rpk |
| manifest.json |
| ``` |
|
|
| ## Citation |
|
|
| Generated with [`dmipy-sim`](https://github.com/dmrai-lab/dmipy-sim). Please cite the dataset DOI and the |
| dmipy-sim replay-pack reference. CC-BY-4.0. |
|
|