pysdic.workflows.measure_reference_shape#

measure_reference_shape(analysis, integration_points, *, frame=0, pairings=None, normal_only=True, gl_correction=None, gray_level_groups=None, **solve_options)[source]#

Measure the shape of the specimen at a reference frame: the displacement of the frame bringing the mesh (e.g. a CAD mesh, never exactly at the position of the specimen) onto the observed surface, with the stereo pairings of the frame only.

The displacement of the frame (SDICUnknowns([frame], [])) is optimized with a pysdic.SDICCorrelationTerm on the stereo pairings (frame, i) - (frame, j): the views of the same instant must see the same gray levels at each material point. Only the vertices supporting integration points are optimized (see pysdic.compute_supported_vertices()), the other ones keep their current displacement (pysdic.SDICFixedParametrization).

Normal displacement. With the stereo pairings only, a displacement tangent to the surface is not observable: the material point slides on the surface, but both views still see the same speckle at its new position, so the residuals do not change (the Hessian is singular along these directions). With normal_only=True (default), each vertex only moves along its normal \(\vec{n}_k\) (normals of the mesh deformed by the current displacement), with one unknown \(q_k\) per vertex:

\[\vec{u}_k = \vec{u}_k^0 + q_k \, \vec{n}_k\]

With normal_only=False, the three components are optimized: use it only with another constraint of the tangential motion.

The analysis is not modified: write the result with analysis.set_displacement(frame, result.displacement). This measure comes before any measure of displacement against this frame.

Parameters:
  • analysis (pysdic.SDICAnalysis) – The analysis, with at least two views at frame and its displacement set (the initial guess, e.g. zero).

  • integration_points (pysdic.IntegrationPoints) – The material points, all located and visible in the views of the frame (see select_visible_integration_points()).

  • frame (Integral, optional (default: 0)) – The reference frame.

  • pairings (Optional[Sequence[pysdic.Pairing]], optional) – The stereo pairings of the frame. By default, all the pairs of views (i, j) with \(i < j\).

  • normal_only (bool, optional (default: True)) – If True, only the normal displacement of the vertices is optimized (3D mesh only).

  • gl_correction (Optional[Mapping[str, Any]], optional) – The gray level correction of the term (see pysdic.SDICCorrelationTerm).

  • gray_level_groups (Optional[pysdic.GrayLevelGroups], optional) – The groups of the correction (see pysdic.SDICCorrelationTerm).

  • **solve_options – The options of pysolvegn.solve (max_iteration, ftol, verbosity, …).

Returns:

The measured displacement of the frame.

Return type:

ReferenceShapeResult

Raises:

ValueError – If the frame has less than two views, its displacement is not set, a pairing is not a stereo pairing of the frame, or normal_only is used with a 2D mesh.

Examples

from pysdic.workflows import measure_reference_shape

analysis.set_zero_displacement(0)
shape = measure_reference_shape(analysis, integration_points, gl_correction={"mode": "ZNSSD"},
                                max_iteration=30)
analysis.set_displacement(0, shape.displacement)
print(f"Normal gap: {numpy.abs(shape.normal_displacement).max():.3f} mm")