Skip to content

API — nefi.baselines

Generated by scripts/gen_api_docs.py — do not edit by hand. Index

nefi.baselines

Baseline parameterizations and solvers (NeTMY App. E.2, NeFTY App. F.2).

def baseline_problem(problem: InverseProblem, kind: str, *, curriculum: Curriculum | None = None, lr: float | None = None, steps: int | Sequence[int] | None = None, heads: str |...

Swap the parameterization of problem for a baseline one.

def solve(problem: InverseProblem, curriculum: Curriculum | None = None, **solver_kw: Any) -> Result

Run a (baseline) problem with the solver it asks for.

nefi.baselines.admm

ADMM with an ℓ1 + box proximal split — the ADMM baseline (NeTMY App. E.2; Boyd et al. 2011).

class ADMMConfig(mu: float = 0.001, l1: float = 0.01, lo: float | None = 0.0, hi: float | None = None, lr: float = 0.005, n_inner: int = 30, max_outer: int = 200, tol: float...

Settings of :class:ADMMSolver (defaults: NeTMY App. E.2).

class ADMMSolver(problem: InverseProblem, config: ADMMConfig | Mapping | Curriculum | None = None, *, curriculum: Curriculum | None = None, device: str | torch.device = 'aut...

Variable-splitting ADMM solver with the same call shape as :class:~nefi.solve.Solver.

  • run(self) -> Result — Run ADMM to convergence / budget and return a :class:~nefi.solve.Result.

def prox_l1_box(v: torch.Tensor, threshold: float, lo: float | None, hi: float | None) -> torch.Tensor

argmin_z threshold·|z| + ½(z - v)² + ι_[lo,hi](z) (soft threshold, then clip).

nefi.baselines.deep_decoder

Untrained convolutional decoder prior — the DeepDecoder baseline (Heckel & Hand 2018).

class ChannelNorm(channels: int, eps: float = 1e-05)

Per-channel standardization over the spatial dims with a learnable affine map.

  • forward(self, x: torch.Tensor) -> torch.Tensor
  • reset_parameters(self)

class DeepDecoderField(shape: Sequence[int], heads: Heads | Mapping | None = None, n_stages: int = 5, width: int = 128, channels: Sequence[int] | None = None, latent_shape: Sequen...

Deep Decoder field (Heckel & Hand 2018; NeTMY App. E.2 baseline).

  • decode(self) -> torch.Tensor — Native decoder output (n_in, *shape).
  • extra_repr(self) -> str
  • raw(self, coords: torch.Tensor, progress: float = 1.0) -> torch.Tensor
  • reset_parameters(self) — Re-draw the 1×1 convolutions (global RNG); the latent input stays fixed.

def stage_sizes(latent: Sequence[int], shape: Sequence[int], n_stages: int) -> list[tuple[int, ...]]

Geometric size schedule from latent to shape over n_stages upsamplings.

nefi.baselines.direct

Non-iterative reference reconstructions (FBP, Wiener, ...) reported as a regular Result.

class DirectSolver(problem: InverseProblem, config: Reconstruct | None = None, *, curriculum: Curriculum | None = None, device: str | torch.device = 'auto', dtype: torch.dtype...

Evaluate a closed-form reconstruction reconstruct(measurement, domain).

  • run(self) -> Result — Evaluate the reconstruction once and package it as a :class:~nefi.solve.Result.

nefi.baselines.gaussian_splat

Explicit Gaussian-splat parameterization — the GaussianSplat baseline (NeTMY App. E.2).

class GaussianSplatField(ndim: int, heads: Heads | Mapping | None = None, n_primitives: int = 64, max_primitives: int = 128, init: str = 'grid', init_sigma: float | None = None, ini...

Sum of anisotropic Gaussian primitives rendered onto the query grid (NeTMY App. E.2).

  • add(self, means: torch.Tensor, sigmas: torch.Tensor, amps: torch.Tensor) -> torch.Tensor — Place new primitives into free slots (as many as fit); returns their slot indices.
  • amplitudes (property) — Amplitudes (K_max, C) (inactive slots included; see :attr:active).
  • deactivate(self, idx: torch.Tensor)
  • extra_repr(self) -> str
  • free_slots(self) -> torch.Tensor — Indices of inactive slots, longest-inactive first (limits stale optimizer moments).
  • means (property) — Positions (K_max, d) in normalized coordinates.
  • n_active (property)
  • raw(self, coords: torch.Tensor, progress: float = 1.0) -> torch.Tensor
  • reset_parameters(self) — Re-initialize the first n_primitives slots (active) and clear the rest.
  • set_primitives(self, means: torch.Tensor, sigmas: torch.Tensor, amps: torch.Tensor) — Replace the whole primitive set (len(means) <= max_primitives).
  • sigmas (property) — Per-axis widths (K_max, d) in normalized units.
  • write(self, idx: torch.Tensor, means: torch.Tensor, sigmas: torch.Tensor, amps: torch.Tensor) — Set slots idx to the given primitives and mark them active.

class SplatControl(every: int = 100, start: int = 100, stop_fraction: float = 0.8, grad_quantile: float = 0.8, grad_threshold: float = 0.0, split_sigma_cells: float = 2.0, spl...

Adaptive density control for :class:GaussianSplatField (Kerbl et al. 2023 §5).

  • accumulate(self, grad_mu: torch.Tensor) — Accumulate per-slot positional gradients ∂L/∂μ (K_max, d) of one step.
  • apply(self, field: GaussianSplatField | None = None) -> dict — Run one prune / split / clone (/ merge) round now; returns counts.
  • on_run_start(self, solver)
  • on_stage_start(self, solver, stage_idx, stage)
  • on_step(self, solver, state)

def axis_factor(v: torch.Tensor, mu: torch.Tensor, sigma: torch.Tensor, h: float | None) -> torch.Tensor

Per-axis Gaussian factor (n, K): point-sampled (h=None) or cell-averaged.

def grid_axes(coords: torch.Tensor) -> list[torch.Tensor] | None

Return the 1-D axis vectors if coords is a tensor-product (meshgrid) grid, else None.

nefi.baselines.lbfgs

L-BFGS curricula — the quasi-Newton free-density reference (NeTMY App. E.2, §5.3).

def lbfgs_curriculum(shape: Sequence[int] | None, steps: int | Sequence[int] = 100, lr: float = 1.0, history: int = 20, max_iter: int = 20, *, n_stages: int = 1, anneal: bool = ...

Curriculum running torch.optim.LBFGS with a strong-Wolfe line search.

nefi.baselines.thermography

Classical pulsed-thermography heuristics: PPT and TSR (NeFTY App. F.4).

def contrast_mask(contrast: torch.Tensor, k: float = 2.0) -> torch.Tensor

Binary defect mask |c − median(c)| > k · 1.4826 · MAD(c) (robust noise floor, App. H).

def depth_to_alpha_volume(depth: torch.Tensor, mask: torch.Tensor, nz: int, thickness: float, alpha_bulk: float, alpha_defect: float, defect_thickness: float | None = None, z_coords:...

Lift a 2-D depth map + mask to a volumetric diffusivity field (H, W, nz).

def ppt(frames: torch.Tensor, dt: float, alpha: float, *, c1: float = 1.82, mode: str = 'peak', freq_range: tuple[float, float] | None = None, reference: torch.Tens...

Pulsed Phase Thermography depth map from surface frames (n_t, H, W).

def tsr(frames: torch.Tensor, dt: float, alpha: float, *, order: int = 5, c2: float = 1.8, t0: float | None = None, mask_k: float = 2.0, eps: float = 1e-12) -> dict...

Thermographic Signal Reconstruction depth map from surface frames (n_t, H, W).