plot 1/2
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
fig = plt.figure(1)
|
||||
plt.subplot(421) # 設定子圖 421 表示4*2 位置1 不想塞子圖就註解
|
||||
duration_info_message = 8
|
||||
duration_info_message_bin = 4
|
||||
|
||||
width=0.3
|
||||
x = ['set1']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(8) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(4) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('duration_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
|
||||
|
||||
plt.subplot(422)
|
||||
flight_info_message=85
|
||||
flight_info_message_bin=22
|
||||
width=0.3
|
||||
x = ['set2']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(85) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(22) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('flight_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
|
||||
|
||||
fig = plt.figure(2)
|
||||
|
||||
json=404
|
||||
serial=97
|
||||
width=0.3
|
||||
x = ['set']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(404) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(97) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('flight_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
|
||||
plt.show()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
"2022-12-04T15:50:18.050641Z"
|
||||
"2022-12-08T07:22:43.602554Z"
|
||||
@@ -1 +1 @@
|
||||
�������
|
||||
áƜ
|
||||
@@ -10,42 +10,45 @@ def file(message, path, json=False, serial=False):
|
||||
with open(path, "w") as f:
|
||||
f.write(message)
|
||||
|
||||
def proto_msg():
|
||||
flight_info_message = protoMsgWrapper.flight_information(serialized = True)
|
||||
fly_format_message = protoMsgWrapper.fly_formation(serialized = True)
|
||||
imu_info_message = protoMsgWrapper.imu_information(serialized = True)
|
||||
odom_info_message = protoMsgWrapper.odom_information(serialized = True)
|
||||
flymode_info_message = protoMsgWrapper.flymode_information(serialized = True)
|
||||
duration_info_message = protoMsgWrapper.duration_information(serialized = True)
|
||||
timestamp_info_message = protoMsgWrapper.timestamp_information(serialized = True)
|
||||
serial = [flight_info_message, fly_format_message, imu_info_message, odom_info_message, flymode_info_message, duration_info_message, timestamp_info_message]
|
||||
for message in serial:
|
||||
file(message, serial_name[serial.index(message)], serial=True)
|
||||
|
||||
flight_info_message = protoMsgWrapper.flight_information(serialized = True)
|
||||
fly_format_message = protoMsgWrapper.fly_formation(serialized = True)
|
||||
imu_info_message = protoMsgWrapper.imu_information(serialized = True)
|
||||
odom_info_message = protoMsgWrapper.odom_information(serialized = True)
|
||||
flymode_info_message = protoMsgWrapper.flymode_information(serialized = True)
|
||||
duration_info_message = protoMsgWrapper.duration_information(serialized = True)
|
||||
timestamp_info_message = protoMsgWrapper.timestamp_information(serialized = True)
|
||||
serial = [flight_info_message, fly_format_message, imu_info_message, odom_info_message, flymode_info_message, duration_info_message, timestamp_info_message]
|
||||
serial_name = ["flight_info_message", "fly_format_message", "imu_info_message", "odom_info_message", "flymode_info_message", "duration_info_message", "timestamp_info_message"]
|
||||
for message in serial:
|
||||
file(message, serial_name[serial.index(message)], serial=True)
|
||||
def json_msg():
|
||||
flight_info_message = protoMsgWrapper.flight_information(tojson = True)
|
||||
fly_format_message = protoMsgWrapper.fly_formation(tojson = True)
|
||||
imu_info_message = protoMsgWrapper.imu_information(tojson = True)
|
||||
odom_info_message = protoMsgWrapper.odom_information(tojson = True)
|
||||
flymode_info_message = protoMsgWrapper.flymode_information(tojson = True)
|
||||
duration_info_message = protoMsgWrapper.duration_information(tojson = True)
|
||||
timestamp_info_message = protoMsgWrapper.timestamp_information(tojson = True)
|
||||
js = [flight_info_message, fly_format_message, imu_info_message, odom_info_message, flymode_info_message, duration_info_message, timestamp_info_message]
|
||||
|
||||
flight_info_message = protoMsgWrapper.flight_information(tojson = True)
|
||||
fly_format_message = protoMsgWrapper.fly_formation(tojson = True)
|
||||
imu_info_message = protoMsgWrapper.imu_information(tojson = True)
|
||||
odom_info_message = protoMsgWrapper.odom_information(tojson = True)
|
||||
flymode_info_message = protoMsgWrapper.flymode_information(tojson = True)
|
||||
duration_info_message = protoMsgWrapper.duration_information(tojson = True)
|
||||
timestamp_info_message = protoMsgWrapper.timestamp_information(tojson = True)
|
||||
js = [flight_info_message, fly_format_message, imu_info_message, odom_info_message, flymode_info_message, duration_info_message, timestamp_info_message]
|
||||
js_name = ["flight_info_message", "fly_format_message", "imu_info_message", "odom_info_message", "flymode_info_message", "duration_info_message", "timestamp_info_message"]
|
||||
for message in js:
|
||||
file(message, js_name[js.index(message)], json=True)
|
||||
for message in js:
|
||||
file(message, serial_name[js.index(message)], json=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
serial_name = ["flight_info_message", "fly_format_message", "imu_info_message", "odom_info_message", "flymode_info_message", "duration_info_message", "timestamp_info_message"]
|
||||
proto_msg()
|
||||
json_msg()
|
||||
serlizl_size = 0
|
||||
json_size = 0
|
||||
size = {"flight_info_message":{"Json":None, "Proto":None}}
|
||||
files = sorted(os.listdir("size"))
|
||||
for file in files:
|
||||
size = os.path.getsize("size/"+file)
|
||||
print(file, size)
|
||||
if file.endswith(".bin"):
|
||||
serlizl_size += size
|
||||
else:
|
||||
json_size += size
|
||||
|
||||
|
||||
serlizl_size = 0
|
||||
json_size = 0
|
||||
files = sorted(os.listdir("size"))
|
||||
for file in files:
|
||||
size = os.path.getsize("size/"+file)
|
||||
print(file, size)
|
||||
if file.endswith(".bin"):
|
||||
serlizl_size += size
|
||||
else:
|
||||
json_size += size
|
||||
|
||||
print("json - serial = ", json_size - serlizl_size)
|
||||
print("json - serial = ", json_size - serlizl_size)
|
||||
|
||||
Reference in New Issue
Block a user