pysdic.PairingResiduals#
The pysdic.PairingResiduals stores the gray levels and the residuals of the material points (integration
points of the mesh) in the two views of a pysdic.Pairing, as compared by a
pysdic.SDICCorrelationTerm (gray level correction included, without the weights of the points):
with \(g'_k\) the gray levels of the view \(k\) after the gray level correction (the raw gray levels without correction).
PairingResiduals class#
- class PairingResiduals(pairing, gray_levels_1, gray_levels_2, residuals, image_points_1, image_points_2, displacement_1, displacement_2, gl_correction=None)[source]#
Bases:
objectThe gray levels and the residuals of the material points (integration points of the mesh) in the two views of a pairing, as compared by
pysdic.SDICCorrelationTerm(gray level correction included, without the weights of the points).\[r_p = g'_2(\vec{X}_p) - g'_1(\vec{X}_p)\]with \(g'_k\) the gray levels of the view \(k\) after the gray level correction (the raw gray levels without correction).
Returned by
pysdic.compute_residuals()(current state of the analysis) andpysdic.SDICCorrelationTerm.compute_residuals()(state given by a vector of unknowns). Used bypysdic.compute_pixel_residual_maps()andpysdic.display_residual_maps().- Parameters:
- pairing#
The two views.
- Type:
- gray_levels_1, gray_levels_2
The (corrected) gray levels in the two views, shape \((N_p, C)\). NaN for the points projected out of the ROI of an image.
- Type:
- residuals#
gray_levels_2 - gray_levels_1, shape \((N_p, C)\).- Type:
- image_points_1, image_points_2
The projections \((x, y)\) of the points in the two views (pixels), shape \((N_p, 2)\).
- Type:
- displacement_1, displacement_2
The displacements \((N_v, E)\) of the frames of the two views used for the evaluation.
- Type:
Instantiation#
A PairingResiduals is a frozen dataclass returned by the functions below, not created by the user:
pysdic.compute_residuals(): the residuals of a pairing for the current state of the analysis, with or without gray level correction;pysdic.SDICCorrelationTerm.compute_residuals(): the residuals of the pairings of a term for the state given by a complete vector of unknowns \(\vec{p}\) (by default the current state of the analysis), with the gray level correction of the term.
from pysdic import Pairing, compute_residuals, display_residual_maps
raw = compute_residuals(analysis, Pairing.stereo(1, 0, 1), integration_points) # Raw gray levels
corrected = correlation.compute_residuals() # One per pairing of the term
print(raw.label, raw.n_points, raw.n_channels) # "raw", N_p, C
rms = numpy.sqrt(numpy.nanmean(raw.residuals**2))
display_residual_maps(analysis, corrected[0], fill_radius=2.0)
Note
The points projected out of the ROI of an image have NaN gray levels and NaN residuals: use the nan*
functions of numpy for the statistics. The RMS per element is computed by
pysdic.workflows.compute_elements_residual_rms().
Attributes#
The fields of the dataclass:
Field |
Content |
|---|---|
|
The |
|
The (corrected) gray levels in the two views, shape \((N_p, C)\), NaN out of the ROI. |
|
|
|
The projections \((x, y)\) of the points in the two views (pixels), shape \((N_p, 2)\). |
|
The (total) displacements \((N_v, E)\) of the frames of the two views used for the evaluation. |
|
The gray level correction (complete options), or None for the raw gray levels. |
And the derived properties:
The number of points \(N_p\). |
|
The number of channels \(C\). |
|
|
Residual maps#
The residuals of the points are drawn as images in the two views of the pairing:
pysdic.compute_pixel_residual_maps(): the residuals splatted on the pixels of each view (arrays of the size of the images);pysdic.display_residual_maps(): the two maps displayed side by side.