Skip to content

ramansep 0.6.0: joint Bayesian map inversion with spatial priors, Voigt fitter

Latest

Choose a tag to compare

@Tanvir-Mahmud-Mahim Tanvir-Mahmud-Mahim released this 05 Sep 15:54
f0477fe

Completes the roadmap: the v0.6 item -- joint Bayesian inversion with spatial priors -- plus the Voigt fitter previously documented as out of scope.

Joint Bayesian map inversion (bayesian_map_inversion)

  • The per-pixel GLS treats every pixel alone; physically, strain and doping fields vary smoothly on the pixel scale. That knowledge is made explicit as a Gaussian Markov random field prior (Rue & Held 2005) on both fields, independently weighted (lam_strain, lam_density), and the joint MAP problem is solved exactly as one sparse linear system on the 4-neighbor pixel lattice with Neumann boundaries.
  • Exact per-pixel posterior sigmas on request; the dense inverse is refused above max_dense unknowns rather than approximated silently.
  • Because the estimator is linear-Gaussian its behavior is provable, and the tests assert it instead of trusting it: lam = 0 reproduces MultiModeModel.invert's maps and sigmas to machine precision; a spatially constant noiseless truth is recovered exactly at every lam (the prior vanishes on constants); the lam -> infinity limit equals the independently computed pooled precision-weighted GLS; posterior sigmas shrink monotonically with lam (adding a PSD precision term shrinks the covariance in the Loewner order) -- asserted pixel by pixel.

Voigt fitter (fit_voigt, voigt, VoigtFit)

  • Voigt lineshape via the Faddeeva function scipy.special.wofz, peak-height normalized, fitted by the same Levenberg-Marquardt loop as fit_lorentzian with the analytic Jacobian built from w'(z) = 2i/sqrt(pi) - 2 z w(z).
  • Anchors: gamma = 0 is the Gaussian exactly (< 1e-14 pointwise -- an identity of the Faddeeva function); sigma -> 0 converges linearly to the Lorentzian of half-width gamma; the analytic Jacobian matches finite differences; noiseless lines are recovered to 1e-8 from automatic starting values.

Deliberate scope (designed out, with reasons -- see README)

  • The smoothness weights are user-chosen regularization, not estimated hyperparameters: full hierarchical inference would need noise assumptions this package refuses to invent.
  • No shipped coefficient values beyond the cited example sets; the stated prior graph rather than a tunable kernel zoo.

44 tests, Python 3.9/3.11/3.12/3.13. Install: pip install ramansep.