pysdic.workflows.compute_grid_size#

compute_grid_size(analysis, density, *, frame=0, statistic='max')[source]#

Compute the grid size \(n\) of create_grid_integration_points() giving a target density of points per pixel in the views of a frame.

The projected area \(A_e\) (pixels²) of each element is computed in each view of the frame (see pysdic.compute_projected_elements_areas(), with the displacement of the frame), and the largest one over the views is kept. The grid size is

\[n = \left\lceil \sqrt{\rho \, A} \right\rceil\]

with \(\rho\) the density and \(A\) a statistic of the areas \(A_e\) over the elements: with "max", every element gets at least the density in every view.

Note

The occlusions are not taken into account: hidden elements also have an area (see select_visible_integration_points()).

Parameters:
  • analysis (pysdic.SDICAnalysis) – The analysis, with the displacement of frame set.

  • density (Real) – The target number of points per pixel (strictly positive), e.g. 1 for about one point per pixel.

  • frame (Integral, optional (default: 0)) – The frame whose views give the projected areas.

  • statistic (str, optional (default: "max")) – "max", "median" or "mean" of the areas over the elements.

Returns:

The grid size \(n \geq 1\).

Return type:

int

Raises:

ValueError – If the frame has no view, its displacement is not set, or no element has a finite area.