'Huginn' + flt + '.h5') fileList[flt]['config'] = path.join(pathBase, 'Huginn' + flt, 'huginn.json') fileList[flt]['def'] = path.join(pathBase, 'Huginn' + flt, 'huginn_def.json') #%% Bending ExcName = 'Bend' segList = [] oDataList = [] for flt in fileList.keys(): fileLog = fileList[flt]['log'] fileConfig = fileList[flt]['config'] fileDef = fileList[flt]['def'] fltDef = Loader.JsonRead(fileDef) for testPt in fltDef['Test-Points']: if testPt['Excitation'] == ExcName: # Load Flight Log oData, h5Data = Loader.Log_RAPTRS(fileLog, fileConfig) t0 = testPt['time_us'][0] * 1e-6 tf = t0 + (2 * np.pi) + 2.0 ODataSeg = OpenData.Segment(oData, ('time_s', [t0, tf])) oDataList.append(ODataSeg) seg = { 'flt': flt, 'seg': ('time_us', testPt['time_us']),
# {'flt': 'FLT06', 'seg': ('time_us', [1122539650, 1134539650], 'FLT06 - 23 m/s')}, # 23 m/s # {'flt': 'FLT05', 'seg': ('time_us', [582408497, 594408497], 'FLT05 - 26 m/s')}, # 26 m/s # {'flt': 'FLT05', 'seg': ('time_us', [799488311, 811488311], 'FLT05 - 29 m/s')}, # 29 m/s # {'flt': 'FLT06', 'seg': ('time_us', [955822061, 967822061], 'FLT06 - 32 m/s')}, # 32 m/s ] oDataSegs = [] for rtsmSeg in rtsmSegList: fltNum = rtsmSeg['flt'] fileLog = fileList[fltNum]['log'] fileConfig = fileList[fltNum]['config'] # Load h5Data = Loader.Load_h5(fileLog) # RAPTRS log data as hdf5 sysConfig = Loader.JsonRead(fileConfig) oData = Loader.OpenData_RAPTRS(h5Data, sysConfig) # Create Signal for Bending Measurement aZ = np.array([ oData['aCenterFwdIMU_IMU_mps2'][2] - oData['aCenterFwdIMU_IMU_mps2'][2][0], oData['aCenterAftIMU_IMU_mps2'][2] - oData['aCenterAftIMU_IMU_mps2'][2][0], oData['aLeftMidIMU_IMU_mps2'][2] - oData['aLeftMidIMU_IMU_mps2'][2][0], oData['aLeftFwdIMU_IMU_mps2'][2] - oData['aLeftFwdIMU_IMU_mps2'][2][0], oData['aLeftAftIMU_IMU_mps2'][2] - oData['aLeftAftIMU_IMU_mps2'][2][0], oData['aRightMidIMU_IMU_mps2'][2] - oData['aRightMidIMU_IMU_mps2'][2][0], oData['aRightFwdIMU_IMU_mps2'][2] - oData['aRightFwdIMU_IMU_mps2'][2][0],
excList = OpenData.FindExcite(oData) segList = [] print('\n\nFlight Excitation Times:\n') for iExc in range(0, len(excList)): print('Excitiation: ', excList[iExc][0], ', Time: [', excList[iExc][1][0], ',', excList[iExc][1][1], ']') segList.append(('time_us', excList[iExc][1])) oDataExc = OpenData.Segment(oData, segList) #OpenData.PlotOverview(oDataExc[0]) #%% Save _init.json file # Open init json file fltDef = {} #fltDef = JsonRead(fileTestDef) # Open flight json file fltConfig = Loader.JsonRead(fileSysConfig) testPointList = fltConfig['Mission-Manager']['Test-Points'] fltDef['Test-Points'] = OpenData.TestPointOut(excList, testPointList) if True: Loader.JsonWrite(fileTestDef, fltDef) print('Init File Updated:\n', fileTestDef) else: import json json.dumps(fltDef, indent=4, ensure_ascii=False) print('\nInit file NOT updated\n\n')