The world-model paradigm¶
Every modality in pySRX is described by the same three pieces.


One fitting step on a synthetic cell, with the real fitted Elyra lattice; switch the tabs to change the model. Both methods share the measured phases, the forward pass \(H\) and the Poisson loss, and both loop back from the loss to update the model: only the representation of the sample differs. Classical methods store it explicitly, as a grid with one free number per voxel, and each Richardson-Lucy or MAP step moves every voxel separately. The world model stores it implicitly, as the weights of a network \(x_\theta\) that returns a value at any point; the weights are shared, so each gradient step changes many points at once, coherently, and there is no grid until you ask for one.
1. A forward operator. A linear operator \(H\) maps the sample (the "world", a 3D fluorescence density \(x\)) to the expected raw data. For the light field, \(H\) produces the 37 sub-aperture views; for lattice SIM it will produce the raw phases and orientations. With a constant background \(b\) the expected data are
\(H\) is built from the optics (pysrx.optics: PSFs per view or per illumination pattern) and applied by
pysrx.forward with a matching adjoint \(H^{\top}\), both z-chunked FFT convolutions on the GPU.
2. A Poisson likelihood. Photon counts are Poisson, \(y \sim \mathrm{Poisson}(Hx + b)\), so reconstruction minimises the negative log-likelihood \(\sum_i \left[(Hx + b)_i - y_i \log (Hx + b)_i\right]\), optionally with a regulariser such as total variation.
3. A reconstruction. Two families share the same operator.
-
Classical solvers (
pysrx.solvers). Richardson-Lucy is the multiplicative EM update for this likelihood,\[ x^{(k+1)} = \frac{x^{(k)}}{H^{\top} \mathbf{1}} \, H^{\top}\!\left(\frac{y}{H x^{(k)} + b}\right), \]with an optional TV term; the MAP solver optimises the same objective with gradients.
-
The world model (
pysrx.field). Instead of a voxel grid, \(x\) is a continuous neural field \(x_\theta(\mathbf{r})\): any differentiable function of position works. pySRX currently uses a multi-resolution hash grid and a small MLP, chosen for speed; it is one choice, not part of the idea. The field is rendered on the operator's grid, pushed through the same \(H\), and \(\theta\) is fitted by the same Poisson loss. Because the field only sees the data through \(H\), any modality with a forward operator gets a neural-field reconstruction for free, and the field can be resampled at any resolution afterwards.
Why a world model, and not only a classical solver¶
The classical methods above hit two limits on real samples.
- One PSF everywhere. Wiener filtering and the FFT form of Richardson-Lucy divide or convolve in Fourier space, which is exact only when the PSF is the same at every point. In a cell it is not (above). With a differentiable forward pass, \(H\) can hold a PSF that changes with position, and its parameters (aberrations, the pattern, the background) can be fitted together with the sample, because the gradient reaches them too.
- Noise. On a voxel grid every voxel is free, so the solver also fits the photon noise. The only defences are stopping early or a penalty such as TV, and both are tuned by hand and blur real detail along with the noise. A neural field shares its weights between neighbouring points and learns smooth, coarse structure before fine detail, so noise that no smooth structure explains is fitted last. Fine detail that the data support still comes through \(H\).
What pySRX has today: the operator, the Poisson loss, fitted SIM patterns, per-view light-field PSFs and a fitted haze term. What it does not have yet: a PSF that varies across the field, or aberrations fitted from the data.
Why not a U-Net or a diffusion model¶
Learned image-to-image networks (CARE, DFCAN and other U-Nets; diffusion models) map a raw image to a clean one in one pass. They are fast and often look convincing, but for measurement they have problems the world model avoids:
| U-Net or diffusion model | World model | |
|---|---|---|
| Training data | many pairs of low- and high-resolution images of similar samples | none: fitted to this one measurement |
| Physics | learned implicitly from the training pairs | written explicitly in \(H\) (optics, pattern, noise) |
| A new microscope, sample or PSF | out of distribution; retrain | change \(H\) |
| New detail | can be invented from the training set (hallucination) | must explain the measured photons through \(H\) |
| Checking the result | no likelihood to check against | held-out deviance and FRC on the data itself |
A diffusion model can also serve as a prior inside a physics loss, but that prior is still learned from other images. pySRX keeps the reconstruction answerable to the photons of this measurement.
Is the world model a PINN?¶
It is a close relative. A physics-informed neural network (PINN; Raissi et al., 2019) is also a coordinate network, \((x, y, z) \to\) value, trained without a training set. The difference is where the physics sits:
- A PINN adds the residual of a differential equation (for example diffusion or the wave equation), evaluated at sampled collocation points, to a data loss. The physics is a soft penalty that the network is pushed towards.
- The world model puts the physics into the forward pass: the field goes through the known operator \(H\) (PSFs, illumination, camera), and the only loss is the Poisson likelihood of the measured photons. The physics holds exactly at every step.
So the world model belongs to the same family as NeRF and other physics-based neural fields for inverse problems: a coordinate network, a differentiable image-formation model, and self-supervision from the measurement. It would become PINN-like if light propagation through the sample, such as scattering in an uneven medium, were added as an equation residual instead of a precomputed PSF.
Why one operator for everything¶
- Physics in one place. Calibration (lenslet geometry, defocus groups, illumination patterns) lives in the operator, not in each solver.
- Fair comparisons. RL, MAP and the neural field differ only in the prior, so differences in the metrics are differences in the reconstruction, not in the model.
- In-silico ground truth.
pysrx.simulateruns \(H\) forward on a reference volume (for example a registered confocal Nyquist stack) with a camera noise model, giving data whose answer is known.
Measuring the result¶
pysrx.metrics evaluates reconstructions on single optical sections with the same normalisation for every method:
resolution (FRC, self-FRC, decorrelation), fidelity against a reference (nMSE, PSNR, SSIM, PCC, MI), sharpness
(Tenengrad), noise and axial extent.