コード例 #1
0
@description: Code to execute the smoothing for all the runs
    by iterating over them. This is done by using 3d smoothing
    of the velocity tensor. See post_processing_functions.py
    for a detailed explanation of each step
"""

import sys
sys.path.append(
    'C:\\Users\manue\Documents\GitHub\\ratzVKI\PIV_Campaign_Processing')

import post_processing_functions as ppf
import os
import numpy as np

Fol_Rise = 'C:\PIV_Processed\Images_Processed\Rise_64_16_peak2RMS'
Results = ppf.create_folder('C:\PIV_Processed\Fields_Smoothed')
runs = os.listdir(Fol_Rise)

# # for i in range(0, len(runs)):
# for i in range(23, 24):
#     Name_Cut = ppf.cut_processed_name(runs[i])
#     print(Name_Cut)
#     Fol_Out = ppf.create_folder(os.path.join(Results, 'Smoothed_'+Name_Cut))
#     Directory = os.path.join(Fol_Rise, runs[i])
#     x_tensor, y_tensor, u_tensor, v_tensor_raw, v_tensor_smo = ppf.load_and_smooth(Directory, order = 18, valid_thresh = 0.5)
#     np.save(os.path.join(Fol_Out, 'x_values'), x_tensor)
#     np.save(os.path.join(Fol_Out, 'y_values'), y_tensor)
#     np.save(os.path.join(Fol_Out, 'u_values'), u_tensor)
#     np.save(os.path.join(Fol_Out, 'v_values_raw'), v_tensor_raw)
#     np.save(os.path.join(Fol_Out, 'v_values_smoothed'), v_tensor_smo)
#     print('\n')
コード例 #2
0
import os  # for file paths
import numpy as np  # for calculations
import matplotlib.pyplot as plt  # for plotting
import post_processing_functions as ppf  # for some postprocessing stuff
import imageio  # for animations

# set the plot parameters
ppf.set_plot_parameters(20, 15, 10)

# here a list of all the runs that will be processed is created
Settings = '_24_24'
Data_Location = 'C:\PIV_Processed' + os.sep
Run_List = os.listdir(Data_Location + 'Images_Processed' + os.sep + 'Fall' +
                      Settings + '_peak2RMS')
# create a postprocessing folder to store the results
Fol_PP = ppf.create_folder('C:\PIV_Processed\Images_Postprocessed' + Settings +
                           os.sep)
# load the observation periods of the fall to get the index of the first calculated image
Periods = np.genfromtxt('observation_fall.txt', dtype=int)

##############################################################################
######## enable or disable the creation of individual gifs ###################
##############################################################################

PLOT_ROI = True  # working
PLOT_PROF = True  # working
PLOT_FLUX = True  # working
PLOT_S2N = True  # working
PLOT_HP = True  # working
PLOT_QUIV = True  # working

##############################################################################
コード例 #3
0
  

N_T = Img_Amount = Frame0 # set the image amount
Frame0 = 0 # set frame0 to 0 for the falls
# Img_Amount = 359 
plus = 0 # offset in case we went to look at a certain image

# size of the output files lower for large image amounts to save time
if Img_Amount < 60:
    dpi = 400
else:
    dpi = 80
# scaling factor
Pix2mm = Width/(Crop_Index[1]-Crop_Index[0]) 
# name of the output folder
Fol_Images_Detected = ppf.create_folder(Fol_Data + os.sep + 'Images_Detected')

"""initialize arrays"""
h_mm_avg = np.zeros([N_T])*np.nan  
h_cl_left = np.zeros([N_T])*np.nan  
h_cl_right = np.zeros([N_T])*np.nan  
angle_gauss = np.zeros([N_T])*np.nan  
angle_cosh = np.zeros([N_T])*np.nan 
curvature_gauss = np.zeros(([N_T]))
curvature_cosh = np.zeros(([N_T]))

# fitting function for the hyperbolic cosine
def func(x_func,a,b):
    return (np.cosh(np.abs(x_func)**a/b)-1)

"""gif setup"""
コード例 #4
0
Wall_Cut = 4
# whether to mirror the right side onto the left
Do_Mirror = True
Denoise = True
"""locate the images"""
# letter of the current run
Test_Case = 'P1500_C30_A'
Case = 'Rise'
Fluid = 'Water'

Fol_Data, Pressure, Run, H_Final, Frame0, Crop_Index, Speed =\
    imp.get_parameters(Test_Case, Case, Fluid)
N_T = Frame0 + Img_Amount - 1
Pix2mm = Width / (Crop_Index[1] - Crop_Index[0])
# name of the output folder
Fol_Out = ppf.create_folder('Crop_Check')
Fol_Images_Detected = ppf.create_folder(Fol_Data + os.sep +
                                        'Images_Detected_Unc')
"""initialize arrays"""
h_mm_avg = np.zeros([N_T + 1]) * np.nan
h_cl_left = np.zeros([N_T + 1]) * np.nan
h_cl_right = np.zeros([N_T + 1]) * np.nan
angle_left = np.zeros([N_T + 1]) * np.nan
angle_right = np.zeros([N_T + 1]) * np.nan
fit_coordinates = np.zeros((1000, Img_Amount))
"""gif setup"""
images = []  # empty list to append into
GIFNAME = 'Detected_interface.gif'  # name of the gif
fit_val = [1, 1, 1, 1]
# loop over all the images
i = 180
コード例 #5
0
IMAGES_H = []
IMAGES_CONT = []
IMAGES_PROF = []
IMAGES_FLUX = []
IMAGES_HIGHPASS = []
IMAGES_HIST = []
Gif_Suffix = '_slow_rise_h2.gif'
GIF_ROI = 'changing_roi' + Gif_Suffix
GIF_H = 'h' + Gif_Suffix
GIF_QUIV = 'contour' + Gif_Suffix
GIF_PROF = 'profiles' + Gif_Suffix
GIF_FLUX = 'flux' + Gif_Suffix
GIF_HIGHPASS = '******' + Gif_Suffix
GIF_HIST = 'histogram' + Gif_Suffix
# create a folder to store the images
Fol_Img = ppf.create_folder('images')

# load the data of the predicted height
h = ppf.load_h(Fol_In)
# set up a time array for plotting
t = np.linspace(0, Seconds, int(Seconds / Dt) + 1)[::Stp_T]

# set a custom colormap
custom_map = ppf.custom_div_cmap(100,
                                 mincol='indigo',
                                 midcol='darkcyan',
                                 maxcol='yellow')

# enable or disable the plots
PLOT_ROI = False
PLOT_HT = False