Repository for M.A.I.L system's analysis server.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

mailimage.py 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import os
  2. import sys
  3. import time
  4. import pandas as pd
  5. import json
  6. import numpy as np
  7. import math
  8. import matplotlib.pyplot as plt
  9. #import sklearn.datasets as data
  10. #import hdbscan ##NOTE: hdbscan needs Cython. please install Cython before use.
  11. import seaborn as sns
  12. import pandas as pd
  13. def draw_plot_cam_1(dataframe, path):
  14. df = dataframe
  15. imgpath = path
  16. sns.set_context('poster')
  17. sns.set_style('white')
  18. sns.set_color_codes()
  19. plot_kwds = {'alpha': 0.5, 'linewidths':0 }
  20. plt.rcParams['figure.figsize'] = 9, 7
  21. fig = plt.figure()
  22. ax = fig.add_subplot(projection = '3d')
  23. ax.scatter(df['x'],df['y'],df['z'], color='g', s=0.3, **plot_kwds)
  24. plt.savefig(path, dpi=660)
  25. plt.clf()
  26. def draw_plot_cam_2(dataframe, path):
  27. df = dataframe
  28. sns.set_context('poster')
  29. sns.set_style('white')
  30. sns.set_color_codes()
  31. plot_kwds = {'alpha': 0.5, 'linewidths':0 }
  32. plt.rcParams['figure.figsize'] = 9, 7
  33. fig = plt.figure()
  34. ax = fig.add_subplot(projection = '3d')
  35. ax.scatter(df['x'],df['y'],df['z'], color='r', s=0.3, **plot_kwds)
  36. plt.savefig(path, dpi=660)
  37. plt.clf()
  38. def draw_xy(dataframe,path):
  39. df = dataframe
  40. path_list=path.split('/')
  41. plt.rcParams['figure.figsize'] = 9, 7
  42. fig=plt.figure()
  43. plt.scatter(df['x'], df['y'], s=0.2)
  44. plt.title(path_list[-1])
  45. plt.savefig(path, dpi=600)
  46. plt.clf()
  47. def draw_yz(dataframe, path):
  48. df = dataframe
  49. path_list=path.split('/')
  50. plt.rcParams['figure.figsize'] = 9, 7
  51. fig=plt.figure()
  52. plt.scatter(df['y'], df['z'], s=0.2)
  53. plt.title(path_list[-1])
  54. plt.savefig(path, dpi=600)
  55. plt.clf()
  56. def draw_xz(dataframe, path):
  57. df = dataframe
  58. path_list=path.split('/')
  59. plt.rcParams['figure.figsize'] = 9, 7
  60. fig=plt.figure()
  61. plt.scatter(df['z'], df['x'], s=0.2)
  62. plt.title(path_list[-1])
  63. plt.savefig(path, dpi=600)
  64. plt.clf()
  65. def draw_plot_total(dataframe, path):
  66. df = dataframe
  67. sns.set_context('poster')
  68. sns.set_style('white')
  69. sns.set_color_codes()
  70. plot_kwds = {'alpha': 0.5, 'linewidths':0 }
  71. plt.rcParams['figure.figsize'] = 9, 7
  72. fig = plt.figure()
  73. ax = fig.add_subplot(projection = '3d')
  74. ax.axes.set_xlim3d(left=-1.8, right=1.8)
  75. ax.axes.set_ylim3d(bottom=-1.8, top=1.8)
  76. ax.axes.set_zlim3d(bottom=0, top=1.8)
  77. ax.set_xlabel('x (left_right)')
  78. ax.set_ylabel('y (head_tail)')
  79. ax.set_zlabel('z (floor_ceiling)')
  80. cam_1 = df[df['cam'] == 1]
  81. cam_2 = df[df['cam'] == 2]
  82. ax.scatter(cam_1['x'],cam_1['y'],cam_1['z'], color='g', s=0.3, **plot_kwds)
  83. ax.scatter(cam_2['x'],cam_2['y'],cam_2['z'], color='r', s=0.3, **plot_kwds)
  84. plt.savefig(path, dpi=660)
  85. plt.clf()
  86. def draw_diff_diff(dataframe, path):
  87. data = dataframe
  88. plt.rcParams['figure.figsize'] =30, 7
  89. #plt.axes().set_aspect('equal')
  90. plt.xlim(data['frame'].min()-10, data['frame'].max()+10)
  91. #l = range(0, len(data['diff_diff']))
  92. #plt.xticks(l*10, data['diff_diff'])
  93. plt.ylim(data['diff_diff'].min(), data['diff_diff'].max())
  94. fig = plt.figure()
  95. plt.plot(data['frame'], data['diff_diff'], color='g')
  96. #plt.gca().set_aspect('auto')
  97. plt.savefig('./diff.png', dpi=600)
  98. plt.clf()