dpivsoft.Classes

class dpivsoft.Classes.Parameters[source]

Bases: object

Container for all the parameter options used to perform PIV.

Default values are defined here. There are two ways to change the values for a specific DPIV run:

  • Change the specific value manually on python shell or on the running script.

    Example: Parameters.box_size_1_x = 128

  • Load all the parameters included in a yaml file by using readParameters classmethod.

    Example: Parameters.readParameters(‘folder/filename’)

box_size_1_x = 64
box_size_1_y = 64
no_boxes_1_x = 64
no_boxes_1_y = 32
window_1_x = 48
window_1_y = 48
box_size_2_x = 32
box_size_2_y = 32
no_boxes_2_x = 128
no_boxes_2_y = 64
window_2_x = 32
window_2_y = 32
no_iter_1 = 1
no_iter_2 = 2
direct_calc = False
mask = False
stereo = False
peak_ratio = 1
weighting = False
gaussian_size = 0
median_limit = 0.5
calibration = 1
delta_t = 1
class Data[source]

Bases: object

Holds run-specific data such as the mask and its file paths.

path_mask = 'none'
path_stereo = 'none'
class Stereo_Calibration(npz_file)[source]

Bases: object

Loads a stereo calibration from an .npz file: the pixel->world forward fits (fwd_*) and the Soloff world->pixel maps (map_*) for both cameras, plus the camera configuration.

load_variables(npz_file)[source]

Read the calibration arrays from npz_file into attributes.

classmethod readParameters(fileName)[source]

Load all PIV parameters from a yaml file and set them on the class (overwriting the defaults).

Parameters:

fileName (str) – Path to the yaml parameter file.

introParameters()[source]

Introduce a parameter manually, not implemented yet (probably needed for a GUI)

class dpivsoft.Classes.grid[source]

Bases: object

Holds the PIV grids (window centers and box origins) for both passes, built from the image size and the current Parameters.

classmethod generate_mesh(width, height)[source]

Build the meshgrid of x and y positions of the correlation windows for the two passes, according to the selected PIV parameters, and store them as class attributes.

Parameters:
  • width (int) – Image size in pixels.

  • height (int) – Image size in pixels.

read_mesh(height, width)[source]

Read the positions of a custom mesh from a file (not implemented yet)

class dpivsoft.Classes.Synt_Img[source]

Bases: object

Contains the parameters to generate a pair of synthetic images following a given flow velocity field. The default values can be changed manually.

Variables:
  • width (int) – Number of pixels in the x-direction of the generated image.

  • height (int) – Number of pixels in the y-direction of the generated image.

  • trazers_density (float) – Number of particles generated per pixel. Must be a float between 0 and 1.

  • vel (float) –

    Characteristic velocity of the canonical flow used to generate the particle displacement.

    Note: it has a different definition for each flow.

  • Shine_m (int) – Mean brightness of the tracer core (from 0 to 255).

  • d_Shine (int) – Triangular variability of the tracer brightness.

  • D_m (int or float) – Mean diameter of the tracers.

  • d_D (int or float) – Triangular variability of the tracer diameter.

  • noise_m (int) – Mean of the random noise.

  • d_noise (int) – Triangular variability of the image noise.

  • vel_profile (str) –

    Name of the flow velocity field used. The following options are available:

    Constant: Flow with a constant displacement of “vel” pixels on

    the x-direction

    Couette: Couette flow in x-direction using a moving condition

    of “vel” pixels between images on top wall. Bottom limit of the images is not moving.

    Poiseuille: Poiseuille flow in x direction with no-slip condition

    on top and bottom of the images. The parameter “vel” indicates the maximum velocity of the flow in pixels.

    Vortex: Flow generated by a Scully vortex (see Scully 1975). Vel

    is the maximum velocity of the vortex in pixel/frame.

    Frequency: Spatial frequency wave along the y-direction. This

    flow allows testing the PIV frequency response (see Scarano & Riethmuller, 2000). In this case the maximum pixel displacement on the wave is always 2 pixels, and the parameter “vel” indicates the wavelength.

  • ext (str) – Extension used to save the images.

width = 1024
height = 1024
vel_profile = 'Vortex'
vel = 8
amp = 125.66370614359172
n_steps = 10
trazers_density = 0.05
Shine_m = 230
d_Shine = 80
D_m = 4
d_D = 3
noise_m = 1
d_noise = 1
ext = '.png'
class dpivsoft.Classes.GPU[source]

Bases: object

Namespace for the GPU-side data. The OpenCL buffers and compiled kernels are attached as attributes at runtime by Cl_DPIV.compile_Kernels / initialization / processing.

gpu_data(thr)[source]

Placeholder hook for attaching GPU data to the reikna Thread thr; the buffers/kernels are populated by Cl_DPIV instead.