pyvale.dic.dicimport2d module

import_2d(data, delimiter, binary=False, layout='matrix', print_level=1)[source]

Import DIC result data from human readable text or binary files.

Parameters:
  • data (str or pathlib.Path or list[pathlib.Path]) – Path pattern to the data files (can include wildcards). Default is “./”.

  • layout (str, optional) – Format of the output data layout: “column” (flat array per frame) or “matrix” (reshaped grid per frame). Default is “column”.

  • binary (bool, optional) – If True, expects files in a specific binary format. If False, expects text data. Default is False.

  • delimiter (str, optional) – Delimiter used in text data files. Ignored if binary=True. Default is a single space.

Returns:

Results

A named container with the following fields:
  • ss_x, ss_y (grid arrays if layout==”matrix”; otherwise, 1D integer arrays)

  • u, v, m, converged, cost, ftol, xtol, niter (arrays with shape depending on layout)

  • filenames (python list)

Raises:
  • ValueError: – If layout is not “column” or “matrix”, or text data has insufficient columns, or binary rows are malformed. import cython module

  • FileNotFoundError: – If no matching data files are found.

to_grid(data, shape, ss_x_ref, ss_y_ref, x_unique, y_unique)[source]

Reshape a 2D DIC field from flat (column) format into grid (matrix) format.

This is used when output layout is specified as “matrix”. Maps values using reference subset coordinates (ss_x_ref, ss_y_ref).

Parameters:
  • data (np.ndarray) – Array of shape (n_frames, n_points) to be reshaped into (n_frames, height, width).

  • shape (tuple) – Target shape of output array: (n_frames, height, width).

  • ss_x_ref (np.ndarray) – X coordinates of subset centers.

  • ss_y_ref (np.ndarray) – Y coordinates of subset centers.

  • x_unique (np.ndarray) – Sorted unique X coordinates in the grid.

  • y_unique (np.ndarray) – Sorted unique Y coordinates in the grid.

Returns:

np.ndarray – Reshaped array with shape shape, filled with NaNs where no data exists.

check_delimiter(fname, delimiter)[source]