fluidimage.topologies.bos#

Topology for BOS computation (fluidimage.topologies.bos)#

class fluidimage.topologies.bos.TopologyBOS(params, logging_level='info', nb_max_workers=None)[source]#

Bases: TopologyBaseFromImages

Topology for BOS computation.

See https://en.wikipedia.org/wiki/Background-oriented_schlieren_technique

The most useful methods for the user (in particular compute()) are defined in the base class fluidimage.topologies.base.TopologyBase.

Parameters:
paramsNone

A ParamContainer (created with the class method create_default_params()) containing the parameters for the computation.

logging_levelstr, {‘warning’, ‘info’, ‘debug’, …}

Logging level.

nb_max_workersNone, int

Maximum numbers of “workers”. If None, a number is computed from the number of cores detected. If there are memory errors, you can try to decrease the number of workers.

Splitter#

alias of SplitterBos

classmethod create_default_params()[source]#

Class method returning the default parameters.

Typical usage:

params = TopologyPIV.create_default_params()
# modify parameters here
...

topo = TopologyPIV(params)
save_bos_object(obj)[source]#

Save a BOS object

calcul(tuple_image_path)[source]#

Compute a BOS field

_fix_indices_images(indices_images)[source]#

Fix the indices images in fill_queue_paths

make_text_at_exit(time_since_start)[source]#

Make a text printed at exit

Documentation for params#

  • reference : str or int, {0}

    Reference file (from which the displacements will be computed). Can be an absolute file path, a file name or the index in the list of files found from the parameters in params.images.

Documentation for params.saving#

Saving of the results.

  • path : None or str

    Path of the directory where the data will be saved. If None, the path is obtained from the input path and the parameter postfix.

  • how : str {‘ask’}

    ‘ask’, ‘new_dir’, ‘complete’ or ‘recompute’.

  • postfix : str

    Postfix from which the output file is computed.

Documentation for params.images#

Parameters indicating the input image set.

  • path : str, {‘’}

    String indicating the input images (can be a full path towards an image file or a string given to glob).

  • str_subset : None

    String indicating as a Python slicing how to select images from the serie of images on the disk. If None, no selection so all images will be processed.

Documentation for params.piv0#

Parameters describing one PIV step.

  • shape_crop_im0 : int (48)

    Shape of the cropped images 0 from which are computed the correlation.

  • shape_crop_im1 : int or None

    Shape of the cropped images 0 (has to be None for correl based on fft).

  • displacement_max : None

    Displacement maximum used in correlation classes. The exact effect depends on the correlation method. For fft based correlation, it can also be of the form ‘50%’ and then the maximum displacement is computed for each pass as a pourcentage of max(shape_crop_im0).

  • displacement_mean : None

    Displacement averaged over space (NotImplemented).

  • method_correl : str, default ‘fftw’

    Can be in [‘pythran’, ‘pycuda’, ‘scipy.signal’, ‘scipy.ndimage’, ‘np.fft’, ‘fftw’, ‘cufft’, ‘skcufft’]

  • method_subpix : str, default ‘2d_gaussian2’

    Can be in [‘2d_gaussian’, ‘2d_gaussian2’, ‘centroid’, ‘no_subpix’]

  • nsubpix : None

    Integer used in the subpix finder to compute the shape of the correlation crop ((1+2*nsubpix,)*2). It is related to the typical size of the particles. It has to be increased in case of peak locking (plot the histograms of the displacements).

  • nb_peaks_to_search : 1, int

    Number of peaks to search. Secondary peaks can be used during the fix step.

  • particle_radius : 3, int

    Typical radius of a particle (or more precisely of a correlation peak). Used only if nb_peaks_to_search is larger than one.

Documentation for params.piv0.grid#

Parameters describing the grid.

  • overlap : float (0.5)

    Number smaller than 1 defining the overlap between interrogation windows.

  • from : str {‘overlap’}

    Keyword for the method from which is computed the grid.

Documentation for params.mask#

Parameters describing how images are masked.

  • strcrop : None, str

    Two-dimensional slice (for example ‘100:600, :’). If None, the whole image is used.

Documentation for params.fix#

Parameters indicating how are detected and processed false vectors.

  • correl_min : 0.2

    Vectors associated with correlation smaller than correl_min are considered as false vectors.

  • threshold_diff_neighbour : 10

    Vectors for which the difference with the average vectors is larger than threshold_diff_neighbour are considered as false vectors.

  • displacement_max : None

    Vectors larger than displacement_max are considered as false vectors.

Documentation for params.multipass#

Multipass PIV parameters:

  • number : int (default 1)

    Number of PIV passes.

  • coeff_zoom : integer or iterable of size number - 1.

    Reduction coefficient defining the size of the interrogation windows for the passes 1 (second pass) to number - 1 (last pass) (always defined comparing the passes i-1).

  • use_tps : bool or ‘last’

    If it is True, the interpolation is done using the Thin Plate Spline method (computationally heavy but sometimes interesting). If it is ‘last’, the TPS method is used only for the last pass.

  • subdom_size : int

    Number of vectors in the subdomains used for the TPS method.

  • smoothing_coef : float

    Coefficient used for the TPS method. The result is smoother for larger smoothing_coef. 2 is often reasonable. Can typically be between 0 to 40.

  • threshold_tps : float

    Allowed difference of displacement (in pixels) between smoothed and input field for TPS filter used in an iterative filtering method. Vectors too far from the corresponding interpolated vector are removed.

Documentation for params.preproc#

  • im2im : str {None}

    Function or class to be used to process the images.

  • args_init : object {None}

    An argument given to the init function of the class used to process the images.

Classes

SplitterBos(params, num_processes[, ...])

Topology

alias of TopologyBOS

TopologyBOS(params[, logging_level, ...])

Topology for BOS computation.