pysdic.workflows.compute_elements_residual_rms#
- compute_elements_residual_rms(analysis, integration_points, residuals, *, threshold=3.0)[source]#
Compute the RMS of the residuals of each element in each pairing, and detect the badly correlated elements (reflections, occlusions, damaged speckle, …).
For an element \(e\) and a pairing, with the points \(p \in e\) whose residuals are finite in all the channels, of weights \(w_p\):
\[\text{RMS}_e = \sqrt{\frac{\sum_{p \in e} w_p \sum_c r_{p,c}^2}{C \sum_{p \in e} w_p}}\]An element is an outlier of a pairing if its RMS is far above the RMS of the other elements of the pairing, with a robust estimate of their spread (median and median absolute deviation, MAD):
\[\text{RMS}_e > \text{med} + k \times 1.4826 \, \text{MAD}\]with \(k\) the
threshold. The elements without finite residual are not outliers (their RMS is NaN).- Parameters:
analysis (
pysdic.SDICAnalysis) – The analysis (its mesh gives the elements).integration_points (
pysdic.IntegrationPoints) – The integration points of the residuals.residuals (Sequence[
pysdic.PairingResiduals]) – The residuals of the pairings, computed withintegration_points(seepysdic.compute_residuals()orpysdic.SDICCorrelationTerm.compute_residuals()).threshold (Real, optional (default:
3.0)) – The number \(k\) of robust standard deviations above the median.
- Returns:
The RMS per element and per pairing, and the outliers.
- Return type:
- Raises:
ValueError – If the residuals do not match the integration points.
Examples
from pysdic.workflows import compute_elements_residual_rms quality = compute_elements_residual_rms(analysis, integration_points, correlation.compute_residuals()) for pairing, rms in zip(quality.pairings, quality.pairing_rms): print(f"{pairing}: RMS {rms:.2f}") print(f"Badly correlated elements: {quality.bad_elements}")