{"cells":[{"metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","collapsed":true,"trusted":true},"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport os\n\nimport_path = \"../input/\"","execution_count":1,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","collapsed":true,"trusted":true},"cell_type":"code","source":"detectors_df = pd.read_csv(import_path + 'detectors.csv')\ndetectors_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"14032399-aa06-4525-a52d-eabfb2e02648","_uuid":"93d96e4ee024fd94aefb138742c29a8c4a5926f2","collapsed":true,"trusted":true},"cell_type":"code","source":"train_1_files = os.listdir(import_path + 'train_1')\n# Get files names by blocks of 4: cells/hits/particles/truth\nsorted(train_1_files)[:4]","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"40124742-0016-4a6b-a357-e0aba146a235","_uuid":"0d60592e416725174473c618e1dfa67ee69071fb","collapsed":true,"trusted":true},"cell_type":"code","source":"cells_df = pd.read_csv(import_path + 'train_1/' + 'event000001000-{}.csv'.format('cells'))\nhits_df = pd.read_csv(import_path + 'train_1/' + 'event000001000-{}.csv'.format('hits'))\nparticles_df = pd.read_csv(import_path + 'train_1/' + 'event000001000-{}.csv'.format('particles'))\ntruth_df = pd.read_csv(import_path + 'train_1/' + 'event000001000-{}.csv'.format('truth'))","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"0e9c799d-8b45-43f3-9fde-d9f3ce10abe4","_uuid":"906ddd8f420944445c92610d785556b01ef3984f","collapsed":true,"trusted":true},"cell_type":"code","source":"cells_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"25f1a856-aab6-4c45-9b72-e12fe5b1bf09","_uuid":"ab5e817282e253423d6309f3c7d976dd1119ef8e","collapsed":true,"trusted":true},"cell_type":"code","source":"particles_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"27513797-d75a-4c82-a5ad-be582eb5b757","_uuid":"8a1f65c2e793f88c32dce651f7635c2f42aba0f1","collapsed":true,"trusted":true},"cell_type":"code","source":"truth_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"0d5e5395-3061-4865-ba91-28c76c396c34","_uuid":"deddb69481b7df5f026e5be82b30f43f74b113ef","collapsed":true,"trusted":true},"cell_type":"code","source":"hits_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"1533449b-4a5b-4729-be79-efd0cf54130d","_uuid":"687c652986a1fbd26ed001d3076fca27cd18a50a","collapsed":true,"scrolled":true,"trusted":true},"cell_type":"code","source":"for feature in ['volume_id', 'layer_id', 'module_id']:\n    print(feature, ':', np.unique(hits_df[feature]))","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"1cff240b-20e4-471a-b101-809bba18f5cf","_uuid":"b167935d2aed3d0fc6946e582a0d3727d485794e","collapsed":true,"trusted":true},"cell_type":"code","source":"from mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nyticks = np.unique(hits_df['volume_id'])\n\ncolors = [(round(np.random.random(),2), round(np.random.random(),2), round(np.random.random(),2)) for i in yticks]\n\nfig = plt.figure(figsize=(10,10))\n\nax = fig.add_subplot(111, projection='3d')\nfor i, volume_id_ in enumerate(yticks):\n    ax.plot(hits_df[hits_df['volume_id'] == volume_id_]['x'],\\\n            hits_df[hits_df['volume_id'] == volume_id_]['volume_id'],\\\n            hits_df[hits_df['volume_id'] == volume_id_]['z'],\\\n            'o', alpha=0.2, color=colors[i], label='Volume_id:{}'.format(volume_id_))\nax.set_xlabel('x')\nax.set_ylabel('Y Volume_id')\nax.set_zlabel('z')\nax.view_init(azim=45, elev=45)\nplt.legend()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"bef3e4fc-ad67-453f-8f06-08dda8a99ef3","_uuid":"cc6c509b87ff85cac0f2da7ff641611038964593","collapsed":true,"trusted":true},"cell_type":"code","source":"from mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nyticks = np.unique(hits_df['volume_id'])\n\ncolors = [(round(np.random.random(),2), round(np.random.random(),2), round(np.random.random(),2)) for i in yticks]\n\nfig = plt.figure(figsize=(15,15))\n\n# subplot grids\ngrid_index = list(range(331, 331+9))\nazimuts = [0, 45, 90]\nelev = [0, 45, 90]\n\nfor grid_i in range(0, 3):\n    for grid_j in range(0, 3):\n        \n        ax = fig.add_subplot(grid_index[grid_i*3 + grid_j], projection='3d')\n        for i, volume_id_ in enumerate(yticks):\n            ax.plot(hits_df[hits_df['volume_id'] == volume_id_]['x'],\\\n                    hits_df[hits_df['volume_id'] == volume_id_]['volume_id'],\\\n                    hits_df[hits_df['volume_id'] == volume_id_]['z'],\\\n                    'o', alpha=0.2, color=colors[i], label='Volume_id:{}'.format(volume_id_))\n        ax.set_xlabel('x')\n        ax.set_ylabel('Y Volume_id')\n        ax.set_zlabel('z')\n        ax.view_init(azim=azimuts[grid_i], elev=elev[grid_j])\n    \nfig.tight_layout()\nplt.legend()\nplt.show()","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.5","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}