Class for direct Piv

The base class for the piv process is called Direct Piv.

class piv.direct_piv.DirectPIV(image_a, image_b, window_size=32, search_size=32, distance=16)[source]

Class for the initial Piv.

The images are error checked and padded if needed. After initialization a GridSpec is set and a grid is created. It creates an object of the GridSpec for the images. By calling the function

piv.direct_piv.DirectPIV.correlate_frames()

the correlation is calculated. As a result of the process the velocities are set as attributes of the class.

Initialization of the class.

Parameters:
  • image_a – first image to be evaluated
  • image_b – second image to be evaluated
  • window_size (int) – size of the interrogation window on first image
  • search_size (int) – size of the search window on second image
  • distance (int) – distance between beginning if first interrogation window and second

In order to make sure that the images used have to correct type and layout and are set, the functions

DirectPIV._check_images(img_a, img_b)[source]

Function for checking weather the images have the correct type (float64/double). The shape and strides are compared as well.

parameter:
img_a: first image img_b: second image
Error:
ValueError: shape or strides don’t match
Return:
images in same order as input
DirectPIV._set_images(img_a, img_b)[source]

Set the correlation images of the PIV algorithm.

If the window_size and search_size differ, the second image needs to be padded with zeros. :param img_a: first image :param img_b: second image

are used.

The initialization requires a grid to be set. Therefore a function creates the grid according to the GridSpec.

DirectPIV._grid_creator()[source]

Creates a grid according to the GridSpec.

After all the initialization is done the correlation can be performed by calling the correlation function.

DirectPIV.correlate_frames(method='gaussian')[source]

Correlation of all grid points, creating a velocity field.

Parameters:method (str) – Method of the peak finding algorithm

The parameter of this function controls the algorithm of the peak finder. Read more about this in the documentation of the process module.

If an explicitly two dimensional peak finder is needed, a function which handles this is also included.

DirectPIV.correlate_frames_2D()[source]

Correlation function for two dimensional peak finder algorithm.

These methods call an other method in order to extract the sub image needed for a step.

DirectPIV._get_window_frames(i, j)[source]

Return sub images of image attribute a and b at position i,j.

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

sub frame as interrogation and search window for correlation