{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":60095,"databundleVersionId":6542333,"sourceType":"competition"}],"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Smartphone Decimeter: Ground Truth Data","metadata":{"papermill":{"duration":0.023455,"end_time":"2021-10-15T07:15:30.871323","exception":false,"start_time":"2021-10-15T07:15:30.847868","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import os\nimport numpy as np\nimport pandas as pd\nimport random\nimport folium\nfrom folium import plugins\nimport seaborn as sns\nimport cv2\nimport matplotlib.pyplot as plt\nimport IPython\nimport time\nimport plotly.express as px\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom branca.colormap import linear","metadata":{"papermill":{"duration":3.207351,"end_time":"2021-10-15T07:15:34.18931","exception":false,"start_time":"2021-10-15T07:15:30.981959","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-02-21T08:49:21.806808Z","iopub.execute_input":"2024-02-21T08:49:21.807260Z","iopub.status.idle":"2024-02-21T08:49:21.814214Z","shell.execute_reply.started":"2024-02-21T08:49:21.807233Z","shell.execute_reply":"2024-02-21T08:49:21.812854Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# device_gnss.csv\n\n[train/test]/[drive_id]/[phone_name]/device_gnss.csv - Each row contains raw GNSS measurements, derived values, and a baseline estimated location. This baseline was computed using correctedPrM and the satellite positions, using a standard Weighted Least Squares (WLS) solver, with the phone's position (x, y, z), clock bias (t), and isrbM for each unique signal type as states for each epoch. Some of the raw measurement fields are not included in this file because they are deprecated or are not populated in the original gnss_log.txt.","metadata":{}},{"cell_type":"code","source":"gnss=pd.read_csv('/kaggle/input/smartphone-decimeter-2023/sdc2023/train/2020-06-25-00-34-us-ca-mtv-sb-101/pixel4/device_gnss.csv')\nprint(gnss.columns.tolist())\ndisplay(gnss[0:1])","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:21.816197Z","iopub.execute_input":"2024-02-21T08:49:21.816573Z","iopub.status.idle":"2024-02-21T08:49:22.156460Z","shell.execute_reply.started":"2024-02-21T08:49:21.816539Z","shell.execute_reply":"2024-02-21T08:49:22.155550Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# device_imu.csv \n\n[train/test]/[drive_id]/[phone_name]/device_imu.csv - Readings the phone's accelerometer, gyroscope, and magnetometer.\n","metadata":{}},{"cell_type":"code","source":"imu=pd.read_csv('/kaggle/input/smartphone-decimeter-2023/sdc2023/train/2020-06-25-00-34-us-ca-mtv-sb-101/pixel4/device_imu.csv')\nprint(imu.columns.tolist())\ndisplay(imu[0:1])","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:22.157298Z","iopub.execute_input":"2024-02-21T08:49:22.157554Z","iopub.status.idle":"2024-02-21T08:49:22.301056Z","shell.execute_reply.started":"2024-02-21T08:49:22.157533Z","shell.execute_reply":"2024-02-21T08:49:22.299825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# ground_truth.csv\n\n\ntrain/[drive_id]/[phone_name]/ground_truth.csv - Reference locations at expected timestamps.","metadata":{}},{"cell_type":"code","source":"\ntruth=pd.read_csv('/kaggle/input/smartphone-decimeter-2023/sdc2023/train/2020-06-25-00-34-us-ca-mtv-sb-101/pixel4/ground_truth.csv')\nprint(truth.columns.tolist())\ndisplay(truth[0:1])","metadata":{"papermill":{"duration":0.097915,"end_time":"2021-10-15T07:15:34.311617","exception":false,"start_time":"2021-10-15T07:15:34.213702","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-02-21T08:49:22.303076Z","iopub.execute_input":"2024-02-21T08:49:22.303515Z","iopub.status.idle":"2024-02-21T08:49:22.322614Z","shell.execute_reply.started":"2024-02-21T08:49:22.303492Z","shell.execute_reply":"2024-02-21T08:49:22.321537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Check ground-truth data in the train dataset.","metadata":{}},{"cell_type":"code","source":"data0=truth\ndf=data0[['LatitudeDegrees','LongitudeDegrees','AltitudeMeters','SpeedMps','UnixTimeMillis']]\nprint(len(df))","metadata":{"papermill":{"duration":0.050245,"end_time":"2021-10-15T07:15:34.441181","exception":false,"start_time":"2021-10-15T07:15:34.390936","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-02-21T08:49:22.324226Z","iopub.execute_input":"2024-02-21T08:49:22.324578Z","iopub.status.idle":"2024-02-21T08:49:22.331165Z","shell.execute_reply.started":"2024-02-21T08:49:22.324546Z","shell.execute_reply":"2024-02-21T08:49:22.330147Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"latm=df['LatitudeDegrees'].mean()\nlonm=df['LongitudeDegrees'].mean()\n\neq_map = folium.Map(location=[latm,lonm],tiles='OpenStreetMap',zoom_start=10.0,min_zoom=2.0)\neq_map.add_child(plugins.HeatMap(df[['LatitudeDegrees','LongitudeDegrees']]))\neq_map","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:22.332812Z","iopub.execute_input":"2024-02-21T08:49:22.333167Z","iopub.status.idle":"2024-02-21T08:49:22.365011Z","shell.execute_reply.started":"2024-02-21T08:49:22.333137Z","shell.execute_reply":"2024-02-21T08:49:22.364120Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# speed","metadata":{}},{"cell_type":"code","source":"eq_map = folium.Map(location=[latm,lonm], tiles='OpenStreetMap', zoom_start=10.0, min_zoom=2.0)\ncolormap = linear.YlOrRd_05.scale(df['SpeedMps'].min(), df['SpeedMps'].max())\n\nfor i in range(len(df)):\n    lli = df.iloc[i,0:2].tolist()\n    speed = df.iloc[i,3]\n    color = colormap(speed)    \n    folium.Circle(location=lli, radius=30, color=color, fill_color=None).add_to(eq_map)\n\ncolormap.add_to(eq_map)\neq_map","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:22.366077Z","iopub.execute_input":"2024-02-21T08:49:22.367389Z","iopub.status.idle":"2024-02-21T08:49:23.254785Z","shell.execute_reply.started":"2024-02-21T08:49:22.367358Z","shell.execute_reply":"2024-02-21T08:49:23.253670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,5))\nplt.hist(df['SpeedMps'], bins=40, color='c', alpha=0.7)\nplt.title('SpeedMps Histogram')\nplt.xlabel('Speed (Meters per second)')\nplt.ylabel('Frequency')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:23.256200Z","iopub.execute_input":"2024-02-21T08:49:23.256521Z","iopub.status.idle":"2024-02-21T08:49:23.472021Z","shell.execute_reply.started":"2024-02-21T08:49:23.256495Z","shell.execute_reply":"2024-02-21T08:49:23.470986Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# altitude","metadata":{}},{"cell_type":"code","source":"eq_map = folium.Map(location=[latm,lonm], tiles='OpenStreetMap', zoom_start=10.0, min_zoom=2.0)\ncolormap = linear.YlOrRd_05.scale(df['AltitudeMeters'].min(), df['AltitudeMeters'].max())\n\nfor i in range(len(df)):\n    lli = df.iloc[i,0:2].tolist()\n    alt = df.iloc[i,2]\n    color = colormap(alt)    \n    folium.Circle(location=lli, radius=30, color=color, fill_color=None).add_to(eq_map)\n\ncolormap.add_to(eq_map)\neq_map","metadata":{"papermill":{"duration":0.030356,"end_time":"2021-10-15T07:15:40.543513","exception":false,"start_time":"2021-10-15T07:15:40.513157","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-02-21T08:49:23.473983Z","iopub.execute_input":"2024-02-21T08:49:23.474477Z","iopub.status.idle":"2024-02-21T08:49:24.351722Z","shell.execute_reply.started":"2024-02-21T08:49:23.474426Z","shell.execute_reply":"2024-02-21T08:49:24.350798Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,5))\nplt.hist(df['AltitudeMeters'], bins=40, color='c', alpha=0.7)\nplt.title('AltitudeMeters Histogram')\nplt.xlabel('AltitudeMeters')\nplt.ylabel('Frequency')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:24.353982Z","iopub.execute_input":"2024-02-21T08:49:24.354806Z","iopub.status.idle":"2024-02-21T08:49:25.326617Z","shell.execute_reply.started":"2024-02-21T08:49:24.354781Z","shell.execute_reply":"2024-02-21T08:49:25.325544Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# time","metadata":{}},{"cell_type":"code","source":"eq_map = folium.Map(location=[latm,lonm], tiles='OpenStreetMap', zoom_start=10.0, min_zoom=2.0)\ncolormap = linear.YlOrRd_05.scale(df['UnixTimeMillis'].min(), df['UnixTimeMillis'].max())\n\nfor i in range(len(df)):\n    lli = df.iloc[i,0:2].tolist()\n    time = df.iloc[i,4]\n    color = colormap(time)    \n    folium.Circle(location=lli, radius=30, color=color, fill_color=None).add_to(eq_map)\n\ncolormap.add_to(eq_map)\neq_map","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:25.328100Z","iopub.execute_input":"2024-02-21T08:49:25.329011Z","iopub.status.idle":"2024-02-21T08:49:26.205497Z","shell.execute_reply.started":"2024-02-21T08:49:25.328978Z","shell.execute_reply":"2024-02-21T08:49:26.203020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,5))\nplt.hist(df['UnixTimeMillis'], bins=40, color='c', alpha=0.7)\nplt.title('UnixTimeMillis Histogram')\nplt.xlabel('UnixTimeMillis')\nplt.ylabel('Frequency')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-02-21T08:49:26.206580Z","iopub.execute_input":"2024-02-21T08:49:26.207493Z","iopub.status.idle":"2024-02-21T08:49:26.437785Z","shell.execute_reply.started":"2024-02-21T08:49:26.207466Z","shell.execute_reply":"2024-02-21T08:49:26.436709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}