strain.py

calculate_2d(data, window_size=5, window_element=9, input_binary=False, input_delimiter=',', output_basepath='./', output_binary=False, output_prefix='strain_', output_delimiter=',', output_at_end=False, strain_formulation='HENCKY')[source]

Compute strain fields from DIC displacement data using a finite element smoothing approach.

This function validates the input data and parameters, optionally loads DIC results from file, and passes the data to a C++-accelerated backend for strain computation.

Parameters:
  • data (dic.Results, pathlib.Path or str) – input data can either be a dic.Results object or pathlib.Path / str if importing data straight from a file

  • input_delimiter (str) – delimiter used for the input dic results files if using pathlib.Path or str for data import (default: “,”).

  • bool (input_binary) – whether input data is in human-readable or binary format if using pathlib.Path or str for data import (default: False).

  • window_size (int, optional) – The size of the local window over which to compute strain (must be odd, default: 5).

  • window_element (int, optional) – The type of finite element shape function used in the strain window: 4 (bilinear) or 9 (biquadratic), by default 4.

  • strain_formulation (str, optional) – The strain definition to use: one of ‘GREEN’, ‘ALMANSI’, ‘HENCKY’, ‘BIOT_EULER’, ‘BIOT_LAGRANGE’. Defaults to ‘HENCKY’.

  • output_basepath (str or pathlib.Path, optional) – Directory path where output files will be written (default: “./”).

  • output_binary (bool, optional) – Whether to write output in binary format (default: False).

  • output_prefix (str, optional) – Prefix for all output files (default: strain_). results will be named with output_prefix + original filename. THe extension will be changed to “.csv” or “.dic2d” depending on whether outputting as a binary.

  • output_delimiter (str, optional) – Delimiter used in text output files (default: “,”).

Raises:

ValueError – If any of the input parameters are invalid (e.g., unsupported strain formulation, even window size, or invalid element type).