import numpy as np import scipy.io as spio import datetime # Load Related Data test1 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30TestInfo1809131632.pkl') test2 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30TestInfo1809131636.pkl') test3 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30TestInfo1809131642.pkl') testNo = [test1, test2, test3] k = 1 # 1 2 3 with open(test1, 'rb') as f: test1Data = pickle.load(f) with open(test2, 'rb') as f: test2Data = pickle.load(f) with open(test3, 'rb') as f: test3Data = pickle.load(f) timestamp1 = myFunc.timestamp(test1) TestSetting1 = myFunc.testsetting(test1) testDataProcess = [test1Data, test2Data, test3Data] ########################################################################## ## Create teh interpolation function # Load the theoretical results for prediction and comparison. with open('shapeTablePy.pkl', 'rb') as f: shapeTable = pickle.load(f) ### This part is for referring to the Shape and build the functions # Interpolate the predication based on the measured data. pressure = shapeTable.get('pressure')[4:23]/1000 ContractionRatio = shapeTable.get('ContractionRatio')[4:23] StretchRatio = shapeTable.get('StretchRatio')[4:23]
# Noted: Sep 21 - import os import pickle import numpy as np from matplotlib import pyplot from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import myFunc LoadSavedDataFolder = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30GroupedData1809131632.pkl') R = 40 timestamp = myFunc.timestamp(LoadSavedDataFolder) TestSetting = myFunc.testsetting(LoadSavedDataFolder) with open(LoadSavedDataFolder, 'rb') as f: MeasuredGroupedData = pickle.load(f) TestName = [f for f in MeasuredGroupedData.keys()] # Basic Statistic of Position marker1 = MeasuredGroupedData.get('marker1') marker1Info = {'raw': marker1} marker1Info.update({'mean': marker1.mean(axis=0)}) marker1Info.update({'std': marker1.std(axis=0)}) marker1Info.update({'InitPos': marker1[50:200, :].mean(axis=0)}) # Pressure info MeasuredSmoothP = MeasuredGroupedData.get('MeasuredSmoothP') marker1Info.update({'MeasuredSmoothP': MeasuredSmoothP})
test1 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30GroupedData1809131632PoseInfo.pkl') test2 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30GroupedData1809131636PoseInfo.pkl') test3 = os.path.join('H:/netData/DynamicModel/jrvicon_data', 'R25T30GroupedData1809131642PoseInfo.pkl') testNo = [test1, test2, test3] k = 3 # 1 2 3 with open(test1, 'rb') as f: test1Data = pickle.load(f) with open(test2, 'rb') as f: test2Data = pickle.load(f) with open(test3, 'rb') as f: test3Data = pickle.load(f) timestamp = myFunc.timestamp(testNo[k - 1]) TestSetting = myFunc.testsetting(testNo[k - 1]) testDataProcess = [test1Data, test2Data, test3Data] print('test is processing {} {}'.format(TestSetting, timestamp)) ### Create teh interpolation function # Load the theoretical results for prediction and comparison. with open('shapeTablePy.pkl', 'rb') as f: shapeTable = pickle.load(f) # Interpolate the predication based on the measured data. pressure = shapeTable.get('pressure')[4:23] / 1000 ContractionRatio = shapeTable.get('ContractionRatio')[4:23] StretchRatio = shapeTable.get('StretchRatio')[4:23] # Construct the mapping among Pressure and Deforamation func_P2CR = interp1d(pressure, ContractionRatio, fill_value='extrapolate') func_P2SR = interp1d(pressure, StretchRatio) func_CR2P = interp1d(ContractionRatio, pressure, fill_value='extrapolate')