{ "cells": [ { "cell_type": "markdown", "id": "781eee9c", "metadata": {}, "source": [ "## using pandas\n" ] }, { "cell_type": "code", "execution_count": 18, "id": "70fc5658", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import os\n", "import json\n", "## column : file no 1~25\n", "\n", "# array 4X4\n", "# for i in range(rows):\n", "# for j in range(cols):\n", "# object_array[i,j] = np.zeros((4,4))\n", "\n", "\n", "data = np.zeros((20,25))\n", "\n", "\n", "\n", "## row : bottle_0, bottle_25 ... gt 0 25 --> 10 rows. \n", "\n", "categories = ['bottle2', 'lightbulb', 'lighter', 'eyeglasses', 'magnifying_glass', 'spray']\n", "\n", "category = categories[5]\n", "fill_rate = ['100', '75', '50', '25', '0']\n", "\n", "columns = [f'file_{i}' for i in range(1,26)]\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "id": "22195309", "metadata": {}, "source": [ "## Get transformation file " ] }, { "cell_type": "code", "execution_count": null, "id": "d3dcc164", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 19, "id": "86c0ea73", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "## Tmatrix FOlder access -> save in pandas\n", "robust_no = ['0','2','3','6']\n", "new_row_names = []\n", "# 결과를 저장할 딕셔너리를 카테고리별로 초기화합니다.\n", "grouped_files = {fill: [] for fill in fill_rate}\n", "\n", "for no in robust_no:\n", " \n", " ## get txt file\n", "\n", " ######################## We got the txt file list#################\n", " for fills in fill_rate:\n", " \n", " if no =='0':\n", " name = \"ICP\"\n", " elif no == '2':\n", " name = \"FAST ICP\"\n", " elif no =='3':\n", " name = \"Robust ICP\"\n", " else:\n", " name = \"Sparse ICP\"\n", "\n", " new_row_names.append(f\"{category}_{fills}_{name}\")\n", "\n", "df = pd.DataFrame(data, index=new_row_names, columns=columns, dtype=object)\n", "# 2. df.index에 새로운 이름 리스트를 바로 할당 object for array 4x4\n", "\n", "df.info" ] }, { "cell_type": "markdown", "id": "173149df", "metadata": {}, "source": [ "## RMSE function" ] }, { "cell_type": "code", "execution_count": 20, "id": "5334ae14", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ 경고: './result3/result_3_100_1.txt' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n" ] } ], "source": [ "def RMSE(T_star, T):\n", " diff = T_star - T\n", " sq_norms = np.sum(diff**2, axis =1)\n", "\n", " r = np.sqrt(np.mean(sq_norms))\n", "\n", " return r\n", "\n", "## get T from Result Txt file\n", "def get_T(file_path):\n", "\n", " try:\n", " with open(file_path, 'r') as f:\n", " T_matrix = np.loadtxt(file_path)\n", " return T_matrix\n", " except FileNotFoundError:\n", " # try 블록에서 FileNotFoundError가 발생했을 때만 이 코드가 실행됩니다.\n", " print(f\"⚠️ 경고: '{file_path}' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\")\n", " return None # 파일이 없으므로 None을 반환\n", "\n", "\n", "\n", "\n", "def get_GT_T(file_path,data_name):\n", "\n", " try:\n", " with open(file_path, 'r') as f:\n", " loaded_data = json.load(f)\n", " noisy_data = loaded_data[data_name]\n", " T_matrix = noisy_data['matrix_world']\n", " np.array(T_matrix)\n", " return T_matrix\n", "\n", " except FileNotFoundError:\n", " # try 블록에서 FileNotFoundError가 발생했을 때만 이 코드가 실행됩니다.\n", " print(f\"⚠️ 경고: '{file_path}' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\")\n", " return None # 파일이 없으므로 None을 반환\n", "\n", " except KeyError as e:\n", " # try 블록에서 KeyError가 발생했을 때 실행됩니다. (e.g., 'matrix_world' 키가 없음)\n", " print(f\"⚠️ 경고: 파일 '{os.path.basename(file_path)}' 안에 필요한 키({e})가 없습니다.\")\n", " return None\n", " \n", " \n", "\n", "def compute_RMSE(gt_files):\n", " \n", " robust_no = ['0','2','3','6']\n", " \n", " for no in robust_no:\n", " if no =='0':\n", " name = \"ICP\"\n", " elif no == '2':\n", " name = \"FAST ICP\"\n", " elif no =='3':\n", " name = \"Robust ICP\"\n", " else:\n", " name = \"Sparse ICP\"\n", "\n", " for key, value_list in gt_files.items():\n", " rmse = []\n", " np.array(rmse)\n", " # get gt_T and noisy_T\n", " for value in value_list:\n", " profix = value.split('_')[1]\n", " gt_path = f\"./gt_raw/noisy_filtered_{key}_{profix}.json\"\n", " gt_name = f\"noisy_filtered_{key}_{profix}\"\n", "\n", " #### RESULT FOLDER PATH.\n", " result_path = f'./result{no}/result_{key}_{profix}.txt'\n", " icp_T = get_T(result_path)\n", " gt_T = get_GT_T(gt_path,gt_name)\n", " \n", " \n", "\n", " if (gt_T is None or icp_T is None):\n", " df.loc[f'{category}_{key}_{name}',f'file_{profix}'] = 0.0\n", "\n", " else:\n", " ## conpute rmse\n", " r = RMSE(gt_T, icp_T)\n", " \n", " df.loc[f'{category}_{key}_{name}',f'file_{profix}'] = r\n", "\n", "\n", "noisy_T = get_T(\"./result3/result_3_100_1.txt\")\n", "gt_T = get_GT_T(\"./gt/noisy_filtered_100_1.json\",\"noisy_filtered_100_1\")\n", "\n" ] }, { "cell_type": "markdown", "id": "587f5b2d", "metadata": {}, "source": [ "## Bring GT" ] }, { "cell_type": "code", "execution_count": 21, "id": "c4883f09", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ 경고: './gt_raw/noisy_filtered_75_13.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_75_13.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_75_13.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_75_13.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", " file_1 file_2 file_3 file_4 file_5 file_6 file_7 file_8 file_9 file_10 file_11 file_12 file_13 file_14 file_15 file_16 file_17 file_18 file_19 file_20 file_21 file_22 file_23 file_24 file_25 mean_Val\n", "spray_100_ICP 18.89495 19.032943 18.751856 16.733578 14.244949 12.889519 8.077694 10.165099 6.968007 7.990397 18.967942 40.846944 31.779988 32.900839 7.704187 6.940653 21.892604 19.334369 8.746607 8.77403 0.0 0.0 0.0 0.0 0.0 16.581858\n", "spray_75_ICP 14.9771 15.459415 18.079612 14.601443 12.393538 6.740496 9.859092 17.685778 30.732291 17.780973 23.348814 13.025298 0.0 9.287088 8.73427 27.846769 38.055155 7.142451 15.785973 13.509516 11.211267 0.0 0.0 0.0 0.0 16.312817\n", "spray_50_ICP 10.27852 8.839998 16.744881 18.675061 25.960086 33.10755 32.918405 35.045196 26.786946 24.125674 37.171587 54.480381 42.70027 6.036657 8.037929 16.530039 24.870865 31.203535 43.15093 42.822813 0.0 0.0 0.0 0.0 0.0 26.974366\n", "spray_25_ICP 23.426597 10.663536 37.279888 7.758736 14.85651 19.441112 25.103016 15.822062 10.398022 9.742273 10.566664 9.93391 4.978923 34.509792 33.652854 33.317584 10.595017 7.935119 6.684743 26.189816 0.0 0.0 0.0 0.0 0.0 17.642809\n", "spray_0_ICP 40.163337 40.355994 40.810238 46.400636 34.81581 42.324231 45.295617 40.755047 33.245653 20.646774 46.590952 6.079284 35.264521 11.719173 16.767735 13.211821 13.304608 33.961851 17.802501 30.836851 0.0 0.0 0.0 0.0 0.0 30.517632\n", "spray_100_FAST ICP 18.854383 19.030845 18.712699 16.734138 14.245743 12.83935 8.053614 10.157726 6.967986 7.77736 18.725055 40.797718 31.642164 32.815647 7.687937 6.03595 21.860162 19.455879 8.737057 8.718418 0.0 0.0 0.0 0.0 0.0 16.492491\n", "spray_75_FAST ICP 14.95984 15.460798 17.968268 14.560723 12.383259 6.587472 9.859169 8.679874 35.556317 17.778903 23.470056 12.295532 0.0 9.278815 8.599414 27.63018 38.077884 7.02414 15.780525 13.458627 11.197511 0.0 0.0 0.0 0.0 16.030365\n", "spray_50_FAST ICP 10.280536 8.838097 16.745204 18.609615 32.473158 33.101874 32.918405 34.932355 28.283895 24.123365 40.12897 54.445778 42.40537 6.119609 8.053291 16.484987 29.834798 31.193647 43.100632 42.840774 0.0 0.0 0.0 0.0 0.0 27.745718\n", "spray_25_FAST ICP 23.390868 10.628345 37.214777 7.751582 14.866393 19.42167 25.104566 15.857094 10.291185 9.686221 10.541714 9.858931 4.918437 34.536991 33.694456 33.478007 10.906425 7.870715 6.83741 26.189816 0.0 0.0 0.0 0.0 0.0 17.652280\n", "spray_0_FAST ICP 34.095196 34.067742 40.811493 45.63086 34.783859 42.324661 45.059052 40.754862 33.44389 20.700822 46.58432 6.813273 31.043682 11.800521 16.779023 13.212036 13.304608 33.94457 17.852773 30.798038 0.0 0.0 0.0 0.0 0.0 29.690264\n", "spray_100_Robust ICP 12.264572 13.039212 13.264325 13.220169 11.947938 13.0588 1.197707 1.484644 0.935645 1.23486 13.470815 64.432548 35.694998 18.971194 12.791092 9.031181 25.758949 9.205188 14.081264 14.063023 0.0 0.0 0.0 0.0 0.0 14.957406\n", "spray_75_Robust ICP 11.48121 11.964983 13.897543 11.589973 12.927856 0.969155 0.747051 0.865637 51.244892 13.27314 13.267561 9.17628 0.0 13.484558 14.018236 13.539542 38.808059 23.954947 20.054992 9.604282 8.407574 0.0 0.0 0.0 0.0 14.663874\n", "spray_50_Robust ICP 0.905626 0.921448 12.925955 12.925268 42.267167 33.487128 38.323621 18.693916 28.138679 22.359629 39.895793 38.718651 43.251142 4.601798 1.40114 21.449327 30.260841 48.242144 49.963131 42.068279 0.0 0.0 0.0 0.0 0.0 26.540034\n", "spray_25_Robust ICP 28.140095 1.967508 45.655628 1.359973 10.702004 22.355896 28.195258 19.786382 4.518637 1.059052 1.349441 13.095032 11.457025 26.847238 28.114693 28.812107 11.056385 1.355978 9.470145 30.858129 0.0 0.0 0.0 0.0 0.0 16.307830\n", "spray_0_Robust ICP 31.852833 29.437411 49.543301 56.507992 33.177568 44.020353 53.250882 41.748561 29.115067 23.067157 46.040317 1.961977 39.382007 19.87776 15.885989 10.088598 7.141422 51.317815 19.285864 43.45294 0.0 0.0 0.0 0.0 0.0 32.307791\n", "spray_100_Sparse ICP 13.09185 13.99834 14.571752 11.219286 9.156168 7.97802 6.107131 5.916891 4.639833 9.724679 14.392214 44.235393 34.972898 44.531979 12.238707 14.898623 25.836539 20.522897 10.980669 10.449475 0.0 0.0 0.0 0.0 0.0 16.473167\n", "spray_75_Sparse ICP 4.564444 4.686875 13.520175 5.022428 10.788299 32.920759 3.985293 10.233618 3.947709 6.347853 16.604865 13.340471 0.0 9.406679 10.827569 11.503016 41.220006 27.396564 18.211339 17.941414 8.194744 0.0 0.0 0.0 0.0 13.533206\n", "spray_50_Sparse ICP 6.041857 4.866843 8.862053 14.865822 28.994059 35.869917 33.605843 15.273483 30.316478 24.746829 41.024184 23.263686 44.545919 7.352034 1.314659 16.022246 29.093538 32.142366 47.72175 40.526495 0.0 0.0 0.0 0.0 0.0 24.322503\n", "spray_25_Sparse ICP 3.831284 4.695117 20.405525 34.768841 11.85428 18.309784 26.37223 15.438996 7.193915 4.050668 15.954122 5.671087 10.137371 14.19258 26.320111 27.315589 25.011721 2.957744 8.546823 21.442971 0.0 0.0 0.0 0.0 0.0 15.223538\n", "spray_0_Sparse ICP 45.22103 44.684384 34.96196 48.502795 34.246171 41.940607 43.6075 41.666942 18.494918 22.193817 42.889615 8.292622 34.136574 14.339022 23.440702 23.570318 5.565467 34.759063 36.745668 32.254993 0.0 0.0 0.0 0.0 0.0 31.575708\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_301435/3042233176.py:18: FutureWarning: Downcasting behavior in `replace` is deprecated and will be removed in a future version. To retain the old behavior, explicitly call `result.infer_objects(copy=False)`. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`\n", " df['mean_Val'] = df.replace(0, np.nan).mean(axis=1)\n" ] } ], "source": [ "json_path = \"ply_files.json\"\n", "try: \n", " with open(json_path, \"r\", encoding=\"utf-8\") as f:\n", " gt_files = json.load(f)\n", "except FileNotFoundError:\n", " print(f\"오류: '{json_path}' 파일을 찾을 수 없습니다. 먼저 파일 분류 코드를 실행해 주세요.\")\n", " exit() # 파일이 없으면 프로그램 종료\n", "\n", "\n", "\n", "### get \n", "\n", "\n", "\n", "compute_RMSE(gt_files)\n", "\n", "##get mean value\n", "df['mean_Val'] = df.replace(0, np.nan).mean(axis=1)\n", "\n", "\n", "\n", "# 모든 행/열을 전부 보여줌\n", "pd.set_option('display.max_rows', None) # 행 전체 출력\n", "pd.set_option('display.max_columns', None) # 열 전체 출력\n", "\n", "# 각 열의 너비 제한 해제 (긴 문자열도 잘리지 않음)\n", "pd.set_option('display.max_colwidth', None)\n", "\n", "# 화면 너비에 따라 줄바꿈을 할지 말지\n", "pd.set_option('display.width', None) # None이면 자동으로 콘솔 너비를 사용\n", "pd.set_option('display.expand_frame_repr', False) # True면 줄바꿈 허용, False면 한 줄로 출력 시도\n", "\n", "# 예: DataFrame 출력\n", "print(df)\n", " \n", "\n", "\n" ] }, { "cell_type": "markdown", "id": "7493fb27", "metadata": {}, "source": [ "## GET RMSE MEAN by ICP Methods\n", "\n" ] }, { "cell_type": "code", "execution_count": 22, "id": "e49285b9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3]\n", " file_1 file_2 file_3 file_4 file_5 file_6 file_7 file_8 file_9 file_10 file_11 file_12 file_13 file_14 file_15 file_16 file_17 file_18 file_19 file_20 file_21 file_22 file_23 file_24 file_25 mean_Val\n", "ICP 21.548101 18.870377 26.333295 20.833891 20.454179 22.900582 24.250765 23.894637 21.626184 16.057218 27.329192 24.873163 22.94474 18.89071 14.979395 19.569373 21.74365 19.915465 18.434151 24.426605 2.242253 0.0 0.0 0.0 0.0 21.605896\n", "FAST ICP 20.316165 17.605165 26.290488 20.657384 21.750482 22.855005 24.198961 22.076382 22.908655 16.013334 27.890023 24.842246 22.00193 18.910317 14.962824 19.368232 22.796775 19.89779 18.461679 24.401135 2.239502 0.0 0.0 0.0 0.0 21.522224\n", "FAST AND ROBUST ICP 16.928867 11.466112 27.05735 19.120675 22.204507 22.778267 24.342904 16.515828 22.790584 12.198767 22.804785 25.476897 25.957034 16.75651 14.44223 16.584151 22.605131 26.815214 22.571079 28.009331 1.681515 0.0 0.0 0.0 0.0 20.955387\n", "SPARSE ICP 14.550093 14.586312 18.464293 22.875834 19.007795 27.403818 22.735599 17.705986 12.918571 13.412769 26.173 18.960652 24.758552 17.964459 14.82835 18.661959 25.345454 23.555727 24.44125 24.52307 1.638949 0.0 0.0 0.0 0.0 20.225625\n", "\n" ] } ], "source": [ "df_mean = np.zeros((5,5))\n", "\n", "## make 25 lengths array\n", "\n", "grouping = []\n", "\n", "for i in range(0,len(df)):\n", " grouping.append(i)\n", "\n", "grouping = np.arange(len(df)) //5\n", "\n", "print(grouping)\n", "block_avg_df = df.groupby(grouping).mean()\n", "\n", "\n", "ICP_Method = ['ICP', 'FAST ICP', 'FAST AND ROBUST ICP', 'SPARSE ICP']\n", "\n", "\n", "\n", "block_avg_df.index = ICP_Method\n", "\n", "\n", "print(block_avg_df)\n", "\n", "print(type(block_avg_df))\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "14ebb074", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "d03a908e", "metadata": {}, "source": [ "## merge in Pandas" ] }, { "cell_type": "code", "execution_count": 23, "id": "92386801", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " file_1 file_2 file_3 file_4 file_5 file_6 file_7 file_8 file_9 file_10 file_11 file_12 file_13 file_14 file_15 file_16 file_17 file_18 file_19 file_20 file_21 file_22 file_23 file_24 file_25 mean_Val\n", "spray_100_ICP 18.89495 19.032943 18.751856 16.733578 14.244949 12.889519 8.077694 10.165099 6.968007 7.990397 18.967942 40.846944 31.779988 32.900839 7.704187 6.940653 21.892604 19.334369 8.746607 8.77403 0.0 0.0 0.0 0.0 0.0 16.581858\n", "spray_75_ICP 14.9771 15.459415 18.079612 14.601443 12.393538 6.740496 9.859092 17.685778 30.732291 17.780973 23.348814 13.025298 0.0 9.287088 8.73427 27.846769 38.055155 7.142451 15.785973 13.509516 11.211267 0.0 0.0 0.0 0.0 16.312817\n", "spray_50_ICP 10.27852 8.839998 16.744881 18.675061 25.960086 33.10755 32.918405 35.045196 26.786946 24.125674 37.171587 54.480381 42.70027 6.036657 8.037929 16.530039 24.870865 31.203535 43.15093 42.822813 0.0 0.0 0.0 0.0 0.0 26.974366\n", "spray_25_ICP 23.426597 10.663536 37.279888 7.758736 14.85651 19.441112 25.103016 15.822062 10.398022 9.742273 10.566664 9.93391 4.978923 34.509792 33.652854 33.317584 10.595017 7.935119 6.684743 26.189816 0.0 0.0 0.0 0.0 0.0 17.642809\n", "spray_0_ICP 40.163337 40.355994 40.810238 46.400636 34.81581 42.324231 45.295617 40.755047 33.245653 20.646774 46.590952 6.079284 35.264521 11.719173 16.767735 13.211821 13.304608 33.961851 17.802501 30.836851 0.0 0.0 0.0 0.0 0.0 30.517632\n", "spray_100_FAST ICP 18.854383 19.030845 18.712699 16.734138 14.245743 12.83935 8.053614 10.157726 6.967986 7.77736 18.725055 40.797718 31.642164 32.815647 7.687937 6.03595 21.860162 19.455879 8.737057 8.718418 0.0 0.0 0.0 0.0 0.0 16.492491\n", "spray_75_FAST ICP 14.95984 15.460798 17.968268 14.560723 12.383259 6.587472 9.859169 8.679874 35.556317 17.778903 23.470056 12.295532 0.0 9.278815 8.599414 27.63018 38.077884 7.02414 15.780525 13.458627 11.197511 0.0 0.0 0.0 0.0 16.030365\n", "spray_50_FAST ICP 10.280536 8.838097 16.745204 18.609615 32.473158 33.101874 32.918405 34.932355 28.283895 24.123365 40.12897 54.445778 42.40537 6.119609 8.053291 16.484987 29.834798 31.193647 43.100632 42.840774 0.0 0.0 0.0 0.0 0.0 27.745718\n", "spray_25_FAST ICP 23.390868 10.628345 37.214777 7.751582 14.866393 19.42167 25.104566 15.857094 10.291185 9.686221 10.541714 9.858931 4.918437 34.536991 33.694456 33.478007 10.906425 7.870715 6.83741 26.189816 0.0 0.0 0.0 0.0 0.0 17.652280\n", "spray_0_FAST ICP 34.095196 34.067742 40.811493 45.63086 34.783859 42.324661 45.059052 40.754862 33.44389 20.700822 46.58432 6.813273 31.043682 11.800521 16.779023 13.212036 13.304608 33.94457 17.852773 30.798038 0.0 0.0 0.0 0.0 0.0 29.690264\n", "spray_100_Robust ICP 12.264572 13.039212 13.264325 13.220169 11.947938 13.0588 1.197707 1.484644 0.935645 1.23486 13.470815 64.432548 35.694998 18.971194 12.791092 9.031181 25.758949 9.205188 14.081264 14.063023 0.0 0.0 0.0 0.0 0.0 14.957406\n", "spray_75_Robust ICP 11.48121 11.964983 13.897543 11.589973 12.927856 0.969155 0.747051 0.865637 51.244892 13.27314 13.267561 9.17628 0.0 13.484558 14.018236 13.539542 38.808059 23.954947 20.054992 9.604282 8.407574 0.0 0.0 0.0 0.0 14.663874\n", "spray_50_Robust ICP 0.905626 0.921448 12.925955 12.925268 42.267167 33.487128 38.323621 18.693916 28.138679 22.359629 39.895793 38.718651 43.251142 4.601798 1.40114 21.449327 30.260841 48.242144 49.963131 42.068279 0.0 0.0 0.0 0.0 0.0 26.540034\n", "spray_25_Robust ICP 28.140095 1.967508 45.655628 1.359973 10.702004 22.355896 28.195258 19.786382 4.518637 1.059052 1.349441 13.095032 11.457025 26.847238 28.114693 28.812107 11.056385 1.355978 9.470145 30.858129 0.0 0.0 0.0 0.0 0.0 16.307830\n", "spray_0_Robust ICP 31.852833 29.437411 49.543301 56.507992 33.177568 44.020353 53.250882 41.748561 29.115067 23.067157 46.040317 1.961977 39.382007 19.87776 15.885989 10.088598 7.141422 51.317815 19.285864 43.45294 0.0 0.0 0.0 0.0 0.0 32.307791\n", "spray_100_Sparse ICP 13.09185 13.99834 14.571752 11.219286 9.156168 7.97802 6.107131 5.916891 4.639833 9.724679 14.392214 44.235393 34.972898 44.531979 12.238707 14.898623 25.836539 20.522897 10.980669 10.449475 0.0 0.0 0.0 0.0 0.0 16.473167\n", "spray_75_Sparse ICP 4.564444 4.686875 13.520175 5.022428 10.788299 32.920759 3.985293 10.233618 3.947709 6.347853 16.604865 13.340471 0.0 9.406679 10.827569 11.503016 41.220006 27.396564 18.211339 17.941414 8.194744 0.0 0.0 0.0 0.0 13.533206\n", "spray_50_Sparse ICP 6.041857 4.866843 8.862053 14.865822 28.994059 35.869917 33.605843 15.273483 30.316478 24.746829 41.024184 23.263686 44.545919 7.352034 1.314659 16.022246 29.093538 32.142366 47.72175 40.526495 0.0 0.0 0.0 0.0 0.0 24.322503\n", "spray_25_Sparse ICP 3.831284 4.695117 20.405525 34.768841 11.85428 18.309784 26.37223 15.438996 7.193915 4.050668 15.954122 5.671087 10.137371 14.19258 26.320111 27.315589 25.011721 2.957744 8.546823 21.442971 0.0 0.0 0.0 0.0 0.0 15.223538\n", "spray_0_Sparse ICP 45.22103 44.684384 34.96196 48.502795 34.246171 41.940607 43.6075 41.666942 18.494918 22.193817 42.889615 8.292622 34.136574 14.339022 23.440702 23.570318 5.565467 34.759063 36.745668 32.254993 0.0 0.0 0.0 0.0 0.0 31.575708\n", "ICP 21.548101 18.870377 26.333295 20.833891 20.454179 22.900582 24.250765 23.894637 21.626184 16.057218 27.329192 24.873163 22.94474 18.89071 14.979395 19.569373 21.74365 19.915465 18.434151 24.426605 2.242253 0.0 0.0 0.0 0.0 21.605896\n", "FAST ICP 20.316165 17.605165 26.290488 20.657384 21.750482 22.855005 24.198961 22.076382 22.908655 16.013334 27.890023 24.842246 22.00193 18.910317 14.962824 19.368232 22.796775 19.89779 18.461679 24.401135 2.239502 0.0 0.0 0.0 0.0 21.522224\n", "FAST AND ROBUST ICP 16.928867 11.466112 27.05735 19.120675 22.204507 22.778267 24.342904 16.515828 22.790584 12.198767 22.804785 25.476897 25.957034 16.75651 14.44223 16.584151 22.605131 26.815214 22.571079 28.009331 1.681515 0.0 0.0 0.0 0.0 20.955387\n", "SPARSE ICP 14.550093 14.586312 18.464293 22.875834 19.007795 27.403818 22.735599 17.705986 12.918571 13.412769 26.173 18.960652 24.758552 17.964459 14.82835 18.661959 25.345454 23.555727 24.44125 24.52307 1.638949 0.0 0.0 0.0 0.0 20.225625\n" ] } ], "source": [ "combined_df = pd.concat([df, block_avg_df], ignore_index=False)\n", "\n", "# 모든 행/열을 전부 보여줌\n", "pd.set_option('display.max_rows', None) # 행 전체 출력\n", "pd.set_option('display.max_columns', None) # 열 전체 출력\n", "\n", "# 각 열의 너비 제한 해제 (긴 문자열도 잘리지 않음)\n", "pd.set_option('display.max_colwidth', None)\n", "\n", "# 화면 너비에 따라 줄바꿈을 할지 말지\n", "pd.set_option('display.width', None) # None이면 자동으로 콘솔 너비를 사용\n", "pd.set_option('display.expand_frame_repr', False) # True면 줄바꿈 허용, False면 한 줄로 출력 시도\n", "\n", "print(combined_df)" ] }, { "cell_type": "markdown", "id": "a9b19689", "metadata": {}, "source": [ "## Save spray csv" ] }, { "cell_type": "code", "execution_count": 24, "id": "9e8dcfae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ICP 21.605896\n", "FAST ICP 21.522224\n", "FAST AND ROBUST ICP 20.955387\n", "SPARSE ICP 20.225625\n", "Name: mean_Val, dtype: float64\n" ] } ], "source": [ "sliced_data = combined_df.loc['ICP':'SPARSE ICP', 'mean_Val']\n", "print(sliced_data)\n", "combined_df.to_csv(f'{category}.csv', index=True)" ] }, { "cell_type": "markdown", "id": "db7809f7", "metadata": {}, "source": [ "## Load num of dataset in each category. + save array" ] }, { "cell_type": "code", "execution_count": 25, "id": "7fd89b33", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " file_1 file_2 file_3 file_4 file_5 file_6 file_7 file_8 file_9 file_10 file_11 file_12 file_13 file_14 file_15 file_16 file_17 file_18 file_19 file_20 file_21 file_22 file_23 file_24 file_25 mean_Val Counts\n", "spray_100_ICP 18.89495 19.032943 18.751856 16.733578 14.244949 12.889519 8.077694 10.165099 6.968007 7.990397 18.967942 40.846944 31.779988 32.900839 7.704187 6.940653 21.892604 19.334369 8.746607 8.77403 0.0 0.0 0.0 0.0 0.0 16.581858 20\n", "spray_75_ICP 14.9771 15.459415 18.079612 14.601443 12.393538 6.740496 9.859092 17.685778 30.732291 17.780973 23.348814 13.025298 0.0 9.287088 8.73427 27.846769 38.055155 7.142451 15.785973 13.509516 11.211267 0.0 0.0 0.0 0.0 16.312817 20\n", "spray_50_ICP 10.27852 8.839998 16.744881 18.675061 25.960086 33.10755 32.918405 35.045196 26.786946 24.125674 37.171587 54.480381 42.70027 6.036657 8.037929 16.530039 24.870865 31.203535 43.15093 42.822813 0.0 0.0 0.0 0.0 0.0 26.974366 20\n", "spray_25_ICP 23.426597 10.663536 37.279888 7.758736 14.85651 19.441112 25.103016 15.822062 10.398022 9.742273 10.566664 9.93391 4.978923 34.509792 33.652854 33.317584 10.595017 7.935119 6.684743 26.189816 0.0 0.0 0.0 0.0 0.0 17.642809 20\n", "spray_0_ICP 40.163337 40.355994 40.810238 46.400636 34.81581 42.324231 45.295617 40.755047 33.245653 20.646774 46.590952 6.079284 35.264521 11.719173 16.767735 13.211821 13.304608 33.961851 17.802501 30.836851 0.0 0.0 0.0 0.0 0.0 30.517632 20\n", "spray_100_FAST ICP 18.854383 19.030845 18.712699 16.734138 14.245743 12.83935 8.053614 10.157726 6.967986 7.77736 18.725055 40.797718 31.642164 32.815647 7.687937 6.03595 21.860162 19.455879 8.737057 8.718418 0.0 0.0 0.0 0.0 0.0 16.492491 20\n", "spray_75_FAST ICP 14.95984 15.460798 17.968268 14.560723 12.383259 6.587472 9.859169 8.679874 35.556317 17.778903 23.470056 12.295532 0.0 9.278815 8.599414 27.63018 38.077884 7.02414 15.780525 13.458627 11.197511 0.0 0.0 0.0 0.0 16.030365 20\n", "spray_50_FAST ICP 10.280536 8.838097 16.745204 18.609615 32.473158 33.101874 32.918405 34.932355 28.283895 24.123365 40.12897 54.445778 42.40537 6.119609 8.053291 16.484987 29.834798 31.193647 43.100632 42.840774 0.0 0.0 0.0 0.0 0.0 27.745718 20\n", "spray_25_FAST ICP 23.390868 10.628345 37.214777 7.751582 14.866393 19.42167 25.104566 15.857094 10.291185 9.686221 10.541714 9.858931 4.918437 34.536991 33.694456 33.478007 10.906425 7.870715 6.83741 26.189816 0.0 0.0 0.0 0.0 0.0 17.652280 20\n", "spray_0_FAST ICP 34.095196 34.067742 40.811493 45.63086 34.783859 42.324661 45.059052 40.754862 33.44389 20.700822 46.58432 6.813273 31.043682 11.800521 16.779023 13.212036 13.304608 33.94457 17.852773 30.798038 0.0 0.0 0.0 0.0 0.0 29.690264 20\n", "spray_100_Robust ICP 12.264572 13.039212 13.264325 13.220169 11.947938 13.0588 1.197707 1.484644 0.935645 1.23486 13.470815 64.432548 35.694998 18.971194 12.791092 9.031181 25.758949 9.205188 14.081264 14.063023 0.0 0.0 0.0 0.0 0.0 14.957406 20\n", "spray_75_Robust ICP 11.48121 11.964983 13.897543 11.589973 12.927856 0.969155 0.747051 0.865637 51.244892 13.27314 13.267561 9.17628 0.0 13.484558 14.018236 13.539542 38.808059 23.954947 20.054992 9.604282 8.407574 0.0 0.0 0.0 0.0 14.663874 20\n", "spray_50_Robust ICP 0.905626 0.921448 12.925955 12.925268 42.267167 33.487128 38.323621 18.693916 28.138679 22.359629 39.895793 38.718651 43.251142 4.601798 1.40114 21.449327 30.260841 48.242144 49.963131 42.068279 0.0 0.0 0.0 0.0 0.0 26.540034 20\n", "spray_25_Robust ICP 28.140095 1.967508 45.655628 1.359973 10.702004 22.355896 28.195258 19.786382 4.518637 1.059052 1.349441 13.095032 11.457025 26.847238 28.114693 28.812107 11.056385 1.355978 9.470145 30.858129 0.0 0.0 0.0 0.0 0.0 16.307830 20\n", "spray_0_Robust ICP 31.852833 29.437411 49.543301 56.507992 33.177568 44.020353 53.250882 41.748561 29.115067 23.067157 46.040317 1.961977 39.382007 19.87776 15.885989 10.088598 7.141422 51.317815 19.285864 43.45294 0.0 0.0 0.0 0.0 0.0 32.307791 20\n", "spray_100_Sparse ICP 13.09185 13.99834 14.571752 11.219286 9.156168 7.97802 6.107131 5.916891 4.639833 9.724679 14.392214 44.235393 34.972898 44.531979 12.238707 14.898623 25.836539 20.522897 10.980669 10.449475 0.0 0.0 0.0 0.0 0.0 16.473167 20\n", "spray_75_Sparse ICP 4.564444 4.686875 13.520175 5.022428 10.788299 32.920759 3.985293 10.233618 3.947709 6.347853 16.604865 13.340471 0.0 9.406679 10.827569 11.503016 41.220006 27.396564 18.211339 17.941414 8.194744 0.0 0.0 0.0 0.0 13.533206 20\n", "spray_50_Sparse ICP 6.041857 4.866843 8.862053 14.865822 28.994059 35.869917 33.605843 15.273483 30.316478 24.746829 41.024184 23.263686 44.545919 7.352034 1.314659 16.022246 29.093538 32.142366 47.72175 40.526495 0.0 0.0 0.0 0.0 0.0 24.322503 20\n", "spray_25_Sparse ICP 3.831284 4.695117 20.405525 34.768841 11.85428 18.309784 26.37223 15.438996 7.193915 4.050668 15.954122 5.671087 10.137371 14.19258 26.320111 27.315589 25.011721 2.957744 8.546823 21.442971 0.0 0.0 0.0 0.0 0.0 15.223538 20\n", "spray_0_Sparse ICP 45.22103 44.684384 34.96196 48.502795 34.246171 41.940607 43.6075 41.666942 18.494918 22.193817 42.889615 8.292622 34.136574 14.339022 23.440702 23.570318 5.565467 34.759063 36.745668 32.254993 0.0 0.0 0.0 0.0 0.0 31.575708 20\n", "###################\n", "spray_100_ICP 20\n", "spray_75_ICP 20\n", "spray_50_ICP 20\n", "spray_25_ICP 20\n", "spray_0_ICP 20\n", "Name: Counts, dtype: int64\n" ] } ], "source": [ "\n", "\n", "df['Counts'] = (df != 0).sum(axis=1)-1\n", "\n", "# 모든 행/열을 전부 보여줌\n", "pd.set_option('display.max_rows', None) # 행 전체 출력\n", "pd.set_option('display.max_columns', None) # 열 전체 출력\n", "\n", "# 각 열의 너비 제한 해제 (긴 문자열도 잘리지 않음)\n", "pd.set_option('display.max_colwidth', None)\n", "\n", "# 화면 너비에 따라 줄바꿈을 할지 말지\n", "pd.set_option('display.width', None) # None이면 자동으로 콘솔 너비를 사용\n", "pd.set_option('display.expand_frame_repr', False) # True면 줄바꿈 허용, False면 한 줄로 출력 시도\n", "\n", "print(df)\n", "\n", "\n", "\n", "sliced_data = df.loc['spray_100_ICP':'spray_0_ICP', 'Counts']\n", "print(f\"###################\\n{sliced_data}\")\n", "sliced_data.to_csv(f'{category}_data_num.csv', index=True)" ] } ], "metadata": { "kernelspec": { "display_name": "icp", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.19" } }, "nbformat": 4, "nbformat_minor": 5 }