fluidimage.works.piv.singlepass#

Piv work and subworks#

class fluidimage.works.piv.singlepass.BaseWorkPIV(params=None)[source]#

Bases: BaseWorkWithMask

Base class for PIV.

This class is meant to be subclassed, not instantiated directly.

classmethod _complete_params_with_default(params)[source]#

Complete an object with the default params

_prepare_with_image(im0=None, imshape=None)[source]#

Initialize the object with an image.

calcul(couple)[source]#

Calcul the PIV (one pass) from a couple of images.

_pad_images(im0, im1)[source]#

Pad images with zeros.

Todo

Choose correctly the variable npad.

_calcul_positions_vectors_subimages(deltaxs_input=None, deltays_input=None)[source]#

Calcul the indices corresponding to the vectors and cropped windows.

Returns:
xsnp.array

x index of the position of the computed vector in the original images.

ysnp.array

y index of the position of the computed vector in the original images.

ixs0_padnp.array

x index of the center of the crop image 0 in the padded image 0.

iys0_padnp.array

y index of the center of the crop image 0 in the padded image 0.

ixs1_padnp.array

x index of the center of the crop image 1 in the padded image 1.

iys1_padnp.array

y index of the center of the crop image 1 in the padded image 1.

_loop_vectors(im0, im1, deltaxs_input=None, deltays_input=None)[source]#

Loop over the vectors to compute them.

_init_crop()[source]#

Initialize the cropping of the images.

_crop_im0(ixvec, iyvec, im)[source]#

Crop image 0.

_crop_im1(ixvec, iyvec, im)[source]#

Crop image 1.

apply_interp(piv_results, last=False)[source]#

Interpolate a PIV result object on the grid of the PIV work.

Parameters:
piv_results:class;`HeavyPIVResults`

The interpolated field are added to this object.

lastbool (False)

Last pass or not.

Notes

Depending on the value of params.multipass.use_tps, the interpolation is done with an iterative method based on the Thin Plate Spline method (fluidimage.calcul.interpolate.thin_plate_spline_subdom.ThinPlateSplineSubdom) or done with a simple griddata method (much faster).

class fluidimage.works.piv.singlepass.FirstWorkPIV(params)[source]#

Bases: BaseWorkPIV

First PIV pass (without input displacements).

Parameters:
paramsParamContainer

ParamContainer object produced by the function fluidimage.works.piv.multipass.WorkPIV.create_default_params().

classmethod _complete_params_with_default(params)[source]#

Complete an object with the default params

class fluidimage.works.piv.singlepass.WorkPIVFromDisplacement(params, index_pass=1, shape_crop_im0=None, shape_crop_im1=None)[source]#

Bases: BaseWorkPIV

Work PIV working from already computed displacement (for multipass).

Parameters:
paramsParamContainer

ParamContainer object produced by the function fluidimage.works.piv.multipass.WorkPIV.create_default_params().

index_passint, 1
shape_crop_im0int or tuple, optional
shape_crop_im1int or tuple, optional

Notes

Steps for the PIV computation:

  • prepare the work PIV with an image if not already done (grid),

  • apply interpolation (TPS or griddata) to compute a estimation of the displacements,

  • loop over vectors to compute displacements.

calcul(piv_results)[source]#

Calcul the PIV (one pass) from a couple of images and displacement.

Todo

Use the derivatives of the velocity to distort the image 1.

_calcul_positions_vectors_subimages(deltaxs_input=None, deltays_input=None)[source]#

Calcul the indices corresponding to the vectors and cropped windows.

Returns:
xsnp.array

x index of the position of the computed vector in the original images.

ysnp.array

y index of the position of the computed vector in the original images.

ixs0_padnp.array

x index of the center of the crop image 0 in the padded image 0.

iys0_padnp.array

y index of the center of the crop image 0 in the padded image 0.

ixs1_padnp.array

x index of the center of the crop image 1 in the padded image 1.

iys1_padnp.array

y index of the center of the crop image 1 in the padded image 1.

Classes

BaseWorkPIV([params])

Base class for PIV.

FirstWorkPIV(params)

First PIV pass (without input displacements).

WorkPIVFromDisplacement(params[, ...])

Work PIV working from already computed displacement (for multipass).

Exceptions

InterpError