Grid deformator class

The deformation of the grid for the window deformation is done by the GridDeformator class.

class piv.grid_deformator.GridDeformator(frame, shape, distance, method='bilinear')[source]

Class of the grid deformator.

Initialization of the grid deformation process.

The frame and grid shape are set as well as the distance between the interrogation windows and the method of deformation. The available methods are

  • bilinear and
  • central.
Parameters:
  • frame – image that is interpolated
  • shape – shape of the initial regular grid
  • distance – shift between the interrogation windows
  • method – deformation method

After the initialization the velocities are set and a displacement is calculated.

GridDeformator.set_velocities(u, v)[source]

Setter function for the velocities to calculate the displacement.

Calls the getter function for every velocity component.

Parameters:
  • u – x component of the velocity vector
  • v – y component of the velocity vector
GridDeformator._get_displacement_function(f)[source]

Getter function for calculating the displacement.

Parameters:f – field that is used for the displacement, mainly velocity components
Returns:function of the Taylor expanded field to first order

In order to calculate the sub frame out of the displaced grid an other function must be invoked.

GridDeformator.get_frame(i, j)[source]

Perform interpolation to produce the deformed window for correlation.

This function takes the previously set displacement and interpolates the image for these coordinates. If the cubic interpolation method is chosen, the cubic interpolation of this API is use. For the bilinear method the build in scipy method map_coordinates is used with order set to 1.

Parameters:
  • i (int) – first index in grid coordinates
  • j (int) – second index in grid coordinates
Returns:

interpolated window for the grid coordinates i,j and the image set in initialization