Diagnostics¶
The diagnostics subpackage provides synthetic diagnostic instruments for virtual tokamak experiments, enabling end-to-end validation of the measurement-reconstruction-control pipeline without access to a physical device.
Synthetic Sensors¶
The synthetic_sensors module (synthetic_sensors.py) implements
the SensorSuite class, which generates synthetic measurement signals
from the plasma state:
Magnetic diagnostics:
Rogowski coil (plasma current \(I_p\))
Diamagnetic loop (stored energy \(W_\text{dia}\))
Magnetic flux loops (poloidal flux \(\psi\) at probe locations)
Mirnov coils (magnetic fluctuation \(\delta B_\theta\))
Kinetic diagnostics:
Thomson scattering (electron temperature \(T_e(\rho)\) and density \(n_e(\rho)\) profiles)
Interferometer (line-integrated electron density \(\int n_e \, dl\))
Bolometer (radiated power \(P_\text{rad}\))
Neutron diagnostics:
Neutron flux monitor (fusion reaction rate)
Activation foils (neutron spectrum unfolding)
Each sensor model includes configurable noise characteristics (Gaussian noise, systematic offsets, calibration drift) for realistic synthetic data generation.
Forward Diagnostic Models¶
The forward module (forward.py) provides physics-based forward
models that compute what a real diagnostic would measure given a known
plasma state:
Interferometer phase shift:
where the integral is along the line of sight (LOS) through the plasma.
Neutron count rate:
where \(\Omega(\mathbf{r})\) is the solid angle subtended by the detector from position \(\mathbf{r}\).
The ForwardDiagnosticChannels class bundles multiple diagnostic
channels into a single forward-model evaluation, suitable for feeding
into inverse reconstruction algorithms.
Soft X-Ray Tomography¶
The tomography module (tomography.py) implements the
PlasmaTomography class for soft X-ray (SXR) tomographic inversion:
Given a set of line-integrated SXR brightness measurements:
where \(\varepsilon(R, Z)\) is the local SXR emissivity and \(\eta_i\) is measurement noise, the tomographic inversion recovers the 2D emissivity field by solving:
where \(\mathbf{T}\) is the geometry matrix (line-of-sight integrals through the grid), \(\lambda\) is the Tikhonov regularisation parameter, and \(\mathbf{L}\) is a smoothness operator.
The implementation uses SciPy’s sparse linear algebra (scipy.sparse.linalg)
with automatic fallback for environments where SciPy is not optimised.
Diagnostic Runner¶
The run_diagnostics module (run_diagnostics.py) provides a
convenience function for running a full diagnostic suite against a
plasma state. This is used in the diagnostics simulation mode:
scpn-fusion diagnostics
The runner generates synthetic measurements, applies noise, performs tomographic inversion, and reports reconstruction quality metrics.