{ "cells": [ { "cell_type": "markdown", "id": "781eee9c", "metadata": {}, "source": [ "## using pandas\n" ] }, { "cell_type": "code", "execution_count": 9, "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[2]\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": 10, "id": "86c0ea73", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 10, "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": 11, "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": 12, "id": "c4883f09", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ 경고: './gt_raw/noisy_filtered_25_17.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_0_20.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_25_17.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_0_20.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_25_17.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_0_20.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_25_17.json' 경로에 파일이 없습니다. 해당 처리를 건너뜁니다.\n", "⚠️ 경고: './gt_raw/noisy_filtered_0_20.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", "lighter_100_ICP 44.031406 52.435581 42.041901 61.416871 47.082365 41.672265 48.519328 59.496986 44.332654 49.223155 52.905706 41.28387 40.700087 51.274741 7.043197 43.005873 48.454525 27.10287 61.897336 47.636925 0.0 0.0 0.0 0.0 0.0 45.577882\n", "lighter_75_ICP 59.098808 57.326067 46.441547 62.580202 44.60417 58.91144 50.783885 57.44006 57.405422 42.490315 45.52423 10.791263 44.932443 59.644908 61.919151 62.715163 1.006836 3.962637 52.735493 51.860579 0.0 0.0 0.0 0.0 0.0 46.608731\n", "lighter_50_ICP 46.450552 48.178686 57.195141 56.88371 59.391541 49.586613 46.451112 60.009016 57.210521 42.403544 57.107256 7.88677 6.645417 52.930587 45.571663 47.843378 50.46732 58.69847 8.281218 9.932976 0.0 0.0 0.0 0.0 0.0 43.456275\n", "lighter_25_ICP 55.436167 54.095489 52.698386 69.826195 56.204858 58.734411 48.923717 47.761471 47.907515 49.700797 57.26746 42.21437 47.43159 48.875833 45.498801 53.43394 0.0 71.332997 68.659387 69.14248 51.733052 64.534564 0.0 0.0 0.0 55.305404\n", "lighter_0_ICP 61.844402 62.798997 53.096304 57.819427 41.482482 66.44007 43.148632 51.360796 48.151635 38.796574 69.730626 34.982126 54.747281 42.142155 58.821656 67.921447 64.391176 60.134734 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.921789\n", "lighter_100_FAST ICP 44.030033 52.43579 42.040977 61.416018 47.086436 41.672265 48.519124 59.495222 44.326309 49.22307 52.8981 41.256781 40.695917 51.274842 7.045543 43.005489 48.455102 58.953856 61.897135 47.631463 0.0 0.0 0.0 0.0 0.0 47.167974\n", "lighter_75_FAST ICP 59.09517 57.306332 46.441547 62.580108 44.602292 58.911207 50.782529 57.446862 47.546461 42.490315 45.521923 51.803512 44.946472 59.642141 61.919289 62.708263 1.005982 3.962456 60.475383 51.857789 0.0 0.0 0.0 0.0 0.0 48.552302\n", "lighter_50_FAST ICP 46.450531 55.286996 57.195003 56.869056 47.59978 49.58655 46.450934 60.009693 57.207054 42.40772 57.107256 7.8869 6.645417 52.93172 15.65867 47.847213 50.4689 58.69852 8.281198 9.932965 0.0 0.0 0.0 0.0 0.0 41.726104\n", "lighter_25_FAST ICP 48.360956 54.091418 52.698386 69.824577 56.192161 58.73427 48.92131 47.760563 47.906479 49.694287 57.273734 42.216802 47.429862 48.876041 45.500418 53.433314 0.0 71.332997 68.659387 69.1426 51.7264 64.529027 0.0 0.0 0.0 54.966904\n", "lighter_0_FAST ICP 61.844402 62.786743 53.096304 57.819434 41.482335 66.440134 43.148632 51.359208 48.151148 38.751093 69.730527 34.982126 54.747281 42.140885 58.775908 67.921447 64.40322 60.13642 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.917125\n", "lighter_100_Robust ICP 46.969906 51.030885 44.41145 64.78425 46.584813 42.728301 49.599011 59.338651 45.640645 50.579288 55.991157 41.142821 2.603927 49.773181 10.118114 41.7812 50.386364 49.213602 65.703578 48.274112 0.0 0.0 0.0 0.0 0.0 45.832763\n", "lighter_75_Robust ICP 59.293352 58.941937 49.598767 66.822523 46.271277 58.948125 64.745924 59.248329 59.086666 49.850349 46.72277 2.034192 48.32924 61.11256 61.426583 59.999354 3.624397 11.36641 58.803312 50.628622 0.0 0.0 0.0 0.0 0.0 48.842734\n", "lighter_50_Robust ICP 47.028371 48.528587 62.442539 59.62731 60.27208 58.648501 69.933244 59.665263 56.651546 44.202106 75.667022 14.141444 20.012912 49.098508 20.823766 54.348047 47.603005 58.051159 14.027156 8.33374 0.0 0.0 0.0 0.0 0.0 46.455315\n", "lighter_25_Robust ICP 58.530892 57.262984 55.242563 69.441532 57.246818 59.470029 56.981729 48.746737 45.753599 58.401423 61.257737 44.459732 49.345559 52.359915 48.326837 48.472786 0.0 71.177924 78.100551 77.645091 57.948153 51.023879 0.0 0.0 0.0 57.485546\n", "lighter_0_Robust ICP 68.391445 71.565636 54.378979 43.517342 35.551863 57.948522 65.582622 51.119563 52.854722 39.328378 76.620731 72.627895 76.378028 58.883742 87.106659 83.539033 75.54481 45.790317 45.376732 0.0 49.184092 0.0 0.0 0.0 0.0 60.564556\n", "lighter_100_Sparse ICP 46.462582 50.403408 42.952367 61.329256 47.445332 41.615518 51.42486 45.420399 45.706995 49.555243 55.950855 46.5819 45.218347 49.709108 12.675745 55.208436 49.688467 25.675295 62.981186 54.847231 0.0 0.0 0.0 0.0 0.0 47.042627\n", "lighter_75_Sparse ICP 45.858867 57.529866 47.66801 63.301772 44.246995 45.738472 57.567932 59.023842 42.899136 45.692354 44.590133 44.617022 7.984983 49.728954 58.395728 62.477403 1.754404 5.32855 51.408942 50.175962 0.0 0.0 0.0 0.0 0.0 44.299466\n", "lighter_50_Sparse ICP 48.479521 50.046963 70.014242 59.884144 60.979967 51.086396 55.540914 59.712145 58.994105 43.763443 62.222375 3.250866 55.779991 69.536324 48.638768 50.251444 51.474251 68.259829 11.644272 3.604998 0.0 0.0 0.0 0.0 0.0 49.158248\n", "lighter_25_Sparse ICP 58.144394 56.862012 56.003043 74.275019 57.393949 59.564181 50.629653 55.602681 49.779146 57.143761 69.946379 16.506575 3.875355 7.725485 50.216107 74.471057 0.0 48.717725 73.188406 74.053897 52.321869 53.201349 0.0 0.0 0.0 52.362954\n", "lighter_0_Sparse ICP 75.76614 64.671873 56.943465 41.400345 50.955026 52.442105 41.807396 51.412095 53.435022 39.26023 45.370801 78.457701 28.441513 41.984304 61.565166 53.00935 72.873602 79.279796 36.382289 0.0 26.762347 0.0 0.0 0.0 0.0 52.611028\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_296320/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": 13, "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 53.372267 54.966964 50.294656 61.705281 49.753083 55.06896 47.565335 55.213666 51.001549 44.522877 56.507056 27.43168 38.891363 50.973645 43.770893 54.98396 32.863971 44.246341 48.777324 35.714592 24.009025 12.906913 0.0 0.0 0.0 49.174016\n", "FAST ICP 51.956218 56.381456 50.294444 61.701839 47.392601 55.068885 47.564506 55.214309 49.02749 44.513297 56.506308 35.629224 38.89299 50.973126 37.779966 54.983145 32.866641 50.61685 50.325258 35.712963 24.007695 12.905805 0.0 0.0 0.0 49.466082\n", "FAST AND ROBUST ICP 56.042793 57.466006 53.21486 60.838591 49.18537 55.548695 61.368506 55.623708 51.997436 48.472309 63.251883 34.881217 39.333933 54.245581 45.560392 57.628084 35.431715 47.119882 52.402266 36.976313 21.426449 10.204776 0.0 0.0 0.0 51.836183\n", "SPARSE ICP 54.942301 55.902825 54.716226 60.038107 52.204254 50.089334 51.394151 54.234232 50.162881 47.083006 55.616109 37.882813 28.260038 43.736835 46.298303 59.083538 35.158145 45.452239 47.121019 36.536418 15.816843 10.64027 0.0 0.0 0.0 49.094865\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": 14, "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", "lighter_100_ICP 44.031406 52.435581 42.041901 61.416871 47.082365 41.672265 48.519328 59.496986 44.332654 49.223155 52.905706 41.28387 40.700087 51.274741 7.043197 43.005873 48.454525 27.10287 61.897336 47.636925 0.0 0.0 0.0 0.0 0.0 45.577882\n", "lighter_75_ICP 59.098808 57.326067 46.441547 62.580202 44.60417 58.91144 50.783885 57.44006 57.405422 42.490315 45.52423 10.791263 44.932443 59.644908 61.919151 62.715163 1.006836 3.962637 52.735493 51.860579 0.0 0.0 0.0 0.0 0.0 46.608731\n", "lighter_50_ICP 46.450552 48.178686 57.195141 56.88371 59.391541 49.586613 46.451112 60.009016 57.210521 42.403544 57.107256 7.88677 6.645417 52.930587 45.571663 47.843378 50.46732 58.69847 8.281218 9.932976 0.0 0.0 0.0 0.0 0.0 43.456275\n", "lighter_25_ICP 55.436167 54.095489 52.698386 69.826195 56.204858 58.734411 48.923717 47.761471 47.907515 49.700797 57.26746 42.21437 47.43159 48.875833 45.498801 53.43394 0.0 71.332997 68.659387 69.14248 51.733052 64.534564 0.0 0.0 0.0 55.305404\n", "lighter_0_ICP 61.844402 62.798997 53.096304 57.819427 41.482482 66.44007 43.148632 51.360796 48.151635 38.796574 69.730626 34.982126 54.747281 42.142155 58.821656 67.921447 64.391176 60.134734 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.921789\n", "lighter_100_FAST ICP 44.030033 52.43579 42.040977 61.416018 47.086436 41.672265 48.519124 59.495222 44.326309 49.22307 52.8981 41.256781 40.695917 51.274842 7.045543 43.005489 48.455102 58.953856 61.897135 47.631463 0.0 0.0 0.0 0.0 0.0 47.167974\n", "lighter_75_FAST ICP 59.09517 57.306332 46.441547 62.580108 44.602292 58.911207 50.782529 57.446862 47.546461 42.490315 45.521923 51.803512 44.946472 59.642141 61.919289 62.708263 1.005982 3.962456 60.475383 51.857789 0.0 0.0 0.0 0.0 0.0 48.552302\n", "lighter_50_FAST ICP 46.450531 55.286996 57.195003 56.869056 47.59978 49.58655 46.450934 60.009693 57.207054 42.40772 57.107256 7.8869 6.645417 52.93172 15.65867 47.847213 50.4689 58.69852 8.281198 9.932965 0.0 0.0 0.0 0.0 0.0 41.726104\n", "lighter_25_FAST ICP 48.360956 54.091418 52.698386 69.824577 56.192161 58.73427 48.92131 47.760563 47.906479 49.694287 57.273734 42.216802 47.429862 48.876041 45.500418 53.433314 0.0 71.332997 68.659387 69.1426 51.7264 64.529027 0.0 0.0 0.0 54.966904\n", "lighter_0_FAST ICP 61.844402 62.786743 53.096304 57.819434 41.482335 66.440134 43.148632 51.359208 48.151148 38.751093 69.730527 34.982126 54.747281 42.140885 58.775908 67.921447 64.40322 60.13642 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.917125\n", "lighter_100_Robust ICP 46.969906 51.030885 44.41145 64.78425 46.584813 42.728301 49.599011 59.338651 45.640645 50.579288 55.991157 41.142821 2.603927 49.773181 10.118114 41.7812 50.386364 49.213602 65.703578 48.274112 0.0 0.0 0.0 0.0 0.0 45.832763\n", "lighter_75_Robust ICP 59.293352 58.941937 49.598767 66.822523 46.271277 58.948125 64.745924 59.248329 59.086666 49.850349 46.72277 2.034192 48.32924 61.11256 61.426583 59.999354 3.624397 11.36641 58.803312 50.628622 0.0 0.0 0.0 0.0 0.0 48.842734\n", "lighter_50_Robust ICP 47.028371 48.528587 62.442539 59.62731 60.27208 58.648501 69.933244 59.665263 56.651546 44.202106 75.667022 14.141444 20.012912 49.098508 20.823766 54.348047 47.603005 58.051159 14.027156 8.33374 0.0 0.0 0.0 0.0 0.0 46.455315\n", "lighter_25_Robust ICP 58.530892 57.262984 55.242563 69.441532 57.246818 59.470029 56.981729 48.746737 45.753599 58.401423 61.257737 44.459732 49.345559 52.359915 48.326837 48.472786 0.0 71.177924 78.100551 77.645091 57.948153 51.023879 0.0 0.0 0.0 57.485546\n", "lighter_0_Robust ICP 68.391445 71.565636 54.378979 43.517342 35.551863 57.948522 65.582622 51.119563 52.854722 39.328378 76.620731 72.627895 76.378028 58.883742 87.106659 83.539033 75.54481 45.790317 45.376732 0.0 49.184092 0.0 0.0 0.0 0.0 60.564556\n", "lighter_100_Sparse ICP 46.462582 50.403408 42.952367 61.329256 47.445332 41.615518 51.42486 45.420399 45.706995 49.555243 55.950855 46.5819 45.218347 49.709108 12.675745 55.208436 49.688467 25.675295 62.981186 54.847231 0.0 0.0 0.0 0.0 0.0 47.042627\n", "lighter_75_Sparse ICP 45.858867 57.529866 47.66801 63.301772 44.246995 45.738472 57.567932 59.023842 42.899136 45.692354 44.590133 44.617022 7.984983 49.728954 58.395728 62.477403 1.754404 5.32855 51.408942 50.175962 0.0 0.0 0.0 0.0 0.0 44.299466\n", "lighter_50_Sparse ICP 48.479521 50.046963 70.014242 59.884144 60.979967 51.086396 55.540914 59.712145 58.994105 43.763443 62.222375 3.250866 55.779991 69.536324 48.638768 50.251444 51.474251 68.259829 11.644272 3.604998 0.0 0.0 0.0 0.0 0.0 49.158248\n", "lighter_25_Sparse ICP 58.144394 56.862012 56.003043 74.275019 57.393949 59.564181 50.629653 55.602681 49.779146 57.143761 69.946379 16.506575 3.875355 7.725485 50.216107 74.471057 0.0 48.717725 73.188406 74.053897 52.321869 53.201349 0.0 0.0 0.0 52.362954\n", "lighter_0_Sparse ICP 75.76614 64.671873 56.943465 41.400345 50.955026 52.442105 41.807396 51.412095 53.435022 39.26023 45.370801 78.457701 28.441513 41.984304 61.565166 53.00935 72.873602 79.279796 36.382289 0.0 26.762347 0.0 0.0 0.0 0.0 52.611028\n", "ICP 53.372267 54.966964 50.294656 61.705281 49.753083 55.06896 47.565335 55.213666 51.001549 44.522877 56.507056 27.43168 38.891363 50.973645 43.770893 54.98396 32.863971 44.246341 48.777324 35.714592 24.009025 12.906913 0.0 0.0 0.0 49.174016\n", "FAST ICP 51.956218 56.381456 50.294444 61.701839 47.392601 55.068885 47.564506 55.214309 49.02749 44.513297 56.506308 35.629224 38.89299 50.973126 37.779966 54.983145 32.866641 50.61685 50.325258 35.712963 24.007695 12.905805 0.0 0.0 0.0 49.466082\n", "FAST AND ROBUST ICP 56.042793 57.466006 53.21486 60.838591 49.18537 55.548695 61.368506 55.623708 51.997436 48.472309 63.251883 34.881217 39.333933 54.245581 45.560392 57.628084 35.431715 47.119882 52.402266 36.976313 21.426449 10.204776 0.0 0.0 0.0 51.836183\n", "SPARSE ICP 54.942301 55.902825 54.716226 60.038107 52.204254 50.089334 51.394151 54.234232 50.162881 47.083006 55.616109 37.882813 28.260038 43.736835 46.298303 59.083538 35.158145 45.452239 47.121019 36.536418 15.816843 10.64027 0.0 0.0 0.0 49.094865\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 bottle csv" ] }, { "cell_type": "code", "execution_count": 15, "id": "9e8dcfae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ICP 49.174016\n", "FAST ICP 49.466082\n", "FAST AND ROBUST ICP 51.836183\n", "SPARSE ICP 49.094865\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": "fd0076a7", "metadata": {}, "source": [ "## Load num of dataset in each category. + save array" ] }, { "cell_type": "code", "execution_count": 16, "id": "9aeb6845", "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", "lighter_100_ICP 44.031406 52.435581 42.041901 61.416871 47.082365 41.672265 48.519328 59.496986 44.332654 49.223155 52.905706 41.28387 40.700087 51.274741 7.043197 43.005873 48.454525 27.10287 61.897336 47.636925 0.0 0.0 0.0 0.0 0.0 45.577882 20\n", "lighter_75_ICP 59.098808 57.326067 46.441547 62.580202 44.60417 58.91144 50.783885 57.44006 57.405422 42.490315 45.52423 10.791263 44.932443 59.644908 61.919151 62.715163 1.006836 3.962637 52.735493 51.860579 0.0 0.0 0.0 0.0 0.0 46.608731 20\n", "lighter_50_ICP 46.450552 48.178686 57.195141 56.88371 59.391541 49.586613 46.451112 60.009016 57.210521 42.403544 57.107256 7.88677 6.645417 52.930587 45.571663 47.843378 50.46732 58.69847 8.281218 9.932976 0.0 0.0 0.0 0.0 0.0 43.456275 20\n", "lighter_25_ICP 55.436167 54.095489 52.698386 69.826195 56.204858 58.734411 48.923717 47.761471 47.907515 49.700797 57.26746 42.21437 47.43159 48.875833 45.498801 53.43394 0.0 71.332997 68.659387 69.14248 51.733052 64.534564 0.0 0.0 0.0 55.305404 21\n", "lighter_0_ICP 61.844402 62.798997 53.096304 57.819427 41.482482 66.44007 43.148632 51.360796 48.151635 38.796574 69.730626 34.982126 54.747281 42.142155 58.821656 67.921447 64.391176 60.134734 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.921789 20\n", "lighter_100_FAST ICP 44.030033 52.43579 42.040977 61.416018 47.086436 41.672265 48.519124 59.495222 44.326309 49.22307 52.8981 41.256781 40.695917 51.274842 7.045543 43.005489 48.455102 58.953856 61.897135 47.631463 0.0 0.0 0.0 0.0 0.0 47.167974 20\n", "lighter_75_FAST ICP 59.09517 57.306332 46.441547 62.580108 44.602292 58.911207 50.782529 57.446862 47.546461 42.490315 45.521923 51.803512 44.946472 59.642141 61.919289 62.708263 1.005982 3.962456 60.475383 51.857789 0.0 0.0 0.0 0.0 0.0 48.552302 20\n", "lighter_50_FAST ICP 46.450531 55.286996 57.195003 56.869056 47.59978 49.58655 46.450934 60.009693 57.207054 42.40772 57.107256 7.8869 6.645417 52.93172 15.65867 47.847213 50.4689 58.69852 8.281198 9.932965 0.0 0.0 0.0 0.0 0.0 41.726104 20\n", "lighter_25_FAST ICP 48.360956 54.091418 52.698386 69.824577 56.192161 58.73427 48.92131 47.760563 47.906479 49.694287 57.273734 42.216802 47.429862 48.876041 45.500418 53.433314 0.0 71.332997 68.659387 69.1426 51.7264 64.529027 0.0 0.0 0.0 54.966904 21\n", "lighter_0_FAST ICP 61.844402 62.786743 53.096304 57.819434 41.482335 66.440134 43.148632 51.359208 48.151148 38.751093 69.730527 34.982126 54.747281 42.140885 58.775908 67.921447 64.40322 60.13642 52.313187 0.0 68.312073 0.0 0.0 0.0 0.0 54.917125 20\n", "lighter_100_Robust ICP 46.969906 51.030885 44.41145 64.78425 46.584813 42.728301 49.599011 59.338651 45.640645 50.579288 55.991157 41.142821 2.603927 49.773181 10.118114 41.7812 50.386364 49.213602 65.703578 48.274112 0.0 0.0 0.0 0.0 0.0 45.832763 20\n", "lighter_75_Robust ICP 59.293352 58.941937 49.598767 66.822523 46.271277 58.948125 64.745924 59.248329 59.086666 49.850349 46.72277 2.034192 48.32924 61.11256 61.426583 59.999354 3.624397 11.36641 58.803312 50.628622 0.0 0.0 0.0 0.0 0.0 48.842734 20\n", "lighter_50_Robust ICP 47.028371 48.528587 62.442539 59.62731 60.27208 58.648501 69.933244 59.665263 56.651546 44.202106 75.667022 14.141444 20.012912 49.098508 20.823766 54.348047 47.603005 58.051159 14.027156 8.33374 0.0 0.0 0.0 0.0 0.0 46.455315 20\n", "lighter_25_Robust ICP 58.530892 57.262984 55.242563 69.441532 57.246818 59.470029 56.981729 48.746737 45.753599 58.401423 61.257737 44.459732 49.345559 52.359915 48.326837 48.472786 0.0 71.177924 78.100551 77.645091 57.948153 51.023879 0.0 0.0 0.0 57.485546 21\n", "lighter_0_Robust ICP 68.391445 71.565636 54.378979 43.517342 35.551863 57.948522 65.582622 51.119563 52.854722 39.328378 76.620731 72.627895 76.378028 58.883742 87.106659 83.539033 75.54481 45.790317 45.376732 0.0 49.184092 0.0 0.0 0.0 0.0 60.564556 20\n", "lighter_100_Sparse ICP 46.462582 50.403408 42.952367 61.329256 47.445332 41.615518 51.42486 45.420399 45.706995 49.555243 55.950855 46.5819 45.218347 49.709108 12.675745 55.208436 49.688467 25.675295 62.981186 54.847231 0.0 0.0 0.0 0.0 0.0 47.042627 20\n", "lighter_75_Sparse ICP 45.858867 57.529866 47.66801 63.301772 44.246995 45.738472 57.567932 59.023842 42.899136 45.692354 44.590133 44.617022 7.984983 49.728954 58.395728 62.477403 1.754404 5.32855 51.408942 50.175962 0.0 0.0 0.0 0.0 0.0 44.299466 20\n", "lighter_50_Sparse ICP 48.479521 50.046963 70.014242 59.884144 60.979967 51.086396 55.540914 59.712145 58.994105 43.763443 62.222375 3.250866 55.779991 69.536324 48.638768 50.251444 51.474251 68.259829 11.644272 3.604998 0.0 0.0 0.0 0.0 0.0 49.158248 20\n", "lighter_25_Sparse ICP 58.144394 56.862012 56.003043 74.275019 57.393949 59.564181 50.629653 55.602681 49.779146 57.143761 69.946379 16.506575 3.875355 7.725485 50.216107 74.471057 0.0 48.717725 73.188406 74.053897 52.321869 53.201349 0.0 0.0 0.0 52.362954 21\n", "lighter_0_Sparse ICP 75.76614 64.671873 56.943465 41.400345 50.955026 52.442105 41.807396 51.412095 53.435022 39.26023 45.370801 78.457701 28.441513 41.984304 61.565166 53.00935 72.873602 79.279796 36.382289 0.0 26.762347 0.0 0.0 0.0 0.0 52.611028 20\n", "###################\n", "lighter_100_ICP 20\n", "lighter_75_ICP 20\n", "lighter_50_ICP 20\n", "lighter_25_ICP 21\n", "lighter_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['lighter_100_ICP':'lighter_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 }