Ejemplo n.º 1
0
def test_invert_and_piv():
    """ Test windef.piv with invert option """

    settings = windef.Settings()
    'Data related settings'
    # Folder with the images to process
    settings.filepath_images = pathlib.Path(__file__).parent / '../examples/test1'
    settings.save_path = '.'
    # Root name of the output Folder for Result Files
    settings.save_folder_suffix = 'test'
    # Format and Image Sequence
    settings.frame_pattern_a = 'exp1_001_a.bmp'
    settings.frame_pattern_b = 'exp1_001_b.bmp'

    settings.num_iterations = 1
    settings.show_plot = False
    settings.scale_plot = 100
    settings.show_all_plots = False
    settings.invert = True

    windef.piv(settings)
# select a method to replace the outliers: 'localmean', 'disk', 'distance'
settings.filter_method = 'localmean'
# maximum iterations performed to replace the outliers
settings.max_filter_iteration = 4
settings.filter_kernel_size = 3  # kernel size for the localmean method

'Output options'
# Select if you want to save the plotted vectorfield: True or False
settings.save_plot = False
# Choose wether you want to see the vectorfield or not :True or False
settings.show_plot = False
settings.scale_plot = 50  # select a value to scale the quiver plot of the vectorfield
# run the script with the given settings

# %%
windef.piv(settings)

# %%
for i, f in enumerate(res_list):
    fig, ax = plt.subplots(figsize=(12, 12))
    tools.display_vector_field(f,
                               on_img=True,
                               image_name=image_path / file_list[i],
                               scaling_factor=1,
                               scale=50,
                               width=0.002,
                               ax=ax,
                               widim=True)
    fig.savefig(f'{str(f)[:-4]}.png', dpi=150)

# settings.frame_pattern_a = f1