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 (
strorpathlib.Pathorlist[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, x_indices, y_indices)[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 precomputed grid indices. Using NumPy advanced indexing avoids a Python loop over every point and lets callers reuse the same coordinate mapping for every field.
- 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).x_indices (
np.ndarray) – Column index for each point indata.y_indices (
np.ndarray) – Row index for each point indata.
- Returns:
np.ndarray– Reshaped array with shape shape, filled with NaNs where no data exists.