本文整理汇总了Python中common.PostProcess.get_data_by_index方法的典型用法代码示例。如果您正苦于以下问题:Python PostProcess.get_data_by_index方法的具体用法?Python PostProcess.get_data_by_index怎么用?Python PostProcess.get_data_by_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.PostProcess
的用法示例。
在下文中一共展示了PostProcess.get_data_by_index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import get_data_by_index [as 别名]
def main():
mat_file_name = sys.argv[1]
limits_dict, filter = read_limits()
filter.append('SpeedSensor.v')
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
metrics = {}
# No need to convert values into string that is done in update_metrics_in_report_json
metrics.update({'MaximumSpeed' : {'value': pp.global_abs_max('SpeedSensor.v'), 'unit': 'm/s'}})
metrics.update({'FinalVelocity' : {'value': pp.get_data_by_index('SpeedSensor.v', -1), 'unit': 'm/s'}})
metrics.update({'MeanVelocity' : {'value': pp.mean('SpeedSensor.v'), 'unit': 'm/s'}})
cwd = os.getcwd()
os.chdir('..')
update_metrics_in_report_json(metrics)
check_limits_and_add_to_report_json(pp, limits_dict)
os.chdir(cwd)
示例2: main
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import get_data_by_index [as 别名]
def main():
mat_file_name = sys.argv[1]
if not os.path.exists(mat_file_name):
raise IOError("Given result file does not exist: {0}".format(sys.argv[1]))
## First limit part
limit_dict, filter = read_limits()
## End of first limit part
## Post processing part
bucketCylLength_uri = "Excavator_.bucketCylLength_unit"
filter.append(bucketCylLength_uri)
armCylLength_uri = "Excavator_.armCylLength_unit"
filter.append(armCylLength_uri)
boomCylLength_uri = "Excavator_.boomCylLength_unit"
filter.append(boomCylLength_uri)
boomCylRPressure_uri = "Excavator_.boomCylLPressure_a"
filter.append(boomCylRPressure_uri)
armCylPressure_uri = "Excavator_.armCylPressure_a"
filter.append(armCylPressure_uri)
bucketCylPressure_uri = "Excavator_.bucketCylPressure_a"
filter.append(bucketCylPressure_uri)
arm_ang_vel_uri = "Excavator_.arm_ang_vel"
filter.append(arm_ang_vel_uri)
max_Y_uri = "Excavator_.yDistance"
filter.append(max_Y_uri)
max_reach_uri = "Excavator_.xDistance"
filter.append(max_reach_uri)
State_uri = "operator_Full.State_1"
filter.append(State_uri)
tip_uri = "Excavator_.tipping_torque"
filter.append(tip_uri)
deflection_uri = "Excavator_.yDistance"
filter.append(deflection_uri)
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
max_p_time = pp.global_max_time(boomCylRPressure_uri)
max_v_time = pp.global_max_time(arm_ang_vel_uri)
# max_p_time = pp.global_max_time(armCylPressure_uri)
# max_p_time = pp.global_max_time(bucketCylPressure_uri)
print "Maximum pressure obtained at : {0}".format(max_p_time)
print "Max tip torque : {0}".format(pp.global_abs_max(tip_uri))
y_deflection = pp.get_data_by_index(deflection_uri, 0) - pp.last_value(deflection_uri)
metrics = {}
metrics.update(
{
"bucketCylLength_unit": {"value": pp.get_data_by_time(bucketCylLength_uri, max_p_time)[0], "unit": "m"},
"boomCylLength_unit": {"value": pp.get_data_by_time(boomCylLength_uri, max_p_time)[0], "unit": "m"},
"armCylLength_unit": {"value": pp.get_data_by_time(armCylLength_uri, max_p_time)[0], "unit": "m"},
"bucketCylPressure": {"value": pp.global_abs_max(bucketCylPressure_uri) * 0.00001, "unit": "bar"},
"boomCylRPressure": {"value": pp.global_abs_max(boomCylRPressure_uri) * 0.00001, "unit": "bar"},
"armCylPressure": {"value": pp.global_abs_max(armCylPressure_uri) * 0.00001, "unit": "bar"},
"tipTorque": {"value": pp.global_abs_max(tip_uri), "unit": "N-m"},
"y_deflection": {"value": y_deflection, "unit": "m"},
#'swing_speed': {'value': pp.last_value(swing_uri), 'unit':'rad/s'},
}
)
cwd = os.getcwd()
os.chdir("..")
# print 'Plot saved to : {0}'.format(pp.save_as_svg(vehicle_speed,
# pp.global_abs_max(vehicle_speed),
# 'VehicleSpeed',
# 'max(FTP_Driver.driver_bus.vehicle_speed)',
# 'kph'))
dur = 100
pp.store_data_to_csv(bucketCylLength_uri, "{0}.csv".format(bucketCylLength_uri), 0, 0.1, dur)
pp.store_data_to_csv(armCylLength_uri, "{0}.csv".format(armCylLength_uri), 0, 0.1, dur)
pp.store_data_to_csv(boomCylLength_uri, "{0}.csv".format(boomCylLength_uri), 0, 0.1, dur)
pp.store_data_to_csv(boomCylRPressure_uri, "{0}.csv".format(boomCylRPressure_uri), 0, 0.1, dur)
pp.store_data_to_csv(arm_ang_vel_uri, "{0}.csv".format(arm_ang_vel_uri), 0, 0.1, dur)
pp.store_data_to_csv(max_Y_uri, "{0}.csv".format(max_Y_uri), 0, 0.1, dur)
pp.store_data_to_csv(max_reach_uri, "{0}.csv".format(max_reach_uri), 0, 0.1, dur)
pp.store_data_to_csv(State_uri, "{0}.csv".format(State_uri), 0, 0.1, dur)
## end of postprocessing part
## Second limit part
check_limits_and_add_to_report_json(pp, limit_dict)
update_metrics_in_report_json(metrics)
## end of Second limit part
os.chdir(cwd)