1
我正在研究openPIV的示例代碼。該版本是最新版本(openpiv-python-master)。我有一個錯誤; AttributeError:'模塊'對象沒有'驗證'屬性 雖然我設置了路徑,但似乎openPIV無法找到validation.py。 你能讓我知道如何解決它嗎?openPIV示例代碼錯誤
import openpiv.tools
import openpiv.process
import openpiv.scaling
import numpy as np
import sys
sys.path.append('/Users/myname/openpiv-python-master/openpiv')
filedir = '/Users/myname/tutorial-part1/'
frame_a = openpiv.tools.imread(filedir + 'exp1_001_a.bmp')
frame_b = openpiv.tools.imread(filedir + 'exp1_001_b.bmp')
u, v, sig2noise = openpiv.process.extended_search_area_piv(frame_a.astype(np.int32), frame_b.astype(np.int32), window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak')
x, y = openpiv.process.get_coordinates(image_size=frame_a.shape, window_size=24, overlap=12)
u, v, mask = openpiv.validation.sig2noise_val(u, v, sig2noise, threshold = 1.3)
u, v = openpiv.filters.replace_outliers(u, v, method='localmean', max_iter=10, kernel_size=2)
x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52)
openpiv.tools.save(x, y, u, v, mask, 'exp1_001.txt')
openpiv.tools.display_vector_field('exp1_001.txt', scale=100, width=0.0025)