{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    print(dirname)\n    #for filename in filenames:\n    #    print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-22T08:12:50.893608Z","iopub.execute_input":"2023-03-22T08:12:50.894207Z","iopub.status.idle":"2023-03-22T08:12:51.009844Z","shell.execute_reply.started":"2023-03-22T08:12:50.894170Z","shell.execute_reply":"2023-03-22T08:12:51.008739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from pathlib import Path\nfiles=Path(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog\").glob(\"*.csv\")\nfile_list=[]\nfor file in files:\n    file_list.append(file)\nprint(f\"{len(file_list)} files are found in train/tdcsfog directory\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T08:18:33.893647Z","iopub.execute_input":"2023-03-22T08:18:33.894865Z","iopub.status.idle":"2023-03-22T08:18:33.908188Z","shell.execute_reply.started":"2023-03-22T08:18:33.894814Z","shell.execute_reply":"2023-03-22T08:18:33.907010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.read_csv(file_list[0])\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T08:19:39.492917Z","iopub.execute_input":"2023-03-22T08:19:39.494012Z","iopub.status.idle":"2023-03-22T08:19:39.549552Z","shell.execute_reply.started":"2023-03-22T08:19:39.493964Z","shell.execute_reply":"2023-03-22T08:19:39.548647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T08:20:19.293537Z","iopub.execute_input":"2023-03-22T08:20:19.293989Z","iopub.status.idle":"2023-03-22T08:20:19.336858Z","shell.execute_reply.started":"2023-03-22T08:20:19.293948Z","shell.execute_reply":"2023-03-22T08:20:19.335655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.AccV.plot()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T08:24:44.286970Z","iopub.execute_input":"2023-03-22T08:24:44.287441Z","iopub.status.idle":"2023-03-22T08:24:44.541295Z","shell.execute_reply.started":"2023-03-22T08:24:44.287396Z","shell.execute_reply":"2023-03-22T08:24:44.539936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from scipy import signal\nfrom scipy.fft import fftshift\nimport matplotlib.pyplot as plt\n\nFsample=128#Sampling Freq\nf, t, Sxx = signal.spectrogram(df.iloc[:,3], Fsample)\nplt.pcolormesh(t, f, Sxx, shading='gouraud')\nplt.ylabel('Frequency [Hz]')\nplt.xlabel('Time [sec]')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T09:33:26.222888Z","iopub.execute_input":"2023-03-22T09:33:26.223612Z","iopub.status.idle":"2023-03-22T09:33:27.280151Z","shell.execute_reply.started":"2023-03-22T09:33:26.223559Z","shell.execute_reply":"2023-03-22T09:33:27.278802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nWn=3#Hz\nb,a=signal.butter(4,Wn,\"low\",fs=Fsample)\nfiltered_signal=signal.filtfilt(b,a,df.iloc[:,3])\n\n\nplt.subplot(3,1,1)\nplt.plot(df.iloc[:,3])\nplt.title(\"Raw Data\")\nplt.subplot(3,1,2)\nplt.plot(filtered_signal)\nplt.title(\"Filtered Data\")\nplt.subplot(3,1,3)\nplt.plot(df.iloc[:,5])\nplt.title(\"Turn\")\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-22T09:33:30.037134Z","iopub.execute_input":"2023-03-22T09:33:30.037592Z","iopub.status.idle":"2023-03-22T09:33:30.465898Z","shell.execute_reply.started":"2023-03-22T09:33:30.037532Z","shell.execute_reply":"2023-03-22T09:33:30.464628Z"},"trusted":true},"execution_count":null,"outputs":[]}]}