Jarrodbarnes's picture
SDL-2 release (part 5)
82c1555 verified
|
Raw History Blame Contribute Delete
40.3 kB

NdFeB SPS physics-model tool (owner-built; numpy-only), package C4

Owner-built. This is Dynamical's model, fitted to RPI's released records. It is not an RPI or collaborator model, and its assumptions about those records are model choices, listed under "Fitted assumptions" below.

What it is. A conditional executable physics model of spark-plasma-sintered, Dy/Tb-free NdFeB. It is a hierarchical Bayesian process → density → grain size → coercivity → remanence → energy-product chain, fitted to the historical specimens A–E, the sample E anneal series, the slide-18 density series and the densities of bodies #1–#6, with declared literature priors. It averages competing mechanism hypotheses for densification (D1 diffusion, D2 creep, D3 liquid-phase, D0 other) and for coercivity (H1 residual hydrogen, H2 grain-boundary liquid continuity, H3 α-Fe/decomposition, H4 grain size/Kronmüller, H5 open porosity/oxidation, H0 other). It also carries three declared explanations of why load applied during heating lowers coercivity (the load-timing indicator; see "Load timing").

Evidence class: owner-built conditional executable physics model (Dynamical's model fitted to RPI's released records and declared literature priors; not an RPI or collaborator model); not a physical observation; does not calibrate current-body coercivity.

Limits you should know before using it.

  • Only four independent magnetic specimens exist (A, C, D, E pellet), all at 850–950 °C and ≥ 97 %TD. No body #1–#6 has magnetic data, so coercivity predictions for porous bodies at 750–850 °C are extrapolations. They are driven mainly by priors and by which mechanism is right; the outputs say so (prior_dominated, mechanism_dominated, out_of_hull).
  • RPI's bodies are isotropic (⟨cos θ⟩ = 0.5): Br ≲ Js/2 ≈ 8 kG and (BH)max ≲ Br²/4 (≈ 13–16 MGOe at full density). The objective (Hci ≥ 20 kOe and ~45–48 MGOe, Dy/Tb-free, at operating temperature) needs Br ≥ 13.4 kG, i.e. grain alignment. alignment_cos and T_measure_C are declared scenarios, never calibrated.
  • The coercivity-mechanism weights are close to their prior: the historical data barely discriminate the mechanisms in the current regime. eig reports how much a candidate measurement you specify would move them.
  • The load-timing weights are at their prior (see "Load timing"). One historical contrast (D vs E) cannot separate the three explanations.
  • The residual-hydrogen mechanism (H1) did not fully converge: its fits reach R-hat 1.014–1.018 over 8 chains (the criterion is 1.01; effective sample sizes are adequate). H1 carries 0.007 of the coercivity-mechanism weight.
  • The coercivity-mechanism weights are evidence-uncertain: the evidence estimators disagree, and moving each model's evidence within the spread of its own estimates moves these weights by more than a factor of 3: H1 0.003–0.020, H2 0.093–0.286, H3 0.089–0.348, H5 0.072–0.298, H0 0.078–0.353.
  • A feedstock particle size other than 4 µm (feedstock_d50_um) is a declared, uncalibrated extrapolation: every parameter of that layer is a literature-based prior that no record constrains (see "Feedstock particle size").
  • Degassing enters the fit at two states only. The model assumes samples A–C correspond to completeness 0 and D/E to completeness 1; RPI's record does not state A–C's dehydrogenation. Intermediate completeness is interpolated, and completeness above 1 and complete degassing are declared extrapolations.

Load timing: three declared explanations

RPI's historical specimens D and E were both made from degassed powder at 850 °C and reached near full density. D had the load applied during heating (conventional SPS) and reached Hci 2.86 kOe; E had the load applied only on cooling and reached 7.71 kOe. Three explanations are declared, and every coercivity mechanism H0–H5 is combined with each of them:

  • trap, hydrogen trapping. Load applied during heating closes the porosity before residual hydrogen escapes; the trapped hydrogen degrades the grain-boundary phase. The penalty follows the hydrogen trapped by early pore closure, beyond what an open-pore schedule would leave. It is zero for load on cooling and vanishes when degassing is complete (degas_completeness: "complete"), whatever the load schedule.
  • load, load timing itself. Load acting while the Nd-rich grain-boundary phase is liquid or soft squeezes it to the triple junctions, independent of hydrogen. The penalty follows the time-integrated load while the boundary phase is soft (midpoint prior 700 ± 40 °C, above the 655–665 °C ternary eutectic). It persists with complete degassing; it grows with slow cooling under load, slow load ramps and a dwell under load, and shrinks with faster heating.
  • current, current path. With the load on, punch–compact contact routes the pulsed current through the compact and overheats the particle necks, independent of hydrogen. The penalty grows with heating rate (current density) and peak temperature, persists with complete degassing, and is absent when the compact carries no current (load on cooling, or current_path: "insulated").

How they enter: ln Hci = (mechanism H) − b_LT · Π(route), where b_LT is the penalty at RPI's D route relative to E (fitted from the D–E contrast, shared by the three explanations) and Π is the explanation's normalised penalty: exactly 1 at D's route, exactly 0 at E's route, and saturating (each explanation's damage cannot exceed a bounded multiple of D's). Every explanation therefore reproduces D and E; they differ only away from those two routes.

Fitted weights. trap 0.37, load 0.28, current 0.35 (within the coercivity mechanisms: trap 0.33–0.96, load 0.02–0.43, current 0.02–0.58; with each model's evidence moved within the spread of its own estimates: trap 0.21–0.59, load 0.14–0.43, current 0.20–0.54). They are prior-dominated: the prior is 1/3 each, the historical records (A–E) contain no route that separates the explanations, and the two evidence estimators disagree by up to 3.5 nats for a single model, more than most differences between labels. One exception: within H1 (residual hydrogen), trap carries 0.96, because that pairing alone lets hydrogen also account for the non-degassed sample C; H1 itself carries 0.007 of the coercivity-mechanism weight. The weights rest on the evidence of single-label models (each coercivity mechanism fitted once per explanation): bridge sampling on the NUTS draws (36 estimates) and SMC runs of 6000 particles x 80 moves (36 estimates) over the 18 single-label models; 18 models have two or more estimates, whose spread is 0.90 nats at the median and 3.50 nats at the largest. Each model's evidence is the median of its estimates.

eig reports the information a candidate design you specify carries about these weights (eig_load_timing_*).

Where to read them. predict(...)["outputs"][<magnetic output>]["by_load_timing"] (median, q05, q95, n per explanation), mechanism_weights["load_timing"], p_meets_spec(...)["by_load_timing"], and condition() updates the weights with new observations.

Fitted assumptions (model choices; RPI has not stated these)

Each is a choice the fit makes where the released record is silent or partial.

  • A–C at degassing completeness 0, D and E at completeness 1. The record does not state A–C's dehydrogenation. The two states anchor the completeness scale.
  • Owner-digitized Hk and (BH)max for D and E from the deck curves. The (BH)max shape calibration across those curves has a log-sd of 0.033 (about ±3 %).
  • Load-timing alternatives are normalised at RPI's D and E routes (see "Load timing"). D and E are taken as the slide-12 rows: 850 °C, 10 °C/min, 10 min, 50 MPa, degassed; D with the load through heating, E with 0→50 MPa over 850→700 °C on cooling (1.5 min).
  • Degassing in the planned route (600 °C, 15 min, sealed quartz) is treated as the fitted D/E state (completeness 1; D and E were degassed 600 °C/10 min). This is not calibrated.
  • Pore closure for the hydrogen-trapping explanation at or below 850 °C (prior on the closure temperature truncated at 850 °C). This is a prior choice informed by the near-full density of historical A, C and D, which had the load during heating and reached ≥ 97.7 %TD after 850–950 °C dwells; it is not a measurement.
  • #1–#3 pooled as one preparation (PREP-C750); #4, #5 and #6 pooled as PREP-C800. RPI has not stated whether #5 or #6 used #4's powder batch. A further 800 °C body can be given prep: "new" instead.
  • Route conditions in the density fit: #1–#3 load on cooling (RPI's records); #4 and #5 load on cooling inferred from their traces, not stated by RPI; #6 load on cooling, 10 °C/min, 5 min and 60 MPa from the panel plan (no SPS trace or delivered settings have been released for #6), with the default cooling rate (100 °C/min) and load ramp (0.3 min); 60 MPa and 5 min (panel plan where delivered settings were not supplied); cooling rates and load ramps of #1–#5 from the owner's readings of the display traces.
  • #6 enters as RPI's reported density (5.63 g/cm³). The cylinder arithmetic on its reported mass and dimensions gives 5.64 g/cm³ and is not used.
  • Default load ramp 0.3 min (load_ramp_min): the owner's reading of the #1–#5 display traces (75–80 % of the early-cooling displacement rise within about 15–21 s). Sample E's slide-12 row is 1.5 min.
  • Default cooling rate 100 °C/min: E's slide-12 segment; the traces read 90–103 °C/min.

Artifact hashes (sha256)

file sha256
ndfeb_physics_tool.py (tool module) 54d58ba2126eaa6fc1e28a86765de9f49b5849893604bada25ede70fd50aff8f
physics.py 444139f68fedcd65ca2f32cf1b92db02028e1573b033efdc8923878ab459411c
forward.py a872c20a4cf8c6e91f54924bfa6b730eb07160b1dadcb4eb0dd309b65f60b402
posterior_tool.npz (thinned posterior + prior draws) 688d3ab354110fea78033ea1cdea09bbdb2fe0422980d16a5d36b28edfdd14ec
TOOL_MANIFEST.json 33d64bd0aeda5928e534777362d995ac3a2efc033df400e66bfbf54b29218a82

Loading (files are mounted by sha256, without names)

import importlib.util
from importlib.machinery import SourceFileLoader
raw = '/workspace/raw/'
TOOL, PHYS, FWD, POST, MAN = ('54d58ba2126eaa6fc1e28a86765de9f49b5849893604bada25ede70fd50aff8f', '444139f68fedcd65ca2f32cf1b92db02028e1573b033efdc8923878ab459411c', 'a872c20a4cf8c6e91f54924bfa6b730eb07160b1dadcb4eb0dd309b65f60b402', '688d3ab354110fea78033ea1cdea09bbdb2fe0422980d16a5d36b28edfdd14ec', '33d64bd0aeda5928e534777362d995ac3a2efc033df400e66bfbf54b29218a82')
loader = SourceFileLoader('ndfeb_physics_tool', raw + TOOL)
spec = importlib.util.spec_from_loader('ndfeb_physics_tool', loader)
tool = importlib.util.module_from_spec(spec); loader.exec_module(tool)
pm = tool.load(physics=raw + PHYS, forward=raw + FWD, posterior=raw + POST, manifest=raw + MAN)

load(..., manifest=...) verifies every file's sha256 against the manifest. Pass all five hashes in compute(..., artifact_sha256s=[...]). Results are deterministic for a given seed.

Routes (inputs and units)

A route is a dict. Only T_peak_C is required. The defaults follow RPI's planned panel route and the #1–#6 records (see "Fitted assumptions"). Unknown values of pressure_mode, anneal, current_path and degas_completeness raise an error.

key default meaning
T_peak_C — peak (dwell) temperature, °C
heating_rate_C_per_min 10 ramp rate
dwell_min 5 dwell at peak, minutes
P_MPa 60 applied pressure
pressure_mode "cooling" "cooling": no load during heating/dwell, load applied at T_peak on cooling; "heating": load ramps up during heating and is held (conventional SPS); "dwell": no load during heating, load rising from the start of the dwell and held through dwell and cooling (a declared scenario: no record uses it, so both modules report out_of_hull and calibrated is false)
cooling_rate_C_per_min 100
load_ramp_min 0.3 "cooling"/"dwell" mode: minutes for the load to rise from 0 to P_MPa (owner readings of the #1–#5 display traces ≈ 0.3; sample E 1.5)
degas 1.0 probability that the 600 °C dehydrogenation step was applied at all (0–1). The default is an assumption, not a record
degas_completeness 1.0 how complete that step was, as a fraction d of the fitted D/E state: a number in [0, 1.5], {"distribution": "uniform", "low": .., "high": ..} (0 ≤ low ≤ high ≤ 1.5), {"distribution": "beta", "a": .., "b": ..} (a, b > 0), or "complete". d > 1 is a declared extrapolation (ln Hci gains ε·(d − 1) times the draw's own completeness-0-to-1 change, ε ~ U(0, 1)). "complete" is a declared scenario: no residual hydrogen at the start of sintering (H1's hydrogen term and the trap penalty see none; the other mechanisms' generic degassing terms stay at the fitted D/E state). The effective state of a draw is occurrence × d. Routes or observations that share a prep must share degas_completeness (one powder batch). Batch records or a hydrogen measurement pin d; until then it is not calibrated
current_path "compact" "compact": a loaded compact in a conductive graphite die carries the pulsed current (RPI lines its die with graphite foil); "insulated": the compact is electrically isolated (e.g. a BN-coated or alumina-lined die), so the current penalty is zero. "insulated" is a declared scenario
anneal "none" "none", "900" (900 °C/2 h) or "900+520"
prep "new" preparation: "new" (fresh lot effect) or a fitted one: PREP-HIST-ND, PREP-HIST-DG, PREP-S18, PREP-C750 (#1–#3), PREP-C800 (#4–#6; pooling is a fitted assumption). Any other label (e.g. "new-A", "new-B") is a distinct new preparation: routes and observations with the same label share its preparation effect and degas state (one powder batch), so they must share degas_completeness; give each powder batch, such as each degassing arm of a design, its own label
alignment_cos 0.5 ⟨cos θ⟩; 0.5 = isotropic. Other values are a declared scenario
T_measure_C 20 measurement/operating temperature, °C; ≠ 20 is a declared scenario
feedstock_d50_um 4.0 median particle size of the powder at the start of sintering, µm, 0.5–8.0 (other values raise an error). 4.0 is RPI's stated feedstock and the feedstock of every fitted record. Any other value is a declared, uncalibrated extrapolation (see "Feedstock particle size"). A fitted preparation is the 4 µm feedstock, so another size needs prep: "new" or another new label; routes or observations that share a prep must share feedstock_d50_um

Feedstock particle size (declared, uncalibrated)

feedstock_d50_um is the median particle size of the powder at the start of sintering. 4.0 µm is RPI's stated feedstock ("grain size is about 4 microns") and the feedstock of every record the model was fitted to. At 4.0, or without the key, the tool computes exactly what it computes without this layer. Any other value is a declared extrapolation. No body in the records was made from other feedstock, so nothing in this layer is calibrated. Every parameter below is a prior draw, drawn independently for each coercivity mechanism, and the outputs carry the spread of those priors.

What is assumed.

  • Grain size. The initial grain size d0 of the grain-growth law becomes d0 × (d50 / 4 µm)^β. The growth terms (normal growth during heating and dwell, abnormal growth above about 850 °C, anneal growth) are unchanged, so a finer start grows relatively more. β ~ normal(0.9, 0.1) truncated to [0.5, 1.0] (median 0.88). Basis: particles finer than the alloy's grains are single crystals, so the starting grain follows the particle (β = 1). Across studies, sintered grain tracks powder size with a log-log slope near 0.9: 1.1 µm powder gave 1.8 µm grains [Une 2012], 2.0–3.6 µm powder gave 3.9–5.0 µm grains [Tang 2021], and 6.8 µm powder gave 9.3 µm grains in SPS [Tomše 2024]. Within Tang's series, after 1080 °C for 1 h, the slope is 0.42.
  • Coercivity through grain size. Every mechanism's Hci is multiplied by the same empirical factor, 1 − s·ln(D/D_ref), floored smoothly above zero. D is the sintered grain from the declared feedstock and D_ref the grain the same route gives from 4 µm feedstock, so the factor is 1 at 4 µm. s ~ log-normal, median 0.25, 95 % 0.09–0.73 (the fraction of Hci gained per e-fold of grain refinement). Basis: sintered and hot-deformed magnets follow Hc = a − b·ln D [Ramesh 1988; Bance 2014]. Relative to Hc at the coarser end, b/Hc is 0.23–0.29 per e-fold for low-oxygen pressless magnets with 1.0, 1.7 and 4.0 µm grains [Fukada 2012: μ0HcJ 1.82, 1.67, 1.31 T], about 0.21 from Bance's fit (n = 0.17), about 0.13 for hot-deformed 170–750 nm grains [Hioki 2014], and about 0.8 over 5.0 to 4.0 µm in Tang 2021 (two points, confounded with milling time and oxygen). Helium-milled 1.1 µm powder with 1.8 µm grains reached about 20 kOe [Une 2012]. A slope fixed in kOe, as in the Kronmüller form, would give a larger fraction at this campaign's lower coercivity. In H4, the Kronmüller term is evaluated at D_ref, so a feedstock change counts once, through this factor; H4 keeps its fitted response to temperature, dwell and anneal. The oxidation and hydrogen terms below act on top of the factor and can cancel the gain.
  • Oxidation. Finer powder has more surface and picks up more oxygen, and the oxide binds Nd that the grain-boundary phase needs. For every mechanism, ln Hci is lowered by C·(1 − exp(−g·x/C)) with x = max(0, d_ox/d50 − 1), the specific surface in excess of that of powder at the threshold size d_ox, and C = ln 10. The penalty is zero above d_ox and never exceeds a factor of 10. d_ox ~ log-normal, median 2 µm, 95 % 1.0–4.0 µm; g ~ log-normal, median 0.5, 95 % 0.10–2.4 (at half the threshold size the median penalty is a factor of 0.64). Basis: on a conventional nitrogen-milled route coercivity peaks near powder D50 2.7 µm, and a low-oxygen helium-milled route keeps the gain down to about 1 µm [Une 2012; Fukada 2012: μ0HcJ 1.82 T at a 1.0 µm grain size]. In a ball-milled series from Ames Laboratory, Hcj rose from 3.6 to 2.1 µm powder and fell 6.6 % at 2.0 µm as the oxygen content rose [Tang 2021]. Below the optimum grain size, the drop follows an Nd-oxide phase [Li 2009]. Reviews: [Hono 2012; Li 2021]. The factor-of-10 ceiling is a declared bound, not a measurement.
  • Residual hydrogen. Before degassing, the milled powder holds m_H = 1 + k·max(0, 1 − d50 / 4 µm) times the hydrogen of the current feedstock. k ~ log-normal, median 1, 95 % 0.21–4.8, so m_H has median 1.5 at 2 µm. The tool replaces the route's degassing state with the current-feedstock state that leaves the same residual hydrogen. The hydrogen mechanism (H1), the trap explanation and every mechanism's degassing term therefore respond, and degas_completeness sets how much hydrogen remains. With degas_completeness: "complete" the term is zero. Basis: powder taken directly after hydrogen decrepitation still holds its hydride hydrogen [Harris 1991; Checa Fernández 2023], and residual hydrogen lowers SPS coercivity [Tomše 2024: 120 vs 1140 kA/m for non-degassed vs degassed powder]. No source gives how this depends on particle size; the ramp from zero at 4 µm is a modelling choice. In this model, at the default degassing state and sizes of about 1–3 µm, this term moves the median coercivity more than either of the other two.
  • Distance from the records. H0's out-of-hull discrepancy counts a halving or doubling of d50 as one standardised unit, the same as 100 °C.

What is not known or not modelled.

  • No body in any record was made from milled or finer powder, so none of these priors has been tested against a measurement.
  • RPI has not stated a milling method, milling atmosphere, target size, or the oxygen or hydrogen content of milled powder.
  • Density is not modelled for other feedstock: such a route uses the current feedstock's density model unchanged, although finer powder packs and sinters differently.
  • Also not modelled: the spread of particle sizes and agglomerates; oxygen pick-up that depends on handling rather than size; changes of remanence or squareness from oxide; the limits seen below about 1 µm (a thin ferromagnetic grain-boundary phase); and a powder whose state differs at the same size (milled powder at 4.0 µm is treated as the current feedstock).

Where it shows. On a route with another size, outputs[name]["status"] and forecast_record(...)["status"] (and its per-output status) read "declared_extrapolation_uncalibrated"; otherwise they read "fitted_feedstock". feedstock (in predict, p_meets_spec and forecast_record) gives the size, declared and the status. out_of_hull lists feedstock_d50_um=<value> for both modules, so every output reads prior_dominated. scenarios carries feedstock_d50_um, feedstock_declared and calibrated: false. eig and condition accept the key.

Sources.

  • Tang W. et al. 2021, J. Magn. Magn. Mater. 521, 167533, doi:10.1016/j.jmmm.2020.167533
  • Une Y., Sagawa M. 2012, J. Japan Inst. Metals 76, 12, doi:10.2320/jinstmet.76.12
  • Fukada T. et al. 2012, Mater. Trans. 53, 1967, doi:10.2320/matertrans.MAW201207
  • Li W.F. et al. 2009, J. Magn. Magn. Mater., doi:10.1016/j.jmmm.2008.10.032 (abstract only)
  • Bance S. et al. 2014, J. Appl. Phys. 116, 233903, doi:10.1063/1.4904854
  • Hioki K. et al. 2014, J. Magn. Soc. Jpn. 38, 79, doi:10.3379/msjmag.1404R001
  • Ramesh R., Thomas G., Ma B.M. 1988, J. Appl. Phys., doi:10.1063/1.342055 (abstract only)
  • Tomše T. et al. 2024, IEEE Trans. Magn. 60, 2100406, doi:10.1109/TMAG.2024.3417611
  • Hono K., Sepehri-Amin H. 2012, Scripta Mater., doi:10.1016/j.scriptamat.2012.06.038 (review)
  • Li J. et al. 2021, Sci. Technol. Adv. Mater., doi:10.1080/14686996.2021.1916377 (review)
  • Harris I.R., McGuiness P.J. 1991, J. Less-Common Met. 174 (review; cited, not read)
  • Checa Fernández et al. 2023, J. Mater. Res. Technol. (open access; abstract only)

Functions

pm.predict(route, n_draws=4000, seed=0, rho_observed=None, rho_scenario=None) → dict with:

  • outputs[name] for density_rel, grain_um, Hci_kOe, Br_kGs, Hk_over_Hci, BHmax_MGOe, each with: median, mean, sd, q05, q25, q75, q95 (floats), quantiles (dict q01, q025, q05, q10, q25, q50, q75, q90, q95, q975, q99), mu_ln and sd_ln (a quantile-matched log-normal approximation over the positive draws), lognormal_adequate (bool) and lognormal_max_log_error (largest |ln q − (mu_ln + z_q·sd_ln)| over q05–q95; adequate below 0.25; null / false when fewer than 10 draws are positive or a central quantile is ≤ 0), frac_nonpositive, by_mechanism (dict mechanism → {median, q05, q95, n}), by_load_timing (magnetic outputs: dict explanation → {median, q05, q95, n}), posterior_to_prior_spread_ratio (squared IQR ratio, log scale except density and Hk/Hci), between_mechanism_share, prior_dominated, mechanism_dominated, conditioned_on_observed_density, density_scenario_declared (bools).
  • outputs["density_g_cm3"] carries the summary statistics and quantiles only.
  • Recording a forecast: record the quantiles, not mean ± sd. The magnetic predictives are skewed mixtures over mechanisms, load-timing explanations and degassing states. forecast_record() returns a ready-to-store record.
  • flag_rules (text) states how the flags are computed.
  • out_of_hull: {"density": {...}, "magnetic": {...}}, each with distance (standardised), out_of_hull (bool) and outside_features (declared scenarios outside every record, such as pressure_mode=dwell, current_path=insulated and degas_completeness=complete, are listed here and set out_of_hull).
  • mechanism_weights: nested, {"density": {"D1": w, ...}, "magnetic": {"H1": w, ...}, "load_timing": {"trap": w, "load": w, "current": w}}.
  • ceilings, objective and scenarios (alignment_cos, T_measure_C, degas_occurrence_probability, degas_completeness, degas_extrapolation_beyond_fitted_state, degas_complete_declared, current_path, pressure_mode_dwell_declared, and calibrated: true only at isotropic alignment, 20 °C, completeness 0 or 1, a current-carrying compact and load in heating or on cooling).
  • rho_observed (g/cm³ or relative): conditions the magnetics on a measured density (an existing body; a fixed 0.005 relative spread). For a body not yet made, pass rho_scenario={"mean": .., "sd": ..} (g/cm³ if the mean is above 1.5, else relative): the magnetics then carry that density uncertainty. Passing both raises an error. With rho_observed the result carries a rho_observed_note.
  • Predictions are for a measured new body (specimen-to-specimen and measurement scatter included).

pm.p_meets_spec(route, spec, n_draws=6000, seed=0, rho_observed=None, rho_scenario=None) → posterior probability that one body meets the spec. Spec keys (all optional, at least one): Hci_kOe_min, BHmax_MGOe_min, Br_kGs_min, density_rel_min, T_operating_C; an unknown key or a non-numeric value raises an error. Returns p_meets_spec, monte_carlo_se, marginals (per spec key), by_magnetic_mechanism, by_load_timing, mechanism_weights (flat, magnetic only), load_timing_weights, prior_predictive_p, prior_dominated, out_of_hull, no_draw_meets_spec (true when no posterior and no prior-predictive draw meets the spec; then p_upper_95 = 3 / n_draws is a 95 % upper bound on the probability, and prior_dominated reads false), scenario_not_calibrated, scenarios.

pm.forecast_record(route, body_id=None, rho_observed=None, n_draws=8000, seed=0, outputs=("density_rel", "Hci_kOe", "Br_kGs", "BHmax_MGOe", "Hk_over_Hci"), rho_scenario=None) → a committed-forecast record (schema ndfeb-forecast-record-v1): body_id (your neutral identifier), the resolved route, scenarios, conditioning (rho_observed, rho_scenario), per output quantiles, mu_ln, sd_ln, lognormal_adequate, lognormal_max_log_error, median, frac_nonpositive and the flags, out_of_hull, mechanism_weights, n_draws, seed, quantile_levels, units, tool_version and artifact_sha256. It is deterministic for a given seed and strictly JSON-serialisable.

Hydrogen measurements ("H_ppm" in eig) are modelled on the model's residual-hydrogen index of the sintered body (1 = the hydrogen of non-degassed powder; pore closure follows the load mode), with a declared log-sd of 0.25 and a declared detection limit of 0.01 on that index: a body below it, such as one made from completely degassed powder, reads at the limit. Both numbers are assumptions, not calibrations.

pm.eig(candidates, n_outer=1500, n_inner_per_mechanism=None, seed=0, target=None, goal=None, method="v4") ranks candidate experiments by expected information gain (EIG, in nats). Each candidate is {"name": str, "measurements": [...]}, and each measurement is one body: {"route": {...}, "rho_observed": optional, "quantities": [...], "replicates": 1}. Quantities come from "Hci", "Br", "sq" (Hk/Hci), "density", "grain" (SEM), "H_ppm" (hydrogen content) and "Hci_ratio_T". "Hci_ratio_T" is the same body measured at 20 °C and at "T2_C" (default 120). Requested with "Hci" in the same measurement, the two are modelled jointly. The default quantities are ["Hci", "Br", "sq"], and unknown quantity names raise an error.

Several bodies made by the same route share that route's latent values but each has its own specimen effect. Routes that use the same prep share its preparation effect, degas state and feedstock, so they must share degas_completeness and feedstock_d50_um. A design is written as one measurement per body. Each powder batch gets its own prep label (any label other than the fitted ones is a distinct new preparation), so arms that differ in degassing or feedstock carry different labels. The call syntax, shown for two bodies that differ in one input (an illustration, not a recommended experiment):

design = {"name": "syntax example", "measurements": [
    {"route": {"T_peak_C": t, "prep": "new-a"}, "quantities": ["Hci", "density"]} for t in (750, 800)]}
out = pm.eig([design], n_outer=400, seed=0)
out["ranking"][0]["eig_load_timing_nats"], out["ranking"][0]["eig_magnetic_mechanism_nats"]

Hci, Br, Hk/Hci and Hci_ratio_T are modelled at 20 °C, so a route with T_measure_C ≠ 20 raises an error for those quantities. For a hot reading, use Hci_ratio_T with T2_C.

Indicators. EIG is reported for every discrete indicator in mechanism_weights: the magnetic and density mechanisms, and any other (for example load_timing). The keys are eig_magnetic_mechanism_* and eig_density_mechanism_* (the v3.1 names), and eig_<indicator>_* for any other indicator. eig_indicators[name] holds the same numbers for every indicator under uniform keys. An indicator that nothing in the design depends on reports exactly 0 (structural_zero). For example, the density mechanism gets 0 when every body has a measured density and no density is measured.

What the number means. eig_<indicator>_nats is the information the design is expected to give about the indicator. Two cases:

  • When the bracket is closed (eig_<indicator>_bracket_closed, typical for one or two bodies), the value is the nested estimate, H(current weights) minus the expected entropy of the updated weights, clipped into the bracket [lower bound, upper] (value_clipped_to_bracket in eig_indicators says when the clip was applied). It agrees with the v3.1 estimator within Monte Carlo error.
  • Otherwise the value is a lower bound, max(eig_<indicator>_lower_bound, 0): the design gains at least this much information about the indicator.

The lower end is the largest of three bounds computed on the same simulated outcomes, each of which holds however rough its posterior is (lower_bound_source names the one used):

  • the exact nested posterior over the stored draws, with the outcome's own stored draw left out (v3.1's exclude-own estimate, made leave-out);
  • a classifier trained on outcomes simulated from the other half of the stored draws;
  • the two pooled by how many stored draws fit the outcome.

eig_<indicator>_se is the SE of the value and eig_<indicator>_lower_bound_se the SE of the bound. The most any design can gain is the entropy of the current weights (eig_indicators[name]["prior_entropy_nats"]).

How far to trust it.

  • eig_<indicator>_lower_bound_stable, also given as eig_<indicator>_converged, is true when two independent halves of the calculation agree within 2 combined SE. Each half uses its own simulated outcomes and a classifier trained on the other half's stored draws. all_converged is true when every lower bound in the result is stable.
  • eig_<indicator>_bracket is [lower bound, upper end]. The upper end uses the v3.1 estimate with the outcome's own draw included, so it runs high. The bracket is closed when |upper − lower| ≤ max(0.05, 2 SE), v3.1's rule.
  • For designs with several bodies across routes, the bracket stays open, and more inner draws do not close it. The stored posterior holds about 2,000 draws per mechanism. A multi-body design pins the route-level values more tightly than those draws are spaced, so no estimator built on them can bound the EIG from above. Rank such designs by the lower bound.
  • Monte Carlo spread: the SE (about 0.02 nats for a lower bound, about 0.008 for a closed nested estimate) covers the simulated outcomes within one run. A different seed redraws which stored draws generate the outcomes, and that shifts every design's value by about 0.03–0.05 nats in the same direction. Compare designs within one call or with the same seed. A difference smaller than about 3 SEs, or 0.05 nats across seeds, is not resolved; a larger n_outer lowers both in proportion to 1/√n_outer.
  • Nested designs: adding bodies to the same routes, or quantities to the same bodies, should not lower the bound. In the tests on this posterior it held within 3 combined SE; adding grain and H_ppm to two bodies at each of three routes once lowered the bound by 0.07 nats.
  • Lower bounds from different designs can still sit below their true EIGs by somewhat different amounts. For example, adding grain and H_ppm to two bodies per route lowered the bound by up to 0.07 nats. The classifier captures smooth relations between per-route summaries, and information in a strongly nonlinear joint relation (H_ppm against Hci under the hydrogen mechanism) may be under-credited. Treat a lead of under 0.05 nats between designs of very different size or quantity mix as provisional.
  • Difference from v3.1 on informative designs: v3.1's inner set contains copies of the stored draw that generated each simulated outcome. Its brackets therefore close at the EIG for a world that is exactly one of the stored draws, which credits a design for identifying a single stored draw. v4 leaves the generating stored draw out, because the real material is not one of the stored draws. It still reports the v3.1-style value with the copies kept, as stored_draw_bracket, stored_draw_nats and stored_draw_closed in eig_indicators. On informative multi-body designs that value sits above v4's lower bound, because it credits identifying a stored draw.

Other outputs per candidate.

  • eig_all_parameters_nats and _se (a lower bound).
  • expected_posterior_<indicator>_weights, p_identify_<indicator>_mechanism_map and its _bracket (magnetic and density).
  • ln_Hci_sd_target_now and ln_Hci_sd_target_expected_after at target (a route; default the first measured route), and ln_Hci_sd_reduction_target. The expected-after value is an upper bound (a held-out prediction error), so the reduction is conservative.
  • ess_inner_median: the effective number of inner draws that fit a simulated outcome. Values below about 20 mean the value comes mainly from the classifier.
  • orderings lists the candidate names under every metric.

Goal option. goal={"route": {...}, "spec": {...}, "rho_observed": optional} uses the spec keys of p_meets_spec (Hci_kOe_min, BHmax_MGOe_min, Br_kGs_min, density_rel_min, T_operating_C), and unknown keys raise an error. Let G = 1 if the next body made by the goal route meets the spec, scored on measured values as in p_meets_spec. For one posterior draw (parameters and shared latent values), p = P(G = 1 | draw).

  • Aleatoric: body-to-body and measurement scatter make G uncertain even when the draw is known. No experiment removes it: aleatoric_entropy_nats = average over draws of H(p).
  • Epistemic: p itself is uncertain because the draw is uncertain: p_success_epistemic_sd_now = sd of p over the posterior, and epistemic_entropy_nats = event_entropy_nats − aleatoric_entropy_nats, where event_entropy_nats = H(p_success_now). This is the most any experiment can gain about G.
  • goal.eig_event_nats, also given as eig_goal_event_nats, is a lower bound on the information the experiment gives about G. goal.eig_event_bracket = [lower bound, epistemic entropy]; the upper end is a true upper bound.
  • p_success_epistemic_sd_expected_after is the expected sd of p after the experiment, an upper bound.
  • expected_posterior_p_success_quantiles gives the spread of the updated success probability over the possible outcomes. It is approximate and shrinks toward the current value where the approximation is weak.
  • When no draw meets the spec, no_draw_meets_spec is true and every goal information measure is 0.

Runtime and options. At the defaults (n_outer 1500, n_inner_per_mechanism 4000) in the science image with 8 threads on a busy host, a single-body candidate takes about 4 s. A candidate with 6 to 12 bodies over 3 or 4 routes takes about 10–25 s, and the goal option adds little. Results are deterministic for a given seed. method="nmc-v3.1" runs the earlier estimator unchanged, for comparison. It has no goal option, and it refuses a posterior that carries a per-draw indicator beyond the two mechanisms (for example load_timing). H_ppm and Hci_ratio_T use declared, uncalibrated measurement models, so their EIGs are conditional on those assumptions.

Example: pm.eig([{"name": "two bodies, 800 C", "measurements": [{"route": {"T_peak_C": 800}, "quantities": ["Hci", "Br", "sq", "density"]}] * 2}], goal={"route": {"T_peak_C": 800}, "spec": {"Hci_kOe_min": 10, "density_rel_min": 0.95}}).

pm.condition(observations, k_latent=32, seed=12345) → (updated_model, info): importance-reweights the stored draws by a list of new observations, one dict per new body (e.g. [{"route": {...}, "rho_observed": 6.0, "Hci_kOe": 3.1, "Br_kGs": 5.0}]; optional keys Hci_kOe, Br_kGs, Hk_kOe, density_rel, grain_um, rho_observed). A magnetic observation needs the body's measured density (rho_observed or density_rel); without it the call raises an error. Routes may carry degas, degas_completeness and current_path; the completeness of one preparation is shared by its observations. The mechanism weights and the load-timing weights are both updated (info["mechanism_weights"]["load_timing"]). info["ess_per_mechanism"] below ~200 for a mechanism that still carries weight means a refit is needed.

Density observations in condition(). A measured density updates the density module only when it is given as density_rel: the relative density, a fraction of 7.62 g/cm³ (a value above 1.5 is read as g/cm³ and divided by 7.62). In condition(), rho_observed is only the measured density that the body's magnetic quantities (Hci_kOe, Br_kGs, Hk_kOe, grain_um) are conditioned on; it does not update the density module. An observation that carries only rho_observed and no magnetic quantity updates nothing. A density-only observation:

dens_model, dens_info = pm.condition([{"route": {"T_peak_C": 800, "prep": "new"}, "density_rel": 0.70}], k_latent=8)
dens_info["mechanism_weights"]["density"], pm.w["density"]
dens_model.predict({"T_peak_C": 800, "prep": "new"})["outputs"]["density_rel"]["median"]

Example

The examples show call syntax only; they are not recommended experiments.

r = pm.predict({'T_peak_C': 800, 'prep': 'PREP-C800'}, rho_scenario={'mean': 6.2, 'sd': 0.3})
r['outputs']['Hci_kOe']['quantiles']['q05'], r['outputs']['Hci_kOe']['quantiles']['q95']
r['outputs']['Hci_kOe']['prior_dominated'], r['out_of_hull']['magnetic']['out_of_hull']
d = {'T_peak_C': 850, 'heating_rate_C_per_min': 10, 'dwell_min': 10, 'P_MPa': 50, 'pressure_mode': 'heating'}
std = pm.predict(d, rho_scenario={'mean': 7.45, 'sd': 0.05})['outputs']['Hci_kOe']['by_load_timing']
full = pm.predict(dict(d, degas_completeness='complete'), rho_scenario={'mean': 7.45, 'sd': 0.05})
full['outputs']['Hci_kOe']['by_load_timing']['trap']['median'], std['trap']['median']
pm.p_meets_spec({'T_peak_C': 850, 'pressure_mode': 'heating', 'P_MPa': 50},
                {'Hci_kOe_min': 20, 'BHmax_MGOe_min': 45, 'T_operating_C': 120})
rec = pm.forecast_record({'T_peak_C': 800, 'degas_completeness': {'distribution': 'uniform', 'low': 0.85, 'high': 1.0}},
                         body_id='body-x', rho_scenario={'mean': 6.2, 'sd': 0.3})
rec['outputs']['Hci_kOe']['quantiles']['q05'], rec['outputs']['Hci_kOe']['quantiles']['q95']
m = pm.predict({'T_peak_C': 850, 'prep': 'new-milled', 'feedstock_d50_um': 2.0},
               rho_scenario={'mean': 7.4, 'sd': 0.1})
m['feedstock']['status'], m['outputs']['grain_um']['median'], m['outputs']['Hci_kOe']['median']